Topic
  • 6 replies
  • Latest Post - ‏2012-05-07T17:27:01Z by Pitbull_morocco
nanniwan
nanniwan
2 Posts

Pinned topic Error When Deploying CXF Web Services in WebSphere 7

‏2011-02-16T08:59:12Z |
Hi,all. I am trying to use CXF in WAS 7.0, and get following error:

2/16/11 16:39:35:500 CST 00000027 SystemOut O ERROR 2011-02-16 16:39:35.500 Thread-50 bingo.ws.ems.EMSImplline:841 - org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler incompatible with org.apache.cxf.frontend.ClientProxy
java.lang.ClassCastException: org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler incompatible with org.apache.cxf.frontend.ClientProxy
at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93) ~cxf-2.2.4.jar:2.2.4
at bingo.ws.ems.EMSImpl.getInstance(EMSImpl.java:104) classes/:na
at bingo.ws.ems.EMSImpl.syncBillFeedback_1(EMSImpl.java:786) classes/:na
at bingo.ws.ems.EMSImpl.syncBillFeedback(EMSImpl.java:757) classes/:na
at bingo.ws.ems.sync.EmsFeedbackSyncListener$1.run

Below is my code:
Test ss = new Test(wsdlURL, SERVICE_NAME);
instance = ss.getTestHttpPort();
Client cxfClient = ClientProxy.getClient(instance);
cxfClient.getOutInterceptors().add(new LoggingOutInterceptor());
cxfClient.getInInterceptors().add(new LoggingInInterceptor());

