Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDefError twist

 
Chris Michaels
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Monkey Boy,

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

Thanks!
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic