NamingException
NamingException

Reputation: 2404

JAXWS in Websphere

I wrote a simple Webservice as below in Netbeans.

@WebService()
public class CRSEncryptString {

/**
 * Web service operation
 */
@WebMethod(operationName = "encryptString")
public String encryptString(@WebParam(name = "plainText")
String plainText) {
    System.out.println("************* ");
    String cipher = plainText;
    System.out.println("***************************");
    return cipher;
}

}

Added jars with are related to JAX-WS like: activation.jar,FastInfoset.jar,http.jar,jaxb jars, jaxws jars, saaj jars, etc

Its working fine in Tomcat and Weblogic.

But, while running in Websphere 6.1 its giving error.

Following is serverlog:

[2/17/12 17:22:53:421 IST] 0000003c AdminHelper   A   ADMN1009I: An attempt is made to start the JAXWS-Test1_war application.
[2/17/12 17:22:54:390 IST] 0000003c ApplicationMg A   WSVR0200I: Starting application: JAXWS-Test1_war
[2/17/12 17:22:54:452 IST] 0000003c ApplicationMg A   WSVR0204I: Application: JAXWS-Test1_war  Application build level: Unknown
[2/17/12 17:22:54:624 IST] 0000003c WebGroup      A   SRVE0169I: Loading Web Module: JAXWS-Test1.war.
[2/17/12 17:22:54:936 IST] 0000003c http          I   WSSERVLET12: JAX-WS context listener initializing

[2/17/12 17:22:55:264 IST] 0000003c http          E   WSSERVLET11: failed to parse runtime descriptor: java.lang.LinkageError: You are loading old SAAJ from jar:file:/E:/Program%20Files/Websphere6_1/lib/j2ee.jar!/javax/xml/soap/MessageFactory.class
                             java.lang.LinkageError: You are loading old SAAJ from jar:file:/E:/Program%20Files/Websphere6_1/lib/j2ee.jar!/javax/xml/soap/MessageFactory.class
    at com.sun.xml.ws.api.SOAPVersion.<init>(SOAPVersion.java:184)
    at com.sun.xml.ws.api.SOAPVersion.<clinit>(SOAPVersion.java:83)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:177)
    at com.sun.xml.ws.api.BindingID.<clinit>(BindingID.java:318)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:177)
    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)
    at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:605)
    at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:265)
    at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:271)
    at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:88)
    at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:157)
    at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:653)
    at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:606)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:333)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:549)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1295)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1129)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:567)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:814)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:948)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl$1.run(ApplicationMgrImpl.java:1478)
    at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:3731)
    at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:3813)
    at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:245)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1483)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:615)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:62)
    at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:615)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:265)
    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1089)
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:971)
    at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:231)
    at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:238)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:833)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:802)
    at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1055)
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
    at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:948)
    at com.ibm.ws.management.application.AppManagementImpl._startApplication(AppManagementImpl.java:1285)
    at com.ibm.ws.management.application.AppManagementImpl.startApplication(AppManagementImpl.java:1184)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:615)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:62)
    at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:615)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:265)
    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1089)
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:971)
    at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:231)
    at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:238)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:833)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:802)
    at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1055)
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
    at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:948)
    at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:139)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:615)
    at com.ibm.ws.management.connector.soap.SOAPConnector.invoke(SOAPConnector.java:338)
    at com.ibm.ws.management.connector.soap.SOAPConnector.service(SOAPConnector.java:206)
    at com.ibm.ws.management.connector.soap.SOAPConnection.handleRequest(SOAPConnection.java:55)
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:680)
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:484)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)
Caused by: java.lang.NoSuchMethodError: javax/xml/soap/MessageFactory.newInstance(Ljava/lang/String;)Ljavax/xml/soap/MessageFactory;
    at com.sun.xml.ws.api.SOAPVersion.<init>(SOAPVersion.java:178)
    ... 78 more

[2/17/12 17:22:55:467 IST] 0000003c WebApp        E   WSSERVLET11: failed to parse runtime descriptor: java.lang.LinkageError: You are loading old SAAJ from jar:file:/E:/Program%20Files/Websphere6_1/lib/j2ee.jar!/javax/xml/soap/MessageFactory.class
 [2/17/12 17:22:55:514 IST] 0000003c ServletWrappe I   SRVE0242I: [JAXWS-Test1_war] [/JAXWS-Test1] [CRSEncryptString]: Initialization successful.
[2/17/12 17:22:55:530 IST] 0000003c VirtualHost   I   SRVE0250I: Web Module <null> has been bound to default_host[*:9080,*:80,*:9443,*:5060,*:5061,*:443].
[2/17/12 17:22:55:561 IST] 0000003c ApplicationMg A   WSVR0221I: Application started: JAXWS-Test1_war
[2/17/12 17:23:05:714 IST] 00000048 ServletWrappe I   SRVE0242I: [JAXWS-Test1_war] [/JAXWS-Test1] [/index.jsp]: Initialization successful.

Please suggest me further.

Thanks in advance..........

Upvotes: 2

Views: 9929

Answers (4)

Robert H&#246;glund
Robert H&#246;glund

Reputation: 979

It is risky to change the classloader order in Websphere since you are loading custom implementations which may not be supported by Websphere and you may get runtime errors like LinkageErrors and ClassCastException etc. since different implementations coexists in the same Java process. The best way is to use the IBM supported Jax-WS programming model. Alternatively you can use a custom webservice engine by disabling IBM´s

-Dcom.ibm.websphere.webservices.DisableIBMJAXWSEngine=true

Upvotes: 0

NamingException
NamingException

Reputation: 2404

I solved the problem by changing the classloader policy of the Websphere through admin console, i.e, from Parent_first to Parent_last policy....

Upvotes: 2

Carlos Gavidia-Calderon
Carlos Gavidia-Calderon

Reputation: 7253

If you are using RAD, you should add the Websphere Application Server runtime to your Project Build Path, instead of adding external jars.

Upvotes: 0

Doug Breaux
Doug Breaux

Reputation: 5105

In general, I think you're going to have difficulty with JAX-WS under WebSphere if you're not using WebSphere's own implementation. So you'll want to not deploy any extra jars but instead use the ones that are already in WebSphere 7.

Upvotes: 0

Related Questions