user3152748
user3152748

Reputation:

java.lang.NoClassDefFoundError Exception in java

I am generating java classes from xsd using JAXB 1.0 (JDK 1.5 and Java Web Service Developer Pack 1.5). It is working fine in local. When, I tried in server, I am getting the following exception.

ErrMsg=[Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/xml/bind/unmarshaller/InterningXMLReader at 
com.impl.runtime.UnmarshallerImpl.unmarshal(Unknown Source) 
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
 at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:162) 
 at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:171) 
 at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:189) 

 Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.unmarshaller.InterningXMLReader 
 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) ... 9 more].

Any help?

Upvotes: 0

Views: 1442

Answers (2)

Suresh
Suresh

Reputation: 29

You need to add jaxb-impl.jar to your Java Build Path. If you are using Eclipse then right-click your project, go to Properties->Java Build Path, click the Add External JARs... button, and finally select jaxb-ri-20110512/lib/jaxb-impl.jar. This should automatically add jaxb-api.jar, activation.jar, jsr173_1.0_api.jar, and jaxb1-impl.jar in addition to jaxb-impl.jar. Now there shouldn't be any more problems.

Upvotes: 2

Jens
Jens

Reputation: 69440

You miss the jaxb-impl.jar in your classpath. Download and add it.

Upvotes: 0

Related Questions