I have been trying to execute mvn jaxws:wsimport by using the Maven JAX-WS Plugin:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>${maven.jaxws.plugin}</version>
    <executions>
        <execution>
            <goals>
                <goal>wsimport</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <sourceDestDir>generated-sources/jaxws-wsimport</sourceDestDir>
        <xnocompile>true</xnocompile>
        <verbose>true</verbose>
        <extension>true</extension>
        <sei>/</sei>
        <wsdlFiles>
            <wsdlFile>${basedir}/src/main/resources/wsdl/movieservice.wsdl</wsdlFile>
        </wsdlFiles>
    </configuration>
</plugin>

But I am getting the following error:

Caused by: java.lang.AssertionError: org.xml.sax.SAXParseException;
systemId: jar:file:/Users/mickknutson/.m2/repository/com/sun/xml/bind/jaxb-xjc/2.2.8-b01/jaxb-xjc-2.2.8-b01.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; 
lineNumber: 52; columnNumber: 88; 
schema_reference: Failed to read schema document 'xjc.xsd', 
because 'file' access is not allowed due to restriction set by the accessExternalSchema property.

Here is the full the error I am getting:

[INFO] jaxws:wsimport args: [-keep, -s, '/Users/mickknutson/Documents/workspace/JavaEEExamples/jax-ws-demo-client/target/generated-sources/wsimport', -d, '/Users/mickknutson/Documents/workspace/JavaEEExamples/jax-ws-demo-client/target/classes', -encoding, UTF-8, -Xnocompile, -p, trivera.ws.service, "file:/Users/mickknutson/Documents/workspace/JavaEEExamples/jax-ws-demo-client/src/main/resources/wsdl/movieservice.wsdl"]
Picked up _JAVA_OPTIONS: -Xms256m -Xmx2048m
parsing WSDL...


[WARNING] schema_reference: Failed to read schema document 'movieservice?xsd=1', because 'http' access is not allowed due to restriction set by the accessExternalSchema property. 
  line 4 of file:/Users/mickknutson/Documents/workspace/JavaEEExamples/jax-ws-demo-client/src/main/resources/wsdl/movieservice.wsdl#types?schema1

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.mojo.jaxws.Invoker.main(Invoker.java:78)
Caused by: java.lang.AssertionError: org.xml.sax.SAXParseException; systemId: jar:file:/Users/mickknutson/.m2/repository/com/sun/xml/bind/jaxb-xjc/2.2.8-b01/jaxb-xjc-2.2.8-b01.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: Failed to read schema document 'xjc.xsd', because 'file' access is not allowed due to restriction set by the accessExternalSchema property. 
	at com.sun.tools.xjc.SchemaCache.newValidator(SchemaCache.java:80)
	at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet.apply(SCDBasedBindingSet.java:237)
	at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:541)
	at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:269)
	at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:95)
	at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:142)
	at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2298)
	at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:198)
	at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:141)
	at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:444)
	at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:205)
	at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:183)
	... 5 more
Caused by: org.xml.sax.SAXParseException; systemId: jar:file:/Users/mickknutson/.m2/repository/com/sun/xml/bind/jaxb-xjc/2.2.8-b01/jaxb-xjc-2.2.8-b01.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: Failed to read schema document 'xjc.xsd', because 'file' access is not allowed due to restriction set by the accessExternalSchema property. 
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
	at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4158)
	at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaFatalError(XSDHandler.java:4137)
	at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2164)
	at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.resolveSchema(XSDHandler.java:2074)
	at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:1004)
	at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:616)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:613)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:572)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:538)
	at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:255)
	at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:638)
	at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:670)
	at com.sun.tools.xjc.SchemaCache.newValidator(SchemaCache.java:77)
	... 16 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.956s
[INFO] Finished at: Tue Aug 09 16:21:20 EDT 2016
[INFO] Final Memory: 15M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:jaxws-maven-plugin:2.4.1:wsimport (default-cli) on project jax-ws-demo-client: Invocation of com.sun.tools.ws.wscompile.WsimportTool failed - check output -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Process finished with exit code 1

There have been plenty of talks about a resolution:
http://stackoverflow.com/questions/23011547/webservice-client-generation-error-with-jdk8

Here is how I had solved the issue to add -Djavax.xml.accessExternalSchema=all as a system property

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>${maven.jaxws.plugin}</version>
    <executions>
        <execution>
            <goals>
                <goal>wsimport</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <packageName>trivera.ws.service</packageName>
        <vmArgs>
            <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
        </vmArgs>

        <sourceDestDir>generated-sources/jaxws-wsimport</sourceDestDir>
        <xnocompile>true</xnocompile>
        <verbose>true</verbose>
        <extension>true</extension>
        <sei>/</sei>

        <wsdlFiles>
            <wsdlFile>${basedir}/src/main/resources/wsdl/movieservice.wsdl</wsdlFile>
        </wsdlFiles>

    </configuration>
</plugin>

Summary

Success!

[INFO] Processing: http://localhost:8888/movieservice?WSDL
[INFO] jaxws:wsimport args: [-keep, -s, '/Users/mickknutson/Documents/workspace/JavaEEExamples/jax-ws-demo-client/target/generated-sources/jaxws-wsimport', -d, '/Users/mickknutson/Documents/workspace/JavaEEExamples/jax-ws-demo-client/target/classes', -verbose, -encoding, UTF-8, -extension, -Xnocompile, -p, trivera.ws.service, "http://localhost:8888/movieservice?WSDL"]
Picked up _JAVA_OPTIONS: -Xms256m -Xmx2048m
parsing WSDL...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

Mick Knutson

Java, JavaEE, J2EE, WebLogic, WebSphere, JBoss, Tomcat, Oracle, Spring, Maven, Architecture, Design, Mentoring, Instructor and Agile Consulting. http://www.baselogic.com/blog/resume

View all posts

Java / JavaEE / Spring Boot Channel

BLiNC Supporters

BLiNC Adsense

Archives

Newsletter