Java RMI NoClassDefFoundError (development on Netbeans IDE) - java

I'm a student, and I'm trying to write an RMI application.
I have 3 separate projects:
One is Server Side
One is Common (include Interface and Entities to reflect with Database Structure)
One is Client
and I write it on Netbeans IDE.
When I start server I receive a printstack error like this:
Exception in thread "main" java.lang.NoClassDefFoundError: rmi/cosmetic/Interfaces/ICategories
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at Server.ServerSide.main(ServerSide.java:22)
Caused by: java.lang.ClassNotFoundException: rmi.cosmetic.Interfaces.ICategories
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 13 more
Java Result: 1
rmi/cosmetic/Interfaces/ICategories
is the path of file Interface Categories, it has been contained in Common Project for both of 2 sides client and server
I have no idea about this issue. I try to set classpath on my windows but it didn't work.
Can someone please help me?
Some images, to make it clear
http://upanh.7nghiep.com/vgo-images/vgo.vn-qIntT.jpg
http://upanh.7nghiep.com/vgo-images/vgo.vn-jaJw0.jpg
upanh.7nghiep.com/vgo-images/vgo.vn-RvxIo.jpg
upanh.7nghiep.com/vgo-images/vgo.vn-DvuMt.jpg
upanh.7nghiep.com/vgo-images/vgo.vn-OI9rL.jpg

Caused by: java.lang.ClassNotFoundException:
rmi.cosmetic.Interfaces.ICategories
There's your problem right there. Your Registry or your client can't find that class. It needs to be on their CLASSPATH.

Related

Java 7 supported JavaFx application is not running on Mojave

My application supported on:
Jdk1.7.0_76,
JavaFx2.2.76_b13,
Netbeans IDE,
Ant for building and creating installer.
Supported on Windows and Mac.
It's running successfully till High-Sierra
When I tried to run .app file on Mojave it is giving
Unable to load Info.plist exceptions (eGPUOverrides)
And when I tried to run jar file it gives following error
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 13 more

java.lang.NoClassDefFoundError: org/apache/http/client/ClientProtocolException while using the jsonparser()

java.lang.NoClassDefFoundError: org/apache/http/client/ClientProtocolException
at situasses.Situassess.<init>(Situassess.java:24)
at myproject.RecomAgent.setup(RecomAgent.java:33)
at jade.core.Agent$ActiveLifeCycle.init(Agent.java:1522)
at jade.core.Agent.run(Agent.java:1468)
at java.lang.Thread.run(Thread.java:744)Caused by: java.lang.ClassNotFoundException: org.apache.http.client.ClientProtocolException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 5 more
ERROR: Agent user61 died without being properly terminated !!!
State was 2
Add HTTPClient.jar to your classpath. And also check this for details.

junit gives error java.lang.NoClassDefFoundError: junit/framework/JUnit4TestAdapterCache

I'm trying to run a simple unit test to my project at https://github.com/cdwijayarathna/oj4j.
I added both junit-4.12.jar and ant-junit4.jar to the lib folder.
But when I ran "rake run_tests", I'm getting following error at the report location I have given.
java.lang.NoClassDefFoundError: junit/framework/JUnit4TestAdapterCache
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
What's the reason for that? how can I solve this?
I had the same exception running junit through ant on Debian. By including the junit4.jar in the $CLASSPATH environment variable I was able to get it running. Which means the jvm was not picking up on the junit4.jar. The /usr/share/java/junit4.jar path is specific to Debian's junit package, so you will need to replace as appropriate.
$ export CLASSPATH=/usr/share/java/junit4.jar
$ ant test
I use specific jars to run tests on a project, here is the command line which solve this issue:
$ CLASSPATH=lib/hamcrest-core-1.3.jar:lib/junit-4.12.jar ant my-junit-target
I've wrote a small shell to encapsulate this command.
Set ANT_HOME your $CLASSPATH environment variables.

Strange error from Apache JackRabbit

