Problem:
The OXF/Struts example shipped with OXF 1.5.1 does not work on JBoss 3.0.6 + Tomcat 4.1.18. The following exception is thrown:
java.lang.NoSuchMethodError:
org.exolab.castor.xml.Marshaller.(Lorg/xml/sax/ContentHandler;)VSolution:
This error comes from a class conflict between the castor.jar (the bean marshaller) we are shipping with OXF and an older one bundled in JBoss.
JBoss, per default, follows the Java 2 delegation model, which specifies that classes from the webapp have a lower priority than the system classes. This is contrary to the Servlet 2.3 specification (section 9.7.2) which says the webapp classes should be loaded first (with the exception of the J2SE classes).
Fortunately, there is a way to change that behavior. Edit the server/default/deploy/tomcat41-service.xml file in your JBoss directory. Under the <mbean> element, add a new <attribute> :
<attribute name="Java2ClassLoadingCompliance">false</attribute>
If the modification is successful, you should see a line like the following next time you start JBoss:
12:24:00,072 INFO [EmbeddedCatalinaService41] Using Java2 parent classloader delegation: false
Julien
