1 Reply Latest reply on Jan 9, 2014 2:19 PM by diarun

    JBossEntityResolver resolves a HTTP URL to a classpath resource for a import URL within a WSDL file

    diarun

      Problem Environment JBoss 5.1.0 GA application server with 64bit jdk1.7.0_03 on a 64 bit CentOS release 6.4

       

      I have been facing a strange problem.I have explained the problem in detail below.

      Did anyone else came across similar problems or know how to debug further ?

       

      I have a wsdl file which imports another wsdl file by specifying the import path in the form of a URL.

      e.g.

      <wsdl:definitions name="Service" targetNamespace=".."  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">    ..

          <wsdl:import namespace=".." location="http://somehost:8797/?wsdl=wsdl0"

       

      I have generated JAXWS web service proxy Java classes and when a web application deployed in JBoss container makes a web service call, I get the following exception during Service Initialization

       

      org.jboss.ws.metadata.wsdl.WSDLException: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing 'http://somehost:8797/?wsdl=wsdl0'.: org.xml.sax.SAXParseException: Premature end of file.

      com.sunup.amps.wfh.workflow.components.transcode.vantage.VantageAdapterException: org.jboss.ws.metadata.wsdl.WSDLException: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing 'http://somehost:8797/?wsdl=wsdl0'.: org.xml.sax.SAXParseException: Premature end of file.

               ....

              at org.jbpm.pvm.internal.wire.usercode.UserCodeEventListener.notify(UserCodeEventListener.java:39)

      Caused by: org.jboss.ws.metadata.wsdl.WSDLException: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing 'http://somehost:8676/?wsdl=wsdl0'.: org.xml.sax.SAXParseException: Premature end of file.

              at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:155)

              at org.jboss.ws.metadata.umdm.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:293)

              at org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder.buildMetaData(JAXWSClientMetaDataBuilder.java:84)

              at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:138)

              at org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:63)

              at javax.xml.ws.Service.<init>(Service.java:79)

      Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing 'http://somehost:8676/?wsdl=wsdl0'.: org.xml.sax.SAXParseException: Premature end of file.

              at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.getDocument(JBossWSDLReaderImpl.java:2138)

              at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.parseImport(JBossWSDLReaderImpl.java:445)

              at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.parseDefinitions(JBossWSDLReaderImpl.java:322)

              at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.readWSDL(JBossWSDLReaderImpl.java:2292)

              at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.readWSDL(JBossWSDLReaderImpl.java:2256)

              at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.readWSDL(JBossWSDLReaderImpl.java:2309)

              at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.readWSDL(JBossWSDLReaderImpl.java:2330)

              at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.readWSDL(JBossWSDLReaderImpl.java:2362)

              at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:128)

              ... 255 more

      Caused by: org.xml.sax.SAXParseException; Premature end of file.

              at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)

              at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)

              at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.getDocument(JBossWSDLReaderImpl.java:2128)

       

       

      My Findings.

        I ran the application in debug mode as well as enabled trace log on JBoss server and narrowed the root cause to org.jboss.util.xml,JBossEntityResolver class. From the JBoss logs it is pretty evident that it somehow resolves a http URL to a resource in class path and returns a invalid InputSource object which caused the parsing error. Please note that the same piece of code works on a standalone JVM when JDK native JAXWS client libraries are used.

       

      Trace Log excerpt

       

      The log message Mapped systemId to filename:appears only the method which resolves a resource from Classpath within JBossEntityResolver class.

       

      2014-01-06 12:30:45,775 TRACE [org.jboss.util.xml.JBossEntityResolver] (http-0.0.0.0-8080-2) resolvePublicID, publicId=http://somehost:8797/?wsdl=wsdl0

      2014-01-06 12:30:45,775 TRACE [org.jboss.util.xml.JBossEntityResolver] (http-0.0.0.0-8080-2) resolveSystemID, systemId=http://somehost:8797/?wsdl=wsdl0

      2014-01-06 12:30:45,775 TRACE [org.jboss.util.xml.JBossEntityResolver] (http-0.0.0.0-8080-2) resolveClasspathName, systemId=http://somehost:8797/?wsdl=wsdl0

      2014-01-06 12:30:45,775 TRACE [org.jboss.util.xml.JBossEntityResolver] (http-0.0.0.0-8080-2) Mapped systemId to filename:

      2014-01-06 12:30:45,775 TRACE [org.jboss.classloader.spi.base.BaseClassLoader] (http-0.0.0.0-8080-2) BaseClassLoader@5793af13{vfszip:/opt/videoflow/cwm/jboss/server/amps214/deploy/amps214-ear.ear/} getResource  domain=ClassLoaderDomain@420cd195{seam.jboss.org:loader=amps214-ear.ear}

      2014-01-06 12:30:45,775 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] (http-0.0.0.0-8080-2) ClassLoaderDomain@420cd195{seam.jboss.org:loader=amps214-ear.ear} trying to get resource  from requesting BaseClassLoader@5793af13{vfszip:/opt/videoflow/cwm/jboss/server/amps214/deploy/amps214-ear.ear/}

      2014-01-06 12:30:45,775 TRACE [org.jboss.classloader.spi.base.BaseClassLoader] (http-0.0.0.0-8080-2) BaseClassLoader@5793af13{vfszip:/opt/videoflow/cwm/jboss/server/amps214/deploy/amps214-ear.ear/} get resource locally

      2014-01-06 12:30:45,775 TRACE [org.jboss.classloader.spi.base.BaseClassLoader] (http-0.0.0.0-8080-2) BaseClassLoader@5793af13{vfszip:/opt/videoflow/cwm/jboss/server/amps214/deploy/amps214-ear.ear/} got resource locally

      2014-01-06 12:30:45,775 TRACE [org.jboss.classloader.spi.base.BaseClassLoaderDomain] (http-0.0.0.0-8080-2) ClassLoaderDomain@420cd195{seam.jboss.org:loader=amps214-ear.ear} got resource from requesting BaseClassLoader@5793af13{vfszip:/opt/videoflow/cwm/jboss/server/amps214/deploy/amps214-ear.ear/} vfsmemory://a20w5v-s6cyyc-hq46ixzt-1-hq46je43-2j/

      2014-01-06 12:30:45,775 TRACE [org.jboss.util.xml.JBossEntityResolver] (http-0.0.0.0-8080-2)  maps to URL: vfsmemory://a20w5v-s6cyyc-hq46ixzt-1-hq46je43-2j/