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

落爺英雄遲暮 提交于 2019-12-22 04:27:16

问题


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?


回答1:


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>


来源:https://stackoverflow.com/questions/23814921/cannot-use-org-jvnet-jax-ws-commons-jaxws-maven-plugin-on-jdk8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!