Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Issue with java.lang.NoClassDefFoundError exception..

843789Feb 28 2010 — edited Feb 28 2010
Long story short.. I have a software that deals with user story and let users do parallel editing on those and i have to extend it (at the moment it has a client--> server structure, with the classic issue that if the server goes offline adios shared interaction so far)...
I've done my homework and planned all the remodelling i need in order to g to a semi-serverless interaction through a design pattern, turns out i'll use smack api + gtalk and transfer data via xmpp, whereas a thread will listne to gtalk's port, catch incoming//outgoing and do the proper format trasformation to let the application handles it (aka incoming packet will get a xmpp to to message format that the application use for internal update, and viceversa outgoing packet will get a transformation into xmpp)..
now my issue... i've created a stub of the thread dedicated to listen to the new specific port that will handle all the mumbo-jumbo, tested it as a stand alone and it works like a charm...
I've created this class in a package that is inside the whole project, and added to the project the required libs via import, and is correctly listed in my IDE (eclipse) in the build path for the current project
..
At the moment i launch an istance of the thread right after another thread is started (this thread is used to listen to another port, but it shouldn't be an issue, they don't meddle in the respective code in any way)..
BUT.. well i get the dreaded error

Exception in thread "Thread-5" java.lang.NoClassDefFoundError: org/jivesoftware/smack/ConnectionConfiguration
at persister.distributed.nientedafare2.listen(nientedafare2.java:83)
at persister.distributed.nientedafare2.run(nientedafare2.java:75)
Caused by: java.lang.ClassNotFoundException: org.jivesoftware.smack.ConnectionConfiguration
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 2 more

and i'm wondering how the hell i get this error, since when the class is started as a standalone it runs just fine, without signaling any issues regarding missing libs or anything, yet i get this error when i try to instantiate a thread from it inside the code of the project...
Out of sheer curiosity i tried as well to get this thread started as soon as possible, fearing that maybe this error was actually a mis-read general exception due to some sort of lock on the code implemented via the method synchronized somewhere in the project that i had missed.. So i instantiated this thread to be run as the very first thing the application does on his startup, even before loading the graphic component of the application... same error, just the exception regards now "Thread-1", same with starting the thread pretty much anywhere else...

Thinking that the noclassdeffounderror had to actually do with the xmppexception class (since that's where i first noticed the error) i commented part of the code (START BLOCK --> END BLOCK) thus when the thread is started it just limits itself to call a connection to the gtalk server and tried again and now the error is listed to org/jivesoftware/smack/ConnectionConfiguration..
So i'd assume that the problem lies with the inability to resolve the location of the libs? if so, WHY am i able to run the class as a standalone without any issues regarding the libs, yet i get this error when starting the thread from somewhere else? :|
I'm a tad confused..
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 28 2010
Added on Feb 28 2010
1 comment
2,525 views