DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Ensuring Reliable Microservice Deployment With Spring Boot Build Info Maven Plugin
  • Test Automation: Maven Profiles and Parallelization in Azure Pipelines Using IaaS
  • Using Python Libraries in Java
  • DGS GraphQL and Spring Boot

Trending

  • A Modern Stack for Building Scalable Systems
  • Performance Optimization Techniques for Snowflake on AWS
  • Contextual AI Integration for Agile Product Teams
  • Scaling DevOps With NGINX Caching: Reducing Latency and Backend Load
  1. DZone
  2. Coding
  3. Java
  4. Getting AccessExternalSchema to Cooperate

Getting AccessExternalSchema to Cooperate

If you find your mvn jaxws:wsimport command giving you problems along the accessexternalschma front, tweaking a system property might fix it for you.

By 
Mick Knutson user avatar
Mick Knutson
·
Jan. 09, 17 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
26.6K Views

Join the DZone community and get the full member experience.

Join For Free

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, but I solved the issue by adding
-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] ------------------------------------------------------------------------


Apache Maven Property (programming)

Published at DZone with permission of Mick Knutson, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Ensuring Reliable Microservice Deployment With Spring Boot Build Info Maven Plugin
  • Test Automation: Maven Profiles and Parallelization in Azure Pipelines Using IaaS
  • Using Python Libraries in Java
  • DGS GraphQL and Spring Boot

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: