I’m strugelling with an odd problem for days now.
Only one of the users of my webapp get an NoClassDefFoundError when trying to use some functionallity. This is the stacktrace:
java.lang.NoClassDefFoundError: com/sun/xml/bind/WhiteSpaceProcessor
at com.sun.xml.bind.DatatypeConverterImpl._parseInt(DatatypeConverterImpl.java:105)
at com.foo.bar.webservice.generated.GetLoginsRequest_JaxbXducedAccessor_panelId.parse(TransducedAccessor_field_Integer.java:32)
at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:166)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:406)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:384)
at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:35)
at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:101)
at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:224)
at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:107)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:289)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:272)
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:106)
at org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshal(Jaxb2Marshaller.java:424)
On a strange way WhiteSpaceProcessor can’t be found while it is on the classpath.
I used tattletale to look at the possitions of the usage of the classes:
WhiteSpaceProcessor only exist once on the classpath:

DatatypeConverterImpl only exist once on the classpath

I’m stuck on the fact that the exact war on a different environment is working perfect.
working environment:
- Windows machine
- Tomcat 5.5.28
- Java 5 (jdk1.5.0.22)
none working environment:
- Linux machine
- Tomcat 5.5.??
- Java 5 (jdk1.5.0.22)
I hope somebody can sent me in the right direction.
tomcat server is already restarted
Did you use tattletale on the working or non-working machine?
Perhaps the failing environment contains some jar file in jre/lib/ext (or a similar extensions directory), and that’s being used in preference to a “lower down” version?
EDIT: Just to go into a bit more detail about the situations in which
NoClassDefFoundErrorcan be thrown, it’s worth reading the JVM spec, chapter 5. It talks about three situations:UnsupportedClassVersionError.)Also read section 2.17.5: it states that if the class is in an “erroneous state” (e.g. previously initialization failed, or there was a bytecode verification failure) then
NoClassDefFoundErrorwill be thrown.Now, if the static initializer of the class fails then the first caller sees an
ExceptionInInitializerError– but the second caller seesNoClassDefFoundError. Here’s a short but complete program to demontrate this:Now unless something in your system is suppressing the
ExceptionInInitializerError, I’d expect to see that in the log beforeNoClassDefFoundErrorif that were the problem. I still think it’s more likely that your failing system is loading one class in an extension classloader which then can’t find theShiteSpaceProcessorclass.