Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError  RSS feed

 
John Davis
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Java application which compiles OK. When I run it with the java -cp path applicationName command, I get a NoClassDefFoundError.
the command is:
java -cp .;D:\MQclient\com.ibm.mq.jar bluexserver
The file D:\MQclient\com.ibm.mq.jar definitely exists. It is the same file that was referenced during the compile via the standard classpath.
The class which cannot be found is in the file D:\MQclient\com.ibm.mq.jar
This problem definitely has me stumped. Any help you can give me with this would be greatly appreciated.
Thanks in advance,
John Davis
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm...
Could you please post a copy of the error message received? I think that that will help a lot in determining the problem.
Thanks
 
John Davis
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a copy of the dos window with this error follows:
D:\BlueX>java -classpath .;D:\MQclient\com.ibm.mqbind.jar;D:\MQclient\com.ibm.m
q.jar bluexserver
Driver not Found
SQL Exception connecting to DB
Exception in thread "main" java.lang.NoClassDefFoundError: javax/resource/Resour
ceException
at at com.ibm.mq.MQEnvironment.<clinit>(MQEnvironment.java:224).nul
l(Unknown Source)
at Messaging.connect(Messaging.java:127)
at bluexserver.main(bluexserver.java:115)
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to be on the safe side, do a jar -tf D:\MQclient\com.ibm.mq.jar > mqjarfiles.txt and double check to make sure that javax.resource.ResourceException is in there.
If its not (and 99% odds are that it isn't), make sure that the j2ee.jar file is in your runtime CLASSPATH, as this is the .jar file that does contain the javax.resource package.
 
John Davis
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joel,
Thanks so much for your last post! It undoubtedly contains information that will allow me to solve this problem. I had not realized that the class not being found was not actually in the jar file I had specified.
JD
 
John Davis
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joel,
I have searched for a .jar file which is the j2ee.jar file you alluded to in your last post. I looked through the entire directory structure associated with my install at j2sdk1.4.1_02. No such .jar file is apparently in this structure. Do you know whats going on here? Sorry to bother you again, but this problem is driving me crazy.
JD
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to download the j2sdkee; (Java 2 SDK Enterprise Edition). This is not distributed with the Standard Edition.
If your IDE compiles this, then chances are the j2ee.jar is somewhere on your machine (and the IDE is setting the compile path to include it; some IDEs have separate run and compile paths, so its theoretically possible that the same IDE can compile the code but not run it.)
 
John Davis
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!! I downloaded and installed j2ee and immediately found j2ee.jar, then included it in my runtime classpath. Problem solved! Kudo's to you Joel!
JD
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class you want is also in a jar file other than j2ee.jar. I had the same problem somewhile back. I think it is in the IBM MQ distribution somewhere. If I can find it tomorrow (CET) I'll post the details.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Barry Gaunt:
The class you want is also in a jar file other than j2ee.jar. I had the same problem somewhile back. I think it is in the IBM MQ distribution somewhere. If I can find it tomorrow (CET) I'll post the details.

It's in a file called connector.jar
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!