JBoss 5.1: deploying a webservice in the web configuration
laurens Apr 1, 2010 11:03 AMDear all,
I've been asked to deploy a java program (with a JAX-WS webservice) on JBoss and I'm running into some problems because of some restrictions placed upon this deployment.
- I cannot alter the java code, just the configuration (*.xml and *.jar in the webapp directory tree) and deployment parameters.
- I must use the JBoss 5.1 web configuration. Also, the application should run under an arbitrary Application server or indeed even under tomcat and jetty in principle.
The application was originally build to run under glassfish 2.1 and deploying it under JBoss web configuration yielded an almost working application (except 'ofcourse' the webservice). Since then I've added jaxws-rt 2.1.3 to my pom.xml with effectively added most webservice-related libraries I needed to my /WEB-INF/lib directory in my .war.
code:
Also I had to include a jboss-classloading.xml to my war-file because of some issues I had with jaxp.
<?xml version="1.0" encoding="UTF-8"?>
<classloading xmlns="urn:jboss:classloading:1.0" name="myApplication"
domain="myApplication" import-all="false">
</classloading>
Now the deployment works fine under jetty. It works fine under JBoss 5.1 default configuration and it even works fine when I use the web-configuration but do not use the -Djava.endorsed.dirs parameter. However when I use the web-configuration with the endorsed dirs, I get the following stacktrace:
Caused by: java.lang.ExceptionInInitializerError
at com.sun.xml.ws.api.BindingID.<clinit>(BindingID.java:318) at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.createBinding(DeploymentDescriptorParser.java:302) at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:243) at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147) at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:108) ... 69 more Caused by: java.lang.IllegalStateException: Failed to load javax.xml.soap.MetaFactory: org.jboss.ws.core.soap.SAAJMetaFactoryImpl at javax.xml.soap.SAAJFactoryLoader.loadFactory(SAAJFactoryLoader.java:128) at javax.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:58) at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:105) at com.sun.xml.ws.api.SOAPVersion.<init>(SOAPVersion.java:178) at com.sun.xml.ws.api.SOAPVersion.<clinit>(SOAPVersion.java:83) ... 74 more Caused by: java.lang.ClassNotFoundException: org.jboss.ws.core.soap.SAAJMetaFactoryImpl at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at javax.xml.soap.SAAJFactoryLoader.loadFactory(SAAJFactoryLoader.java:122) ... 78 more
As you can see, the application, guided by the lib/endorsed/jbossws-native-saaj.jar - /META-INF/services/javax.xml.soap.MetaFactory file, tries to load the 'org.jboss.ws.core.soap.SAAJMetaFactoryImpl' implementation of the javax.xml.soap.MetaFactory, but it cannot find this class (presumably because it is not available in the web configuration.
Now I have the following questions:
- How do the libs in lib/endorsed behave with respect to classloading and Where can I find more information
- How hard should I try to convince my sysadmin to use the default jboss configuration
- Assuming I should be able to run a jax-ws webservice in the web configuration without altering the default start-up parameters, how do I do that?
Thanks you all for your time,
Kind Regards, Laurens Winkelhagen.