WebService Client Generation Error with JDK8

Goal

Fixing problem with WebService Client Generation Error with JDK8

Description

If you’re generating a WebService client in JDK8 and you’re having issues related to accessExternalSchema, similar to

schema_reference: Failed to read schema document 'xjc.xsd', because 'file' access is not allowed due to restriction set by the accessExternalSchema property.

then, this recipe might be helpful.

How to

One of the possibilities is to create a file named jaxp.properties (if it doesn’t exist) under $JDK8_HOME/jre/lib and then write this line in it (take a look at the documentation here for more details):

javax.xml.accessExternalSchema = all

However, the solution I prefer, in case you’re using Maven (e.g., jaxws-maven-plugin) to generate your client, is to specify the vmArg that defines that property, like the following:

...
<plugin>
  <groupId>org.jvnet.jax-ws-commons</groupId>
  <artifactId>jaxws-maven-plugin</artifactId>
  <version>2.2.1</version>
  <configuration>
    <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
    <wsdlLocation>/wsdl/*</wsdlLocation>
    <vmArgs>
      <strong><vmArg>-Djavax.xml.accessExternalSchema=all</vmArg></strong>
    </vmArgs>
    ...
  </configuration>
</plugin>
...

Explanations

All explanations were made in place. Therefore, there’s nothing useful to add here, I suppose…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s