Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wsimport failing in Java 11

In Java 8, I was using codehaus' jaxws-maven-plugin version 2.5 for wsimport goal in maven. Now I am moving my application to Java 11 and the plugin execution gives error.

<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<versionRange>2.5</versionRange>

I found one workaround and used the following which resolved the error in Java 11 - :

<plugin>
    <groupId>com.helger.maven</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>2.6</version>
        <executions>
            <execution>
                <goals>
                    <goal>wsimport</goal>
                </goals>
                <configuration>
                    <vmArgs>
                        <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
                    </vmArgs>

I believe codehaus has not yet updated its plugin to provide support for Java11. Is my approach a right one, or is there any alternative?

like image 794
Aditya Batra Avatar asked Nov 28 '18 09:11

Aditya Batra


People also ask

What is wsimport in JAX-WS?

The wsimport command generates the following JAX-WS portable artifacts. These artifacts can be packaged in a WAR file with the Web Services Description Language (WSDL) file and schema documents and the endpoint implementation to be deployed. The wsimport command also provides a wsimport Ant task.

Is it possible to import WSDL in Java 11?

The new version of Java 11 does not supply the tools to import and generate WSDL (wsimport and wsgen). Do you have an idea to solve this lack? import javax.jws.... Thanks. I'm not used to looking at into the binaries of Metro JAX-WS. I'm going to test with Java 11 and the JAX-WS maven plugin.

When to use wsimport?

When to use wsimport ? Web service provider provides a WSDL file after publishing a web service. In this situation any client or consumer can run wsimport command by passing wsdl file to generate the required client supported files which will be used to consume the published service

What is the wsimport Ant task?

The wsimport command also provides a wsimport Ant task. Java Architecture for XML Binding (JAXB) generated value types (mapped Java classes from schema types) To start the wsgen command, enter the following commands:


1 Answers

I solved the issue by using the following plugin

<groupId>com.helger.maven</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
    <version>2.6</version>

Update : New plugin is available which can be used for this purpose. Apparently com.helger plugin was just a temporary workaround.

<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
    <version>2.3.2</version>
like image 70
Aditya Batra Avatar answered Sep 22 '22 07:09

Aditya Batra