Thanks
Alex
Updated on 2012-05-07T17:27:01Z at 2012-05-07T17:27:01Z by Pitbull_morocco
  • nanniwan
    nanniwan
    2 Posts

    Re: Error When Deploying CXF Web Services in WebSphere 7

    ‏2011-02-16T09:03:34Z  
    more information, if I view the WSDL url(http://localhost:9080/new-logistic/services/EmsService?wsdl), will got following exception :

    2/16/11 16:50:05:656 CST 0000001e servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet CXFServlet in application new-logistic_war. Exception created : java.lang.NoSuchMethodError: org/apache/ws/commons/schema/XmlSchema.getSchemaDocument()Lorg/w3c/dom/Document;
    at org.apache.cxf.service.model.SchemaInfo.getElement(SchemaInfo.java:109)
    at org.apache.cxf.wsdl11.ServiceWSDLBuilder.buildTypes(ServiceWSDLBuilder.java:267)
    at org.apache.cxf.wsdl11.ServiceWSDLBuilder.build(ServiceWSDLBuilder.java:188)
    at org.apache.cxf.wsdl11.ServiceWSDLBuilder.build(ServiceWSDLBuilder.java:148)
    at org.apache.cxf.transport.http.WSDLQueryHandler.writeResponse(WSDLQueryHandler.java:146)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:156)
    at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:50)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:101)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1443)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1384)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)

    Thanks
    Alex
  • ThanmalVerma
    ThanmalVerma
    4 Posts

    Re: Error When Deploying CXF Web Services in WebSphere 7

    ‏2011-03-23T15:11:15Z  
    Hi,

    Did anyone resolve this problem? I am getting the same error while trying to get the Client thru ClientProxy.getClient(myserviceclient) so that I can than apply custome authentication etc.

    Below is the code:
    Client cl = ClientProxy.getClient(rs);
    HTTPConduit http = (HTTPConduit) cl.getConduit();

    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
    httpClientPolicy.setConnectionTimeout(120000);
    httpClientPolicy.setReceiveTimeout(120000);
    httpClientPolicy.setAllowChunking(false);
    http.setClient(httpClientPolicy);

    I get the follwoing error:
    Exception data: java.lang.ClassCastException: org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler incompatible with org.apache.cxf.frontend.ClientProxy
    at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93)

    Intrestingly the same code works fine under jUnit test. I will appreciate if anyone can shed any light on this? Is this a known issue in WAS 7? My server is WAS 7.0.0.15.
  • SystemAdmin
    SystemAdmin
    37422 Posts

    Re: Error When Deploying CXF Web Services in WebSphere 7

    ‏2011-04-07T22:02:01Z  
    Hi,

    Did anyone resolve this problem? I am getting the same error while trying to get the Client thru ClientProxy.getClient(myserviceclient) so that I can than apply custome authentication etc.

    Below is the code:
    Client cl = ClientProxy.getClient(rs);
    HTTPConduit http = (HTTPConduit) cl.getConduit();

    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
    httpClientPolicy.setConnectionTimeout(120000);
    httpClientPolicy.setReceiveTimeout(120000);
    httpClientPolicy.setAllowChunking(false);
    http.setClient(httpClientPolicy);

    I get the follwoing error:
    Exception data: java.lang.ClassCastException: org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler incompatible with org.apache.cxf.frontend.ClientProxy
    at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93)

    Intrestingly the same code works fine under jUnit test. I will appreciate if anyone can shed any light on this? Is this a known issue in WAS 7? My server is WAS 7.0.0.15.
    I have also run into this same issue using WAS 7.0.0.13 and CXF 2.2.10.

    java.lang.ClassCastException: org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler incompatible with org.apache.cxf.frontend.ClientProxy
    On WAS6.1 I was able to get around classloading issues in my app by creating shared library pointing directly to wsdl4j-1.6.2 and setting Classes loaded with application class loader first. The same exact setup on WAS7 gives the error above when trying to call a SOAP web service.
  • SystemAdmin
    SystemAdmin
    37422 Posts

    Re: Error When Deploying CXF Web Services in WebSphere 7

    ‏2012-03-01T07:53:47Z  
    I too get this same error in 7.0.0.21. Apache Felix is embedded in my web application and the webservice client is being deployed as a bundle in OSGi container with parent last class loader setup. Even when I disable axis2 by setting a global property, the error appears. Where we need to place CXF jars so that it can be loaded before default ws jars?
  • SystemAdmin
    SystemAdmin
    37422 Posts

    Re: Error When Deploying CXF Web Services in WebSphere 7

    ‏2012-04-09T07:11:02Z  
    I too get this same error in 7.0.0.21. Apache Felix is embedded in my web application and the webservice client is being deployed as a bundle in OSGi container with parent last class loader setup. Even when I disable axis2 by setting a global property, the error appears. Where we need to place CXF jars so that it can be loaded before default ws jars?
    This issue got resolved after using JaxWsProxyFactoryBean component.

    Earlier, I was using generated class (from WSDL2Java tool) for creating proxy and it was failing in Websphere AS.

    Now with JaxWsProxyFactoryBean for creating JAX-WS proxies, slight modification as given below was done to my client codebase:

    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setAddress("http://myhost:myport/MyService/MyService?wsdl");
    factory.setServiceClass(MyWebService.class);
    MyWebService port = (MyWebService) factory.create();

    //and then call ClientProxy as usual but with the object created using JaxWsProxyFactoryBean
    Client client = ClientProxy.getClient(port);
    ...
  • Pitbull_morocco
    Pitbull_morocco
    1 Post

    Re: Error When Deploying CXF Web Services in WebSphere 7

    ‏2012-05-07T17:27:01Z  
    This issue got resolved after using JaxWsProxyFactoryBean component.

    Earlier, I was using generated class (from WSDL2Java tool) for creating proxy and it was failing in Websphere AS.

    Now with JaxWsProxyFactoryBean for creating JAX-WS proxies, slight modification as given below was done to my client codebase:

    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setAddress("http://myhost:myport/MyService/MyService?wsdl");
    factory.setServiceClass(MyWebService.class);
    MyWebService port = (MyWebService) factory.create();

    //and then call ClientProxy as usual but with the object created using JaxWsProxyFactoryBean
    Client client = ClientProxy.getClient(port);
    ...
    Hi everybody (salam alikoum)

    this issue got resolved (for real) by putting the jar "XmlSchema-1.4.7.jar" into the directorie of WebSphere 7 : C:\IBMWAS7\AppServer1\java\jre\lib\ext

    Hope that i help i lot of people :)