This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes NoClassDefError twist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDefError twist" Watch "NoClassDefError twist" New topic
Author

NoClassDefError twist

Chris Michaels
Greenhorn

Joined: Nov 01, 2004
Posts: 2
I know I have to be missing the obvious here but can't seem to put my finger on it. I have an application that uses the castor jar from the castor folks. It works perfectly on the development system. When I place all the jars and executable code on any other system, I get:

I have checked the classpath and the jar containing the MappingException class is definitely in the classpath. I have also put it in the system path - grasping at straws. I have run this with the -classpath switch pointing to the current directory where all the code resides. All generate the same error.

What am I missing here?
[ November 01, 2004: Message edited by: Monkey Boy ]
Paul Santa Maria
Ranch Hand

Joined: Feb 24, 2004
Posts: 236
A couple of suggestions:
1. Definitely try "java -verbose -cp ..." from the command line. This might point you directly to the underlying problem.

2. Explicitly specify your classpath ("java -cp ..."), and include your Castor jar file itself in the classpath.

3. You might also try posting to the Castor discussion group (if you haven't already).

'Hope that helps .. PSM


Paul M. Santa Maria, SCJP
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Monkey Boy,

Welcome to JavaRanch! Please adjust your display name to meet the JavaRanch Naming Policy.
You can change it here.

Thanks!


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
What does your classpath look like? It needs to contain a reference to the jar and not just the directory containing the jar.

Since I have never used Castor, do you just reference it, or do you actually run it as an app (e.g. java -jar castor.jar)?

Putting the jar in your system path will not help.
[ November 01, 2004: Message edited by: Marilyn de Queiroz ]
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Well...

Can we try setting the classpath to the current location?

like set classpath=%classpath%;. - with a dot at the end.

any comments?

Cheers,
Swamy
Chris Michaels
Greenhorn

Joined: Nov 01, 2004
Posts: 2
Thanks for all the help! I updated my profile.

Ramaswamy, I did have my classpath setup as you suggest - no luck there. Tried all of Pauls suggestions as well, still no luck.

One thing I did find in these forums was a reference to using the .class extension from the command line -- not allowed and caused a similar error as the one I have. I am not doing that but I did setup the jar file to run a specific class by default so I could use the -jar switch (java -jar myJar) instead of having it be the 'standard' command (java com.xxx.yyy.zzz.myClass). It made the command line a little cleaner and easier to use. That thread made me think this was a problem so I tried it with the longer 'standard' command and the application ran perfectly.

While this works on the development system, it fails on all other systems. Any ideas as to why that is?

[ November 02, 2004: Message edited by: Chris Michaels ]
[ November 02, 2004: Message edited by: Chris Michaels ]
 
wood burning stoves
 
subject: NoClassDefError twist
 
Similar Threads
MappingException
MappingException class is not there in hibernate-tools.jar
.MappingException
MappingException
MappingException occured