In order to communicate with som Web Services using we have developed an ear file with the stubs generated from the WSDL document provided. The ear file is then deployed on JBoss.
Though the unit tests using JUnit work perfectly fine and we are able to get the desired data, when accessed from the application server(JBoss), we get the following exception:-
NoClassDefFoundError: com/sun/xml/rpc/client/BasicService
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:442)
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bloombergWSLiteGateway' defined in URL [jar:file:/C:/jboss-4.2.0.GA/server/default/tmp/deploy/tmp36655webServices.ear-contents/webServicesJar.jar!/wsSpring-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.ccminvest.bb.gateway.BloombergWSLiteGateway]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/xml/rpc/client/BasicService
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:442)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:264)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:642)
com.ccminvest.bb.standalone.SpringBeanFactory.getBean(SpringBeanFactory.java:52)
com.ccminvest.bb.handler.WebServicesActionHandler.<init>(WebServicesActionHandler.java:28)
com.ccminvest.bb.web.servlets.WebServicesControllerServlet.doGet(WebServicesControllerServlet.java:64)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
Now on further investigation it was found that there was some conflict in the jar files so the following steps would fix the error:-
Remove the following jar files to JBOSS/jboss_client
1) jbossall-client.jar
2) jbossws14-client.jar
3) jboss-jaxrpc.jar
4) jboss-saaj.jar
Remove add the following jar files to JBOSS/server/default/lib
1) jboss-jaxrpc.jar
2) jboss-saaj.jar
Add the following jar files from JBOSS/server/default/lib
1) jaxrpc-spi.jar
2) jaxrpc.jar
3) jaxrpc-impl.jar
4) com.efaxdeveloper.util.jar
5) jaas.jar
6) axis-1.2.jar
7) axis-saaj-1.2.jar
8) saaj-api.jar
9) saaj-impl.jar
But these modifications cause some other applications running on the app server to fail. Please note that there is not PARENT_FIRST or PARENT_LAST configuration for the JBOSS Classloader, and that the JBoss Classloader works slightly differently from the other AppServer classloaders.
I have also tried to modify the manifest.mf file of the jar to force it to use the specified classpath in the manifest file but it aint helping. Probably the JBoss classloader by default loads the parent classloaders first.
Any advice or help would be great!!!!
Edited by: kilyas on Feb 15, 2010 2:15 PM