Replacement for Wsimport With Jdk 11

Wsimport failing in Java 11

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>

Generate JAX-WS classes from WSDL file using Maven plugin with Java11

the new version of jaxws-maven-plugin (link) can generate Java classes with Java 11, using the plugin as follows:

<build>
<plugins>
...
<plugin>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3.2</version>
<executions>
<execution>
<id>generate-java-sources</id>
<phase>process-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<extension>true</extension>
<wsdlFiles>
<wsdlFile>${project.build.directory}/generated/wsdl/MyService.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>/wsdl/MyService.wsdl</wsdlLocation>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

An alternative plugin can also be the cxf-codegen-plugin from Apache CXF (link)

UPDATE

If you want to use the newer JakartaEE 9.0+ packages, you need to use the following plugin, keeping the same configurations:

<build>
<plugins>
...
<plugin>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>generate-java-sources</id>
<phase>process-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<extension>true</extension>
<wsdlFiles>
<wsdlFile>${project.build.directory}/generated/wsdl/MyService.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>/wsdl/MyService.wsdl</wsdlLocation>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

and for jaxb:

<groupId>com.evolvedbinary.maven.mojohaus</groupId>
<artifactId>jaxb-maven-plugin</artifactId>
<version>3.0.0</version>

Correctly migrating from JDK-8 to JDK-11 for JAX-WS libraries

In the Oracle release notes for Java 11, I found this:

other-libs ➜ JEP 320 Remove the Java EE and CORBA Modules

Remove the Java EE and CORBA modules from the Java SE Platform and the
JDK. These modules were deprecated in Java SE 9 with the declared
intent to remove them in a future release (JEP 320).

The following modules have been removed from Java SE 11 and JDK 11:

java.xml.ws (JAX-WS, plus the related technologies SAAJ and Web Services Metadata)
java.xml.bind (JAXB)

...etc

According to what I read from Oracle, they removed Jax-WS from Java 11, but it's still available under OpenJDK: JEP 320: Remove the Java EE and CORBA Modules. According to that page,

This proposal assumes that developers who wish to compile or run
applications on the latest JDK can find and deploy alternate versions
of the Java EE technologies. The Reference Implementations (RIs) of
JAX-WS and JAXB are a good starting point because they are complete
replacements for the java.xml.ws and java.xml.bind modules in JDK 9.

The RIs are available as Maven artifacts: (note that they must be
deployed on the class path)

com.sun.xml.ws : jaxws-ri (JAX-WS, plus SAAJ and Web Services Metadata)
com.sun.xml.bind : jaxb-ri (JAXB)

The tools for JAX-WS and JAXB are also available as Maven artifacts:

wsgen and wsimport: com.sun.xml.ws : jaxws-tools, plus tool scripts
schemagen and xjc: com.sun.xml.bind : jaxb-jxc and com.sun.xml.bind : jaxb-xjc, plus tool scripts

Since you are on Java 8, you may still have to do more tweaking and/or migrate up to Java 9 first, but from I can tell, this is your only path forward.

So to summarize, Oracle removed Jax-WS and related technologies from Java 11, but they are still available to download and use and here is the link to the Maven repo for (RIs) of JAX-WS and JAXB .
James

What does Maven, jaxws:wsimport mean when it says '-Xbootclasspath/p is no longer a supported option'?

wsimport was deprecated and replaced in Java 11.

The plugin has been updated to a new version that works with later versions of Java.

  <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.6</version>
...
</plugin>

will work

How do i know if a number is octal?

Instead of jumping back to input after comparing to 0, you need to jump to the comparison with 7 if the comparision succeeds, and jump to output the illegal string if it fails.



Related Topics



Leave a reply



Submit