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.URLClassLoader1ドル.run(URLClassLoader.java:366) at java.net.URLClassLoader1ドル.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?
-
If possible I would recommend using a JAXB 2 implementation. It is included in Java SE 6, but is compatible with Java SE 5.bdoughan– bdoughan2014年07月08日 10:45:31 +00:00Commented Jul 8, 2014 at 10:45
2 Answers 2
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.
-
I am asking in server not in localuser3152748– user31527482014年07月08日 11:05:27 +00:00Commented Jul 8, 2014 at 11:05
You miss the jaxb-impl.jar
in your classpath. Download and add it.