Error while running ice on ubuntu ( java) - java

I am having trouble while trying to run the example for printer.
when i try to run the class for the server it prints
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: Ice/LocalException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: Ice.LocalException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
For what i have been searching it is caused by the classpath export?
i did export CLASSPATH=$CLASSPATH:./classes:$ICE_HOME/share/java/ice.jar
ICE_HOME is /usr.
Does anyone know how to fix? thanks

After typing the question continued looking for it. As it seems exports are wierd, when i do ctrl + shift + T for a new terminal it deletes them. Only after looking at the exports page i realized they were getting deleted.

Related

JNI error: Exception in thread "main" java.lang.NoClassDefFoundError

Error log:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/text/StrSubstitutor
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.text.StrSubstitutor
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 7 more
I know that people have asked this question before but none of them are using the Dropwizard framework.
Here is what I have tried:
Different versions of Dropwizard using the pom.xml,
Adding commons-lang and commons-text don't seem to fix it, though commons-text makes it throw a different error,
Restarting my computer.
It is a pretty involved pom.xml file which I am not comfortable sharing...
Any ideas why this is happening?
Is it possible, that you compile with a newer version (like Java 8) and run it with an older version (Java 7)? If yes, check the Path. (1)
Another thing could be, that the apache libraries are compiled with a more recent version.
(1) Try comparing the output of java --version and javac --version

Compiled JAVA project, can't make it work

got a problem, can't manage it to work for me right.
Completed my java project and i want it to compile and run for a test. I do compile it as "Jar file" (not runnable jar file). I compile it through Eclipse IDE.
I do not setup any more references in compiling settings, making everything stock. Once i compile it as "Server.jar" in my desktop i'm trying to run through console, because it's more like console program. I'm using macOS.
Using command : java -jar Server.jar
Error:
Ervinass-MacBook-Air:Desktop Ervinas$ java -jar Server.jar
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.json.simple.parser.ParseException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
What should i do?
It shouws class is not found if i'm right?
This : org/json/simple/parser/ParseException is not recognised.
What i have tried : java -classpath ~/Documents/Java/Server/src/server/json-simple.jar -jar Server.jar
As all of you see, i'm using json-simple.jar library, moreover i do use mysql library, so i guess later it will be the same problem with mysql library.
Any solution? Tired of getting it working now..

DSC Signing on Linux server by ePass 2003 token

I am trying to sign an XML using ePass 2003 token on Linux machine.
Signing is successful in Windows machine but it threw an exception in Linux machine.
The exception is given below:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/cms/CMSException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.cms.CMSException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Configuration of Linux machine is listed below
Java : JDK 1.8 update 91
Token : ePass 2003
PKCS11_KEYSTORE_TYPE = "PKCS11";
DIGITAL_SIGNATURE_ALGORITHM_NAME ="SHA256withRSA";
SUN_PKCS11_PROVIDER_CLASS = "sun.security.pkcs11.SunPKCS11";
DLL_PATH = "/home/ePass2003-Linux-x64/redist/libcastle.so.1.0.0";
Please help me.
It is running well on Window machine, but throwing listed .
It is error due to incorrect path of folder.
It not a measure issue.
Please check basic java flow of code.
Some silly mistakes has been done!!

java.lang.NoClassDefFoundError: org/apache/spark/sql/SchemaRDD

I am getting a NoClassDefFound error when trying to run Spark. I cannot figure out the reason behind this. Please help.
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/spark/sql/SchemaRDD
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:659)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:180)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:205)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:120)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.spark.sql.SchemaRDD
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 10 more
NoClassDefFoundError means Java couldn't find the Class it was looking for. That normally means:
You defined wrongly the classpath.
Java is finding and using the wrong version of the jar (probably because of Maven dependency hell).
Solution for 1 is to check the classpath: make sure you are including the jar that defines org.apache.spark.sql.SchemaRDD.
Solution for 2 is to check if you have a Maven dependency that depends (transitively) on an older version of the resource that defines that class.

Using Illinois Chunker

I am trying to extract noun phrases from text using the illinois chunker however i seem to be getting something wrong. I am trying to run the command in a centos6.4 system with jdk1.8 having downloaded the jar given in the link.
java -Xmx512m -classpath /path/to/LBJChunk.jar edu.illinois.cs.cogcomp.lbj.chunk.ChunksAndPOSTags snippeting.txt
this returns a class not found exception, what am i doing wrong >:( do i have to download an other jar for the parser?
Exception in thread "main" java.lang.NoClassDefFoundError: LBJ2/parse/Parser
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)
at java.lang.Class.getMethod0(Class.java:2937)
at java.lang.Class.getMethod(Class.java:1771)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: LBJ2.parse.Parser
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more
You'll need some more jars on the classpath. It's not very clear, but the description for the chunker notes that LBJ (a language library) and the Illinois POS tagger are required. You can get more information on how to run it here.
Then, run this command:
java -classpath /path/to/LBJChunk.jar:/path/to/LBJ2Library.jar:/path/toLBJPOS.jar \
edu.illinois.cs.cogcomp.lbj.chunk.ChunksAndPOSTags snippeting.txt
That should work!

Categories