Import namespace in WSDL result in JAXP09020006: The argument 'systemId' can not be null

Viewed 1012

I am reformatting the existing question that did not get any answer nor comment.

I am trying to import WSDL with Netbeans 11, using Java 11 and Maven 3.6.1. The same approach is already used for Netbeans 8 and Java 8.2 without problems, though:

  • the old system is Linux and the new system is Win10,
  • jaxws-maven-plugin 2.5 from org.codehaus.mojo is used on old system and jaxws-maven-plugin 2.3.2 from com.sun.xml.ws is used on new system

I have researched the problem down to import namespace part of my WSDL.

Here is the problematic WSDL, I have removed all features and removed references to company names:

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://XYZ/DTROrchestrator" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="DTROrchestratorService" targetNamespace="http://XYZ/DTROrchestrator">
<wsdl:types>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://XYZ/datatypes/tehnicalException" targetNamespace="http://XYZ/datatypes/tehnicalException" version="1.0">
  <xs:complexType name="TechnicalExceptionInfoType">
    <xs:sequence>
      <xs:element minOccurs="0" name="ExceptionClass" type="xs:string"/>
      <xs:element minOccurs="0" name="SubCode" type="xs:string"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Description" type="xs:string"/>
      <xs:element minOccurs="0" name="StackTraceString" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://XYZ/DTROrchestrator" xmlns:ns2="http://XYZ/datatypes/tehnicalException" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://XYZ/DTROrchestrator" version="1.0">
  <xs:import namespace="http://XYZ/datatypes/tehnicalException"/>
</xs:schema>

</wsdl:types>

<wsdl:message name="TechnicalException">
    <wsdl:part element="tns:TechnicalExceptionInfo" name="TechnicalException">
    </wsdl:part>
</wsdl:message>
<wsdl:portType name="DTROrchestratorPort">
</wsdl:portType>
<wsdl:binding name="DTROrchestratorServiceSoapBinding" type="tns:DTROrchestratorPort">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
</wsdl:binding>
<wsdl:service name="DTROrchestratorService">
    <wsdl:port binding="tns:DTROrchestratorServiceSoapBinding" name="DTROrchestratorPort">
      <soap:address location="http://XYZ:9203/DTROrchestrator/2.0.0"/>
    </wsdl:port>
</wsdl:service>

This is a message from build

[DEBUG] cmd.exe /X /C ""C:\Program Files\Java\jdk-11.0.3\bin\java.exe" -Djavax.xml.accessExternalSchema=all -cp /C:/Users/Robert/.m2/repository/com/sun/xml/ws/jaxws-maven-plugin/2.3.2/jaxws-maven-plugin-2.3.2.jar org.jvnet.jax_ws_commons.jaxws.Invoker com.sun.tools.ws.wscompile.WsimportTool -pathfile C:\Users\Robert\AppData\Local\Temp\jax-ws-mvn-plugin-cp4115475835641866701.txt -keep -s C:\Users\Robert\MYAPP\MYAPP092\target\generated-sources\jaxws-wsimport -d C:\Users\Robert\MYAPP\MYAPP092\target\classes -verbose -encoding UTF-8 -extension -Xnocompile -catalog C:\Users\Robert\MYAPP\MYAPP092\src\jax-ws-catalog.xml -wsdllocation http://localhost/wsdl/DTROrchestrator.wsdl -b C:\Users\Robert\MYAPP\MYAPP092\src\jaxws\dtrorchestrator\dtrorchestrator-wsdlbindings.xml file:/C:/Users/Robert/MYAPP/MYAPP092/src/wsdl/DTROrchestrator/DTROrchestrator.wsdl"
parsing WSDL...

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.jvnet.jax_ws_commons.jaxws.Invoker.main(Invoker.java:74)
Caused by: java.lang.NullPointerException: JAXP09020006: The argument 'systemId' can not be null.
    at java.xml/javax.xml.catalog.CatalogMessages.reportNPEOnNull(CatalogMessages.java:129)
    at java.xml/javax.xml.catalog.CatalogResolverImpl.resolveEntity(CatalogResolverImpl.java:70)
    at com.sun.tools.xjc.ModelLoader$1.resolveEntity(ModelLoader.java:398)
    at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.resolveRelativeURL(NGCCRuntimeEx.java:191)
    at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.importSchema(NGCCRuntimeEx.java:256)
    at com.sun.xml.xsom.impl.parser.state.importDecl.action0(importDecl.java:56)
    at com.sun.xml.xsom.impl.parser.state.importDecl.leaveElement(importDecl.java:167)
    at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.endElement(NGCCRuntime.java:289)
    at java.xml/org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:570)
    at com.sun.tools.xjc.util.SubtreeCutter.endElement(SubtreeCutter.java:82)
    at java.xml/org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:570)
    at java.xml/org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:570)
    at com.sun.tools.xjc.reader.xmlschema.parser.CustomizationContextChecker.endElement(CustomizationContextChecker.java:169)
    at java.xml/org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:570)
    at com.sun.tools.xjc.reader.internalizer.DOMForestScanner$LocationResolver.endElement(DOMForestScanner.java:110)
    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:225)
    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:251)
    at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:220)
    at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:97)
    at com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:62)
    at com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:70)
    at com.sun.tools.xjc.reader.internalizer.DOMForestParser.parse(DOMForestParser.java:74)
    at com.sun.tools.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:210)
    at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:351)
    at com.sun.xml.xsom.impl.parser.ParserContext.parse(ParserContext.java:98)
    at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:141)
    at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:130)
    at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:475)
    at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:239)
    at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:65)
    at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:112)
    at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2268)
    at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:168)
    at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:111)
    at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:414)
    at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:175)
    at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:153)
    ... 5 more

If line with xs:import namespace="..." is removed then there is no error (only warning about the empty WSDL that is due to removal of all features).

EDIT: If complexType is moved into an external xsd, then there is also no error!

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://XYZ/DTROrchestrator" xmlns:ns2="http://XYZ/datatypes/tehnicalException" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://XYZ/DTROrchestrator" version="1.0">
  <xs:import namespace="http://XYZ/datatypes/tehnicalException" schemaLocation="tehnicalexception.xsd"/>
</xs:schema>

But this solution give me unsolved problems with bindings and thus I am still looking for solution with embedded XSD. Please, answer I you have any idea.

1 Answers

I have some info. Now I know, that the problem started when I set maven to use Java 11. This was the critical difference between the old and new system.

Further, I have resolved the problem by removing the whole <dependencies> and <configuration> part from the jaxws-maven-plugin description. These parts were added long ago and they were obviously not correct, anymore.

Thus, now I have only this:

<plugin>
    <!-- Maven plugin for JAX-WS RI -->
    <!-- https://mvnrepository.com/artifact/com.sun.xml.ws/jaxws-maven-plugin -->
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>2.3.3</version>
    <!-- <dependencies> ... </dependencies> REMOVED -->
    <!-- <configuration> ... </configuration> REMOVED -->
    <executions>
    ...
    </executions>
</plugin>

EDIT: I forget to mention, that I changed maven-shade-plugin to maven-assembly-plugin. Using the first one I still get error (though a different one).

BTW: To be able to compile my SOAP client with Java 11 is a long story, this was not the only problem. Finally, I have everything working.

Related