Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot use org.jvnet.jax-ws-commons.jaxws-maven-plugin on JDK8

I'm using org.jvnet.jax-ws-commons:jaxws-maven-plugin to generate client stubs for Soap services. Upgrading to JDK8 made this fail with following error:

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

and something like

Failed to read DTD 'XMLSchema.dtd', because 'file' access is not allowed due to restriction set by the accessExternalDTD property.

Why is this and how can I fix this?

like image 553
Viktor Hedefalk Avatar asked May 22 '14 18:05

Viktor Hedefalk


1 Answers

Seems restriction default have changed in JDK8.

Found this: http://wiki.netbeans.org/FaqWSDLExternalSchema

It was however hard for me to find out how to apply this to the Maven plugin, but passing jvm arguments worked:

 <plugin>
    <groupId>org.jvnet.jax-ws-commons</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>${jaxws.plugin.version}</version>
    <executions>
      <execution>
        <goals>
          <goal>wsimport</goal>
        </goals>
        <configuration>
          <verbose>true</verbose>
          <xdebug>true</xdebug>
          <wsdlDirectory>${basedir}/src/main/wsdl/</wsdlDirectory>
          <wsdlFiles>
            <wsdlFile>foo.wsdl</wsdlFile>
          </wsdlFiles>
          <vmArgs>
            <vmArg>-Djavax.xml.accessExternalDTD=all</vmArg>
            <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
          </vmArgs>
        </configuration>
      </execution>
    </executions>
  </plugin>
like image 67
Viktor Hedefalk Avatar answered Oct 31 '22 20:10

Viktor Hedefalk