I'm fairly convinced that the problem has to do with a classloading
conflict between Tomcat (6.0.16), JDK 1.5, and some CXF dependency
class. This is the first time I've tried to add a SOAP Client to this
web-app.
Note in particular
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
subsection "XML Parsers and JSE 5".
JDK 1.5 supports a mechanism called the "Endorsed Standards Override
Mechanism" to allow replacement of APIs created outside of the JCP
(i.e. DOM and SAX from W3C). It can also be used to update the XML
parser implementation. For more information, see:
http://java.sun.com/j2se/1.5/docs/guide/standards/index.html.
Tomcat utilizes this mechanism by including the system property
setting |-Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS| in the command line
that starts the container.
However, I'm uncertain how to proceed on the basis of this knowledge.
Has anyone on this list experienced this type of problem?
Steve Cohen wrote:
I have developed a Client for accessing a vendor's Web Service. The
client is based on the CXF framework, built with source code generated
from a Maven-based pom.xml and the vendor's WSDL.
I ran this client in a standalone JUnit test and found it to work.
Being a curmudgeon who doesn't believe in including every jar under
the sun and who likes to know why I'm including what I am including, I
removed 14 of the 47 jars that Maven told me to include, but which
seemed irrelevant to me, and it still ran.
The ultimate destination of this component is inside a web-app running
under Tomcat 6.0. When I put my component and the 33 necessary jars
into WEB-INF/lib I got NoClassDefFoundErrors. These errors are
singularly uninformative, all I know is that the class supposedly not
found is my client class, however, given the following code:
MyClient myclient1 = null;
MyClient myclient2 = new MyClient();
the error occurs on the second line and not the first. Therefore I
conclude that the NoClassDefFoundError refers to a dependency, and not
to MyClient itself. The NoClassDefFoundError itself is singularly
uninformative - the getCause() member, for example, returns null. I
need more information and can't figure out where to find it.
I have since tried putting back all the fourteen other jars that Maven
insisted I include and THIS DID NOT HELP. I am beginning to think the
problem is not a missing class but a class conflicting with something
in Tomcat.
How the HELL do I debug this, given the miserable lack of information
in a NoClassDefFoundError?
I have tried putting a
-verbose
switch on the jvm command line that launches Tomcat, and while this
does emit a slew more information, it still doesn't tell me what I need.