Anyone ever get this exception from Apache JackRabbit?
This exception occurs on RHEL 6 Linux.
ERROR RepositoryImpl:393 - In addition to startup fail, another unexpected problem occurred while shutting down the repository again.
java.lang.NullPointerException
at org.apache.jackrabbit.core.RepositoryImpl.doShutdown(RepositoryImpl.java:1141)
at org.apache.jackrabbit.core.RepositoryImpl.shutdown(RepositoryImpl.java:1065)
at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:389)
at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:605)
at org.apache.jackrabbit.core.TransientRepository$1.getRepository(TransientRepository.java:180)
at org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:280)
at org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:376)
at org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:123)
Exception in thread java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
at org.apache.jackrabbit.core.util.db.ConnectionFactory.getDriverDataSource(ConnectionFactory.java:312)
at org.apache.jackrabbit.core.util.db.ConnectionFactory.createDataSource(ConnectionFactory.java:240)
at org.apache.jackrabbit.core.util.db.ConnectionFactory.getDataSource(ConnectionFactory.java:166)
at org.apache.jackrabbit.core.fs.db.DbFileSystem.getDataSource(DbFileSystem.java:226)
at org.apache.jackrabbit.core.fs.db.DatabaseFileSystem.init(DatabaseFileSystem.java:190)
at org.apache.jackrabbit.core.config.RepositoryConfigurationParser$6.getFileSystem(RepositoryConfigurationParser.java:1057)
at org.apache.jackrabbit.core.config.RepositoryConfig.getFileSystem(RepositoryConfig.java:911)
at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:285)
at org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:605)
at org.apache.jackrabbit.core.TransientRepository$1.getRepository(TransientRepository.java:180)
at org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:280)
at org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:376)
at org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:123)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool.impl.GenericObjectPool
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 20 more

Runtime error upon running compiled Groovy code in IntelliJ IDEA 13

I keep getting this error when I attempt to run compiled Groovy code in IntelliJ IDEA 13:
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java -Didea.launcher.port=7539 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13.app/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/javafx-doclet.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/htmlconverter.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Users/Insanity/Documents/Programming/Programming Languages/Groovy/Asteroids!/out/production/Asteroids!:/Users/Insanity/Desktop/:usr:local/opt/groovy/libexec/lib/ant-1.9.2.jar:local/opt/groovy/libexec/lib/ant-antlr-1.9.2.jar:local/opt/groovy/libexec/lib/ant-junit-1.9.2.jar:local/opt/groovy/libexec/lib/ant-launcher-1.9.2.jar:local/opt/groovy/libexec/lib/antlr-2.7.7.jar:local/opt/groovy/libexec/lib/asm-4.1.jar:local/opt/groovy/libexec/lib/asm-analysis-4.1.jar:local/opt/groovy/libexec/lib/asm-commons-4.1.jar:local/opt/groovy/libexec/lib/asm-tree-4.1.jar:local/opt/groovy/libexec/lib/asm-util-4.1.jar:local/opt/groovy/libexec/lib/bsf-2.4.0.jar:local/opt/groovy/libexec/lib/commons-cli-1.2.jar:local/opt/groovy/libexec/lib/commons-logging-1.1.1.jar:local/opt/groovy/libexec/lib/gpars-1.1.0.jar:local/opt/groovy/libexec/lib/groovy-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-ant-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-bsf-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-console-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-docgenerator-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-groovydoc-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-groovysh-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-jmx-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-json-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-jsr223-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-servlet-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-sql-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-swing-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-templates-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-test-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-testng-2.2.2.jar:local/opt/groovy/libexec/lib/groovy-xml-2.2.2.jar:local/opt/groovy/libexec/lib/hamcrest-core-1.3.jar:local/opt/groovy/libexec/lib/ivy-2.3.0.jar:local/opt/groovy/libexec/lib/jansi-1.10.jar:local/opt/groovy/libexec/lib/jcommander-1.27.jar:local/opt/groovy/libexec/lib/jline-2.10.jar:local/opt/groovy/libexec/lib/jsp-api-2.0.jar:local/opt/groovy/libexec/lib/jsr166y-1.7.0.jar:local/opt/groovy/libexec/lib/junit-4.11.jar:local/opt/groovy/libexec/lib/multiverse-core-0.7.0.jar:local/opt/groovy/libexec/lib/qdox-1.12.1.jar:local/opt/groovy/libexec/lib/servlet-api-2.4.jar:local/opt/groovy/libexec/lib/testng-6.8.5.jar:local/opt/groovy/libexec/lib/xmlpull-1.1.3.1.jar:local/opt/groovy/libexec/lib/xstream-1.4.4.jar:/Users/Insanity/Documents/Programming/Programming Languages/Java/Libraries/Java Game Libraries/slick/lib/slick.jar:/Users/Insanity/Documents/Programming/Programming Languages/Java/Libraries/Java Game Libraries/lwjgl-2.9.1/jar/lwjgl.jar:/Applications/IntelliJ IDEA 13.app/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain com.insanity.asteroids.Init
Exception in thread "main" java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovyObject
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 15 more
Process finished with exit code 1
By the looks of it the Groovy libs are not being found or something.
The problem is that I was using a symlink that pointed to /usr/local. The error was fixed by changing the classpath to use the direct path of /usr/local instead of a symlink.
tl;dr: Don't set your classpath in IntelliJ using a symlink.

Categories

Resources