ServiceConstructionException when one web service connects to another web service

16,626

I experienced the same problem in multiple cases with deployment of web service to a WebLogic server with the problem being a version conflict between xerces libraries on the server classpath versus what was included with the web service instance.

In one scenario, the solution was to avoid including the xerces library with the web service application (indicated scope 'provided' for the xerces library in the maven pom, if that happens to be your engine). In the other, the solution was to use the filtering classloader feature (of weblogic) to direct the server to use the xerces library included in the application versus the server's implementation.

Based on your issue, I looked around for this functionality in jboss and located this article: http://www.mastertheboss.com/jboss-application-server/223-solving-jboss-5-classloading-issues.html

Hopefully this helps...

Share:
16,626
sap
Author by

sap

Updated on June 04, 2022

Comments

  • sap
    sap almost 2 years

    i have 2 web services, both work just fine when i test them with a client. but when i try to build the port to one web service from another web service JBOSS just explodes with several exceptions:

    Exception sending context initialized event to listener instance of class pt.ist.anacom.shared.security.SecurityInitListener: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.

    caused by

    org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.

    caused by

    javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration

    caused by:

    java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration

    so i have web service A and web service B. i deploy web service A and then on my contextlistener for web service B i add:

    org.stubs.WebServiceA_Service service = new org.stubs.WebServiceA_Service(); // EXPLODES HERE
    org.stubs.WebServiceA web = service.getWebServiceAPort(); //never runs this line, crashes before
    

    both web services are implementation first (bottom up?) meaning i define the WebService class, deploy it (JBOSS automatically generates wsdl) and then i consume it.

    when i access webserviceA from a test client it just works fine, but not when i try to access it from WebServiceB.

    i've lost a few days on this already and tried pretty much everything i could.. so any help is greatly appretiated.

  • sap
    sap almost 12 years
    thanks for the answer, i forgot to reply but that did solve my problem :)