I've installed zookeeper v 3.4.9 on suse using the following package:
http://download.opensuse.org/repositories/home:/nicolasbock:/midokura/openSUSE_Leap_42.2/x86_64/zookeeper-3.4.9-1.1.x86_64.rpm
Starting the server works just fine an the various application that need to connect to it seem to be able to do so just fine, however I'm getting a strange error when I try to start the client:
zkCli.sh -server 127.0.0.1:2181
Error: Could not find or load main class org.apache.zookeeper.ZooKeeperMain
I've tried searching around the internet but the only answer I've come up with is setting the env variable $CLASSPATH. I tried looking what classpath is used internally by the serve starting script and set $CLASSPATH to that but with no results.
I'm running openjvm v 1.8.0_121
I encountered this problem today on Ubuntu 18.04. On zookeper official download page once one follows the given mirror link and chooses stable version, he can see 2 files available. In my case those were:
apache-zookeeper-3.5.5-bin.tar.gz
apache-zookeeper-3.5.5.tar.gz
I chose apache-zookeeper-3.5.5.tar.gz, observed the same problem. Tried to print CLASSPATH as #Jonathan suggested, it was printing different paths however, problem is that the archive file did not contain zookeper jars, probably it is expected that user packages to jar himself as I could find source code in that archive file.
Downloading larger apache-zookeeper-3.5.5-bin.tar.gz archive, extracting and running ./zkCli.sh went smooth as it had everything necessary, so whoever faces the same problem, try that and see if it does the trick for you.
Are you trying on Unix or Windows?
I dont think, you need "-server 127.0.0.1:2181"
Just run zkCli.sh or zkCli.cmd
That is a classpath problem. The zkCli.sh script is attempting to launch a java app where the main class is ZooKeeperMain. However, java cannot find the ZooKeeperMain class file because the classpath being passed to java does not contain a jar file that contains the ZooKeeperMain class.
Typically, the ZooKeeperMain.class file is contained in a jar file at something like $ZOOKEEPER_HOME/zookeeper-3.4.13.jar.
You might trying modifying the zkCli.sh script to print out the classpath just before the script attempts to launch ZooKeeperMain. The classpath should contain the jar that contains the ZooKeeperMain class.
On my Windows 10 machine, my classpath looks like this:
/c/Program Files (x86)/Zookeeper/bin/../build/classes:/c/Program Files (x86)/Zookeeper/bin/../lib/slf4j-log4j12-1.7.25.jar:/c/Program Files (x86)/Zookeeper/bin/../lib/slf4j-api-1.7.25.jar:/c/Program Files (x86)/Zookeeper/bin/../lib/netty-3.10.6.Final.jar:/c/Program Files (x86)/Zookeeper/bin/../lib/log4j-1.2.17.jar:/c/Program Files (x86)/Zookeeper/bin/../lib/jline-0.9.94.jar:/c/Program Files (x86)/Zookeeper/bin/../lib/audience-annotations-0.5.0.jar:/c/Program Files (x86)/Zookeeper/bin/../zookeeper-3.4.12.jar:/c/Program Files (x86)/Zookeeper/bin/../conf:
I encountered a similar errors as yours when launching zkCli.sh from Git Bash for Windows on my Windows 10 machine. My issue was because of the way Git Bash was handling wildcards in the classpath. I initially had some *.jar entries in my classpath that I removed to get zkCli.sh to launch.
Related
I just installed Kawa to code some scheme, https://www.gnu.org/software/kawa/index.html.
I'm using MacOs Terminal (my Mac is currently using Big Sur).
I cloned the repo, and followed all the installation steps specified in here: https://www.gnu.org/software/kawa/Source-distribution.html
Also installed dependencies.
The command that starts the program is "Kawa".
Everything works fine if, and only if, I type "Kawa" command in terminal when I'm in the directory that all the files where copied into. The program runs and I'm able to code in scheme. Please note that this is not a local executable, as I don't have to type "./Kawa" for it to work.
However, if I'm in any other directory and I type "Kawa", the following Error gets printed on the console: Could not find or load main class kawa.repl
Caused by: java.lang.ClassNotFoundException: kawa.repl
I'm just learning about unix/linux and don't know much about java, but I'm guessing this has something to do with file paths?
I checked and some of the files were installed in /usr/local/share/kawa in my Mac. If you go through the installation steps that I linked to above, after you run "make install", it says that you have to manually specify:
CLASSPATH=$PREFIX/share/java/kawa.jar
export CLASSPATH
I don't know exactly what that does. I wonder if this is something that I should put in some file, I tried just typing in the terminal and running the "kawa" command after with no success.
Any help will be appreciated, thank you.
I work on a product which is built upon Eclipse RCP and has a lot of plugins associated with it. The product build is exported as a .zip file for mac. However after extracting the zip file using the default archive utility in mac and then trying to run the product, it results in a dialog box with the message "Unable to locate companion shared library". This issue started only after updating the mac to Sierra; it worked completely fine for El Capitan.
I have tried several things as suggested by different posts like
1) checking the paths in the .ini files
-startup
../../../plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.300.v20150602-1417
These paths are perfectly fine and respective startup jar and launcher folder exists on the paths specified.
2) Using a different extractor
I used Keka extractor for mac and unzipped the build using it and surprisingly the product runs. I looked into the directory structure of the extracted build by the archive utility and keka. I noticed that there are few things missing in the build extracted by archive utility like some directories in configuration and p2 folder. I don't know whats causing it.
Since many of the product users simply use default archive utility in mac, is it possible to fix this issue somehow without letting the users download an additional extractor like keka?
I found the same problem with Talend in Sierra (also an app built on eclipse). The following command line seemed to fix the problem:
xattr -c TOS_DI-macosx-cocoa.app or generically
xattr -c NameOfYourApp.app
I have developed a program that pulls the data from a remote sql server and pushes it to local mysql server .I have a jar file exported for this .
Now I am trying to run this jar file on different machine to do the same task .All the IP's and ports have been changed accordingly .There is no IDE on this machine .
When i am running this jar file , i get an error saying "No suitable driver found for jdbc:sqlserver:/ 172 .* "
I have installed the jdbc driver in program files .
So what do i have to do to run this jar file .
You need to add the library to the runtime classpath. A straightforward way would be to export it as a dependency in the jar (although there might be licencing issues with that).
How are you creating the jar?
Add the jdbc driver in your classpath, not in your "program files".... Check the documentation of the JVM http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html
All you need to run a Java program is a Java executable and class files or zipped/jared class files and other files needed by class files. So 1st step is locate your java executable, maybe c:\java.exe or /home/yourhome/java, and 2nd step is gather all your classes or zip/jar archive and put them in a String split by ':' on Unix or Unix-like or ';' on windows. 3rd step is to identify your main class, which is the only entry of your program.
In the end, use YOUR_JAVA_EXECYTABLE -classpath YOUR_CLASS_PATH YOUR_MAIN_CLASS. works fine for most scenarios.
Forget anything about "installed" a program or driver, which is just put some some in system's classpath or path or anything like this.
I have a JAVA application that runs fine in my local Windows7 environment on Tomcat7. I am trying to put this into production in a Linux environment.
Everything is done and is working fine except when my application tries to access the DB. Operations where DB is not involved, it works fine.
The error I get is
java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
This class is part of tomcat-dbcp.jar. This is placed in my $CATALINA_HOME/lib folder. Why is this still not getting picked up? Please help!
UPDATE: I also opened up the .jar file and checked. The org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory.class file is present.
Was finally able to crack it. My mistake - I was relying only on echo $CATALINA_HOME to check its location. Turns out that this can be misleading.
It is better to use
ps aux | grep catalina
In the output that comes look for catalina.base and catalina.home. The path given in front of these variables is the path from where Tomcat libs are being fetched. I had done a default installation and found the libs under /usr/share/tomcat7. As it turns out, the default installation done using yum did not provide the tomcat-dbcp.jar file. Instead it provided the commons-dbcp.jar. Read about tomcat-dbcp vs commons-dbcp
Changing the lib files under the usr/share/tomcat7 folder required me to use sudo bash. Also you may notice that the lib folder under /usr/share/tomcat7 is a simlink. Just do ls /usr/share/tomcat7 -l to get the parent location. You will be able to make changes only in the parent location.
Similar things can be checked for server.xml which is also finally being picked from /usr/share/tomcat7 itself.
The best way to manage all these is to create your own simlinks so that you don't need to bother about going to various locations after the first time.
Thanks to everyone who tried to help.
I have a problem with vlc.I am using Eclipse and have made a small application to play video files using vlcj framework.Inside Eclipse everything works fine but when I make jar executable file through Eclipse and double-clicking it (on Windows 64: Tested only on this platform) nothing happens .Then I'm trying using "cd myjarfilepath" and then "java -jar myjarname.jar" and everything works fine.Why this is happening and how to solve it?
Thanks in advance to stackoverflow's community .
Edit:
In Path Location: C:\Users\user\Documents\31\Latest_Win64\Needed I have the following files:
plugins(directory)
axvlc.dll
axvlc.dll.manifest
libvlc.dll
libvlc.dll.manifest
libvlccore.dll
npvlc.dll
npvlc.dll.manifest
vlc.exe.manifest
In my classpath i have included the following files:
jna-3.5.1.jar
platform-3.5.1.jar
vlcj-2.2.0.jar
vlcj-2.2.0-javadoc.jar
vlcj-2.2.0-sources.jar
This sounds like an issue loading the needed VLCj files. Not only are dlls required but the plugin directory is also required. As the execution location moves around from inside eclipse to back in the file system, the path to these files may be getting set incorrectly.
It sounds like you have it working within eclipse. This would indicate to me that what you have should work. Firstly, I would recommend acquiring the VLC dlls, etc., by providing this as a VM argument such as shown below, rather that setting it in code. Remember to comment out any loading you are doing in your code so that you are relying on the command line argument.
-Djna.library.path={Application Location}/lib
example: -Djna.library.path=C:/myapp/lib
Directory Contents:
lib
-- libblc.dll
-- libvlc5.dll
-- {etc}
/plugins
/3dnow
/access
{etc}
If you are still having issues, add the following argument to put VLCj into debug mode. This can be very helpful to determine where things are failing.
-Dvlcj.log=DEBUG
Hope that helps.