zookeeper doen's get started due to java.lang.ClassNotFoundException: org.apache.zookeeper.server.quorum.QuorumPeerMain - apache-zookeeper

I searched this forum already, no working answer is found for my case:
I installed java 1.8
I downloaded the binary version of zookeeper-3.5.5 from https://www.apache.org/dist/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz
I changed the zoo_sample.cfg to zoo.cfg, no changes made to the cfg
I tried to start zookeeper as root:
[root#pocdnr1n1 apache-zookeeper-3.5.5-bin]# bin/zkServer.sh start conf/zoo.cfg
I received error in log:
Could not find the main class: org.apache.zookeeper.server.quorum.QuorumPeerMain. Program will exit.
Thanks.

I think I have found the root cause, posting it here for future readers:
The culprit is Java.
I had an old java version on the node, this can be verified by running java -version
In my case the java was 1.6, what I did is to reset the environment to add the new java 1.8 to it:
# export JAVA_HOME=/opt/jdk1.8.0_151
# export JRE_HOME=/opt/jdk1.8.0_151/jre/
# export PATH=$PATH:/opt/jdk1.8.0_151/bin:/opt/jdk1.8.0_151/jre/bin
You should add the PATH to the .bash_profile so that it becomes permanent.
Now after that you run source .bash_profile, now you have set java 1.8 as the default java. again, you can confirm that by running java -version
Run your zookeeper again and it will be started as expected.
The common missings here are:
downloaded the non-binary zookeeper
java is too low (1.6 doesn't work, 1.8 is recommended)
environment should be set to ensure java 1.8 is picked up as default version
I hope this helps.

If you look at ZooKeeper Administrator's Guide - Required Software for 3.5.5 it says:
ZooKeeper runs in Java, release 1.7 or greater (JDK 7 or greater, FreeBSD support requires openjdk7).
which affirms what you found out. Your Java version was too low.

What worked for me was rebuilding with ./gradlew jar -PscalaVersion-2.13.10
I was using kafka straight from source from github.com/apache/kafka and that step was given to me when I cloned a fresh copy of the repo to start from scratch.
I had done a git pull on my old version, so it broke the dependencies, which I forgot I must have at one point installed.

Related

Can Apache Storm run on Windows 10 from within Eclipse?

In trying to learn about Apache Storm, I have been following Unboxing Apache Storm series (https://www.youtube.com/watch?v=QoEyXKIKZKY&list=PLeUBsMTwZBi3rPzowug5-PdGA_cmD9QbE&index=1), with the exception that I am working under Windows rather than an Linux system. For the windows specific installation, I followed https://www.techgeeknext.com/apache/install-apache-storm#google_vignette. I am using Eclipse to set up the main and other classes that contain the toy example in the series (video 7/Creating First Java Project). However, once I try to run the example, I get the error:
Unable to canonicalize address localhost/:2000 because it's not resolvable.
I thought the error was because I had the clientPort in zookeeper.properties and storm.zookeeper.port in storm.yaml set to the default of 2181, so I changed it to 2000, but I still get the same error. I am using JDK 1.8.333, apache storm 1.2.3, eclipse 2022-03 (4.23.0), python 3.9.7, and zookeeper 3.4.14. If anyone has any suggestions, that would be great.

Run different ActiveMQ Artemis versions with separate JDK's

quick question; is it possible and reasonable to run different Artemis ActiveMQ versions with different JDK versions?
There are currently two separate Artemis-Services on my VM running different Artemis versions (2.4.0 not cool, I know :/ and 2.16.0).
Now I want to upgrade the 2.16.0 to 2.21.0 which would mean, that I also need a new JDK version. The problem is I still have to provide a customer with the 2.4.0 version.
Can I run the 2.21.0 with JDK 17 and the 2.4.0 still with JDK 8?
The Java-Version seems to be referenced in the artemis-service.xml as %JAVA_HOME% which is a windows environment variable and outputs either JDK 17 or JDK 8.
Could I just switch this variable to a local env, similar to ARTEMIS_INSTANCE in the artemis-service.xml or is this not an intended use?
So the new artemis-service.xml would look something like this:
...
<env name="ARTEMIS_INSTANCE_ETC_URI" value="file:/C:/ApacheMQ/BROKER/etc/"/>
<env name="ARTEMIS_DATA_DIR" value="C:\ApacheMQ\BROKER\data"/>
<env name="JAVA_V17" value="C:\PATH_TO_JDK_17"/>
<logpath>C:\ApacheMQ\BROKER\log</logpath>
<logmode>roll</logmode>
<executable>%JAVA_V17%\bin\java.exe</executable>
...
Obviously one of the JDK versions wouldn't be properly installed but just residing in a folder.
Yes, I know this is more of a dirty workaround, but would it be an option in principle?
Your solution will works, an alternative could be to use the full path to define the executable element, i.e.
<executable>C:\PATH_TO_JDK_17\bin\java.exe</executable>

How to run Apache Storm in Single Node on Windows OS

How to run Apache Storm in Single Node on Windows OS? Can anyone provide a link for that?
Install Java
Download and install a JDK (Storm works with both Oracle and OpenJDK 6/7). For this setup I used JDK 7 from Oracle.
I installed Java in:
C:\Java\jdk1.7.0_45\
Install Python
To test the installation, we’ll be deploying the “word count” sample from the storm-starter project which uses a multi-lang bolt written in python. I used python 2.7.6 which can be downloaded here.
I installed python in:
C:\Python27\
Install and Run Zookeeper
Download Apache Zookeeper 3.3.6 and extract it. Configure and run Zookeeper with the following commands:
> cd zookeeper-3.3.6
> copy conf\zoo_sample.cfg conf\zoo.cfg
> .\bin\zkServer.cmd
Install Storm
The changes that allow Storm to run seamlessly on Windows have not been officially released yet, but you can download a build with those changes incorporated here.
(Source branch for that build can be found here).
Extract that file to the location of your choice. I chose C:.
Configure Environment Variables
On Windows Storm requires the STORM_HOME and JAVA_HOME environment variables to be set, as well as some additions to the PATH variable:
JAVA_HOME:
C:\Java\jdk1.7.0_45\
STORM_HOME:
C:\storm-0.9.1-incubating-SNAPSHOT-12182013\
PATH: (add)
%STORM_HOME%\bin;%JAVA_HOME%\bin;C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;
PATHEXT: (add)
.PY
Start Nimbus, Supervisor, and Storm UI Daemons
For each deamon open a separate command prompt.
Nimbus
cd %STORM_HOME%
storm nimbus
Supervisor
cd %STORM_HOME%
storm supervisor
Storm UI
cd %STORM_HOME%
storm ui
Verify that Storm is running by opening http://localhost:8080/ in a browser.
Deploy the “Word Count” Topology
Either build the storm-starter project from source, or download a pre-built jar
Deploy the Word Count topology to your local cluster with the storm jar command:
storm jar storm-starter-0.0.1-SNAPSHOT-jar-with-dependencies.jar storm.starter.WordCountTopology WordCount -c nimbus.host=localhost

Trouble with kafka example

I downloaded Apache Kafka and successfully completed the quickstart . When i tried running the example program provided, I got an error :
cannot load main class.
I dont know what I'm missing I even set the classpath.
Run this command if you are on Amazon EC2:
sudo yum install java-1.6.0-openjdk-devel
javac must be there. For that you need both JDK and JRE. You probably only have JRE installed.

How to diagnose eclipse crashes?

OMG, eclipse (it's Gallileo, but with previous versions I also had such problems) crashed again, silently as always. That can happen one time per week, but this is really annoying. All I have now is a crash log. Are there any ways of discovering the true reason of these crashes?
Header of crash log, can't see anything useful:
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d80f8d4, pid=1388, tid=3180
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_12-b04 mixed mode)
# Problematic frame:
# V [jvm.dll+0xcf8d4]
#
I used to have these kind of silent crashes on 64-bit Linux. For me it was fine after adding these lines to my eclipse.ini (see corresponding Eclipse and Sun bug entries):
-XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith
-XX:CompileCommand=exclude,org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding,<init>
For Galileo, I would recommend trying to launch it with the most recent JVM possible;
That does not mean you have to compile your projects with that JDK: you can declare as many JDK you want within your eclipse session.
(source: benmccann.com)
(although this picture shows jdk1.5, you can launch eclipse with any other JVM)
See this eclipse.ini for more details.
As this recent thread illustrates, that can happens with an "old" eclipse.ini, so it is worth checking and updating the ini file.
This is a bug in the Sun's Java VM which Eclipse triggers. These are notoriously hard to figure out. I suggest this approach:
Install a newer VM (1.5.0 16 or 1.6)
Disable all plugins you've installed
I had a similar issue with Groovy on Linux. I don't remember my solution but try a different version of Groovy in this case.