WebService Client Generation Error with JDK8

后端 未结 23 2440
既然无缘
既然无缘 2020-11-27 08:50

I need to consume a web service in my project. I use NetBeans so I right-clicked on my project and tried to add a new \"Web Service Client\". Last time I checked, this was t

相关标签:
23条回答
  • 2020-11-27 09:45

    I have just tried that if you use SoapUI (5.4.x) and use Apache CXF tool to generate java code, put javax.xml.accessExternalSchema = all in YOUR_JDK/jre/lib/jaxp.properties file also works.

    0 讨论(0)
  • 2020-11-27 09:47

    When using Maven with IntelliJ IDE you can add -Djavax.xml.accessExternalSchema=all to Maven setting under JVM Options for Maven Build Tools Runner configuration

    0 讨论(0)
  • 2020-11-27 09:47

    It is now fixed in 2.5 version (released in jul/17). https://github.com/mojohaus/jaxws-maven-plugin/issues/8.

    For the 2.4.x versions there is a workaround (as decribed in https://github.com/mojohaus/jaxws-maven-plugin/issues/4):

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>2.4.1</version>
            <dependencies>
                <dependency>
                    <groupId>com.sun.xml.ws</groupId>
                    <artifactId>jaxws-tools</artifactId>
                    <version>2.2.10</version>
                </dependency>
            </dependencies>
        </plugin>
    
    0 讨论(0)
  • 2020-11-27 09:49

    I tested this for version 2.4 of artifact org.codehaus.mojo and that worked ~

    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>2.4.1</version>
            <executions>
                <execution>
    
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <wsdlDirectory>path/to/dir/wsdl</wsdlDirectory>
                    </configuration>
                    <id>wsimport-web-service</id>
                    <phase>generate-sources</phase>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>javax.xml</groupId>
                    <artifactId>webservices-api</artifactId>
                    <version>${webservices-api-version}</version>
                </dependency>
            </dependencies>
            <configuration>
                <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>
            </configuration>
        </plugin>
    </plugins>
    
    0 讨论(0)
  • 2020-11-27 09:50

    Another alternative is to update wsimport.sh shell script by adding the following:

    The wsimport.sh is located in this directory:

    jaxws-ri.2.2.28/bin

    exec "$JAVA" $WSIMPORT_OPTS -Djavax.xml.accessExternalSchema=all -jar "$JAXWS_HOME/lib/jaxws-tools.jar" "$@"

    0 讨论(0)
  • 2020-11-27 09:50

    Another reference: If you are using the maven-jaxb2-plugin, prior to version 0.9.0, you can use the workaround described on this issue, in which this behaviour affected the plugin.

    0 讨论(0)
提交回复
热议问题