How Do You Troubleshoot the Spark-Shell Error “A JNI error has occurred”?

Problem scenario
You run spark-shell in a Debian distribution of Linux (e.g., Ubuntu) but you receive this error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 64
        at java.util.jar.JarFile.match(java.base@9-internal/JarFile.java:983)
        at java.util.jar.JarFile.checkForSpecialAttributes(java.base@9-internal/JarFile.java:1017)
        at java.util.jar.JarFile.isMultiRelease(java.base@9-internal/JarFile.java:399)
        at java.util.jar.JarFile.getEntry(java.base@9-internal/JarFile.java:524)
        at java.util.jar.JarFile.getJarEntry(java.base@9-internal/JarFile.java:480)
at jdk.internal.util.jar.JarIndex.getJarIndex(java.base@9-internal/JarIndex.java:114)
        at jdk.internal.loader.URLClassPath$JarLoader$1.run(java.base@9-internal/URLClassPath.java:640)
        at jdk.internal.loader.URLClassPath$JarLoader$1.run(java.base@9-internal/URLClassPath.java:632)
        at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
        at jdk.internal.loader.URLClassPath$JarLoader.ensureOpen(java.base@9-internal/URLClassPath.java:631)
        at jdk.internal.loader.URLClassPath$JarLoader.<init(java.base@9-internal/URLClassPath.java:606)
        at jdk.internal.loader.URLClassPath$3.run(java.base@9-internal/URLClassPath.java:386)
        at jdk.internal.loader.URLClassPath$3.run(java.base@9-internal/URLClassPath.java:376)
        at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
        at jdk.internal.loader.URLClassPath.getLoader(java.base@9-internal/URLClassPath.java:375)
        at jdk.internal.loader.URLClassPath.getLoader(java.base@9-internal/URLClassPath.java:352)
        at jdk.internal.loader.URLClassPath.getResource(java.base@9-internal/URLClassPath.java:218)
        at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9-internal/BuiltinClassLoader.java:463)
        at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9-internal/BuiltinClassLoader.java:460)
        at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
        at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(java.base@9-internal/BuiltinClassLoader.java:459)
        at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(java.base@9-internal/BuiltinClassLoader.java:406)
        at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9-internal/BuiltinClassLoader.java:364)
        at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9-internal/ClassLoaders.java:184)
        at java.lang.ClassLoader.loadClass(java.base@9-internal/ClassLoader.java:419)
        at sun.launcher.LauncherHelper.loadMainClass(java.base@9-internal/LauncherHelper.java:585)
        at sun.launcher.LauncherHelper.checkAndLoadMain(java.base@9-internal/LauncherHelper.java:497)

How do you solve this?

How Do You Install Apache Spark on Any Type of Linux?

Problem scenario
You want a generic script that can install open source Apache Spark on Debian/Ubuntu, CentOS/RedHat/Fedora or SUSE distributions of Linux.  How do you do this?

Solution
1.  Create a script such as this in /tmp/ (e.g., /tmp/spark.sh).

#!/bin/bash
# Written by www.continualintegration.com

sparkversion=2.2.1  # Change this version as necessary

distro=$(cat /etc/*-release | grep NAME)

debflag=$(echo $distro | grep -i “ubuntu”)
if [ -z “$debflag” ]
then  

How Do You Install OSSEC on Any Type of Linux?

Problem scenario
You have Debian/Ubuntu, RedHat (including CentOS and Fedora), and SUSE distributions of Linux.  You want to install OSSEC on each server (to protect them with host-based intrusion detection systems, IDSes).  You want to use the same script to install OSSEC on each server. How do you do this?

Solution
1.  Create a script such as this /tmp/ossec.sh.

#!/bin/bash
# Written by www.continualintegration.com

ossecversion=3.1.0 

How Do You Install Apache Solr on Any Type of Linux?

Problem scenario
You want a generic script that can install open source Apache Solr on Debian/Ubuntu, CentOS/RedHat/Fedora or SUSE distributions of Linux.  How do you do this with the same bash script?

Solution
1.  Create a script such as this in /tmp/ (e.g., /tmp/solr.sh).

#!/bin/bash
# Written by www.continualintegration.com

solrversion=7.2.1  # Change this version as necessary

distro=$(cat /etc/*-release | grep NAME)

debflag=$(echo $distro | grep -i “ubuntu”)
if [ -z “$debflag” ]
then  

How Do You Write a Python Program to Simulate a Dial-by-Name directory?

Updated on 9/19/19 to use Python 3

Problem scenario
You have a list of first and last names in a file.  You want a program to extract the last names based on the first two or three letters.  You want to allow the user to dial by last name (to enter phone keys that correspond to letters of last names).  You want the user to enter a sequence of numbers that will correspond to the first two or three letters of the person’s last name. 

How Do You Create a VM in Google Cloud Platform Using a Command Line or an API?

Problem scenario
You want to create a server in Google Cloud Platform using an API or command line.  How do you do this?

Solution
1.  Log into Google Cloud Platform.  
2.  Click the hamburger icon in the upper left hand corner (the icon with three horizontal bars stacked onto each other).
3.  Go to Compute Engine -VM Instances
4. 

When There Is A “connection refused” Message for Graylog, What Might Be the Problem?

Problem scenario
Using PowerShell you test TCP/IP connectivity over port 9000 to your Graylog instance.  You use these commands:

$tcp = New-Object System.Net.Sockets.TcpClient
$tcp.connect(‘x.x.x.x’, ‘9000’)

You get “Exception calling “Connect” with “2” argument(s): “N connection could be made because the target maching actively refused it.”   

You know there is no firewall blocking port 9000.  Using nmap you test TCP/IP connectivity over port 9000 to your Graylog instance.

How Do You Troubleshoot an Empty Multi-node Hadoop Cluster?

Problem scenario
One or more of the following is happening:
   1) There are 0 DataNodes in your Hadoop cluster according to an error message
   2) There is 0 B configured as capacity (as shown from a “hdfs dfsadmin -report” command).
   3)  There is one fewer DataNode in your Hadoop cluster than you expect.
   4)  You run “hdfs dfsadmin -report | grep Hostname” and do not see a node that has its DataNode service (as seen with the 

How Do You Troubleshoot This Problem “Access denied for user ‘zabbix’@’localhost’ (using password: YES)”?

Problem scenario
The web UI for Zabbix shows the Zabbix server is not running.  In “Status of Zabbix” there is a parameter “Zabbix server is running” and it has a value of “No.”  To investigate on the back-end of the Zabbix server you run this command: tail -f /var/log/zabbix/zabbix_server.log

You see this error: “Access denied for user ‘zabbix’@’localhost’ (using password: YES)”

What should you do?

Solution
Examine the zabbix_server.conf file.