0 Replies Latest reply on Apr 23, 2013 4:40 AM by ripla

    UnknownHostException when using WSDL catalog

    ripla

      Hi.

       

      I'm having an issue (in production) with JBoss 7.1 and JBossWS 4.1.1. Background: I have multiple JAR-projects and one WAR-project which has the JAR-projects as dependencies. One of the JAR-projects contains integrations to web-services. The clients are generated by wsconsume with a catalog parameter src/jax-ws-catalog.xml and wsdllocation of http://mycompany/*. Then in the generated clients are created with a constructor that takes the wsdl location URL as a parameter, e.g. new MyService(new URL("http://mycompany/MyService.wsdl")). And of course the jax-ws-catalog.xml contains mappings from http://mycompany/MyService.wsdl to wsdl/MyService.wsdl. The JAR from the integration project contains the catalog in META-INF and the wsdl-files in META-INF/wsdl

       

      The tests in the integration project work fine. The whole web-application in developer testing works fine. But, sometimes, mostly after deployments, and in production we get:

       

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

              at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:94)

              at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)

              at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)

              ... 47 more

      Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing 'http://mycompany/MyService.wsdl'.: java.net.UnknownHostException: mycompany

              at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)

              at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)

              at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)

              at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:249)

              at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:192)

              at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:92)

              ... 49 more

      Caused by: java.net.UnknownHostException: mycompany

              at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195)

              at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

              at java.net.Socket.connect(Socket.java:529)

              at java.net.Socket.connect(Socket.java:478)

              at sun.net.NetworkClient.doConnect(NetworkClient.java:163)

              at sun.net.www.http.HttpClient.openServer(HttpClient.java:395)

              at sun.net.www.http.HttpClient.openServer(HttpClient.java:530)

              at sun.net.www.http.HttpClient.<init>(HttpClient.java:234)

              at sun.net.www.http.HttpClient.New(HttpClient.java:307)

              at sun.net.www.http.HttpClient.New(HttpClient.java:324)

              at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970)

              at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)

              at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)

              at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1172)

              at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:986)

              at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:143)

              at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:802)

              at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)

              at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)

              at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:230)

              at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:285)

       

      The web-services always work after server restart, but I'm still worried as I have no idea what is causing this. Any tips? Anything I could add in terms of logging to better understand the problem?

       

      EDIT: I've been digging around in WSDLManagerImpl where apparently the URI resolution is performed. Haven't found anything yet, but I thought of one detail which might be significant: we run all the WS calls in separate threads.

       

      EDIT2: I've now discovered some points where something wrong. It think the error happens during re-deployment. When I look at the OASISCatalogManager I see it has two catalogs loaded:

       

      jar:file:/path/to/jboss/modules/org/jboss/ws/jaxws-client/main/jbossws-cxf-client.jar!/META-INF/jax-ws-catalog.xml

      vfs:/content/MyWebProject.war/WEB-INF/lib/integration_project-1.2.3.jar/META-INF/jax-ws-catalog.xml

       

      The problem seems to occur when the catalog loaded is from an older version of the integration project, e.g.


      vfs:/content/MyWebProject.war/WEB-INF/lib/integration_project-1.2.2.jar/META-INF/jax-ws-catalog.xml

       

      I'm not sure if the bus used is somehow involved, since the line

       

      OASISCatalogManager catalog = bus.getExtension(OASISCatalogManager.class);

       

      Is how the catalog gets loaded in the first place. The exception above occurs when the CatalogWSDLLocator.getBaseInputSource() returns null, as the catalog is unable to resolve the fake URL.

       

      Right now I'm looking into how I could clean up the temp when redeploying, since the older versions of JARs are still present there.