Closed ingwarsw closed 4 years ago
@ingwarsw I was able to compile with JDK9 (Oracle and Eclipse OpenJ9) by using the following maven plugins. What's missing is the module-info.java file that must be injected into the final compile process.
It doesn't work.
I tried with madduci configuration but I get the error all the same :
Processing: file:/C:/Users/amoscatelli/Documents/NetBeansProjects/SS730pClient/src/wsdl/InvioTelematicoSpeseSanitarie730p.wsdl jaxws:wsimport args: [-keep, -s, 'C:\Users\amoscatelli\Documents\NetBeansProjects\SS730pClient\target\generated-sources\wsimport', -d, 'C:\Users\amoscatelli\Documents\NetBeansProjects\SS730pClient\target\classes', -verbose, -encoding, UTF-8, -Xnocompile, -p, fromwsdl.server, -Xdebug, "file:/C:/Users/amoscatelli/Documents/NetBeansProjects/SS730pClient/src/wsdl/InvioTelematicoSpeseSanitarie730p.wsdl"] Error: Could not create the Java Virtual Machine. -Xbootclasspath/p is no longer a supported option. Error: A fatal exception has occurred. Program will exit.
This a pom project you can use for testing the issue.
Please let me know if you can help
@amoscatelli you can disable the compilation of WSDL files and let maven-compiler-plugin do the job for you. You will need to use jdeps to generate a module-info.java based on what jaxws-plugin generates. it works perfectly
Do you mean this ?
http://www.mojohaus.org/jaxws-maven-plugin/wsimport-mojo.html#xnocompile
I am already using xnocompile true, as you can see in the attachment. And true is the default value btw.
So what do you mean ?
Ran into this issue today - seems like if you add in an explicit executable to the JDK 9 wsimport, you can get it to work:
<executable>${java.home}/bin/wsimport</executable>
It's annoying, but at least seems like a plausible workaround until this bug gets fixed.
I can confirm that @strmer15 workaround works for me.
For future reference, the executable tag goes into plugin configuration section.
I used this:
<!-- Set wsimport for Windows/Linux -->
<profiles>
<profile>
<id>win</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<tool.wsimport>${java.home}/bin/wsimport.exe</tool.wsimport>
</properties>
</profile>
<profile>
<id>nix</id>
<activation>
<os>
<family>!windows</family>
</os>
</activation>
<properties>
<tool.wsimport>${java.home}/bin/wsimport</tool.wsimport>
</properties>
</profile>
</profiles>
And then in the plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>${jaxws-maven-plugin.version}</version>
<configuration>
<wsdlDirectory>src/main/webapp/WEB-INF/wsdl/</wsdlDirectory>
<wsdlFiles>
<wsdlFile>foo.wsdl</wsdlFile>
</wsdlFiles>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
<extension>true</extension>
<keep>true</keep>
<quiet>true</quiet>
</configuration>
<executions>
<execution>
<id>wsimport-from-jdk</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<executable>${tool.wsimport}</executable>
</configuration>
</execution>
</executions>
</plugin>
I have the same problem. Here's a reproducing project.
@highsource Add <executable>${java.home}/bin/wsimport</executable>
to plugins configurations in your pom. That will do the Job
@byrash No. ${java.home}/bin/wsimport
does not work with XJC plugins.
@highsource yes it works, with both Oracle JDK 9 and 10
@madduci Could you please point me to an example of using jaxws-maven-plugin
with XJC plugins which would work under JDK 9?
@madduci @byrash Here's my example:
jaxb2-basics-sample-jaxws-maven-with-xjc-plugins.zip
Which does not work due to:
[INFO] jaxws:wsimport args: [-keep, -s, 'C:\Projects\workspaces\jaxb2-basics\jaxb2-basics-sample-jaxws-maven\target\generated-sources\jaxws', -d, 'C:\Projects\workspaces\jaxb2-basics\jaxb2-basics-sample-jaxws-maven\target\classes', -verbose, -extension, -Xnocompile, -B-Xequals, -B-XtoString, -b, 'file:/C:/Projects/workspaces/jaxb2-basics/jaxb2-basics-sample-jaxws-maven/src/main/resources/bindings.xjb', -b, 'file:/C:/Projects/workspaces/jaxb2-basics/jaxb2-basics-sample-jaxws-maven/src/main/resources/wsdl-bindings.xjb', "file:/C:/Projects/workspaces/jaxb2-basics/jaxb2-basics-sample-jaxws-maven/src/main/resources/main.wsdl"]
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
no such JAXB option: -Xequals
The problem is explained here:
With <executable>${java.home}/bin/wsimport.exe</executable>
this simply calls wsimport
from the JDK. Which uses "internal" XJC and is not compatible with "normal" XJC plugins.
So from my point of view this does not work.
But if it does, it must be very easy to prove. Just show an example of jaxws-maven-plugin
using, say, JAXB2 Basics 0.12.0
buildable under Java 9 and I'll be more than happy.
I am getting:
Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/Connection at java.base/java.lang.Class.getDeclaredMethods0(Native Method) at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3119) at java.base/java.lang.Class.getMethodsRecursive(Class.java:3260) at java.base/java.lang.Class.getMethod0(Class.java:3246) at java.base/java.lang.Class.getMethod(Class.java:2065) at java.xml.ws@10.0.1/com.sun.xml.internal.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:637) at java.xml.ws@10.0.1/com.sun.xml.internal.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:476) at java.xml.ws@10.0.1/com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:305) at java.xml.ws@10.0.1/com.sun.xml.internal.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:85) at java.xml.ws@10.0.1/com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:59) at java.xml.ws@10.0.1/com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:43) at java.xml.ws@10.0.1/com.sun.xml.internal.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:105) at jdk.xml.ws@10.0.1/com.sun.tools.internal.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:243) at jdk.xml.ws@10.0.1/com.sun.tools.internal.ws.wscompile.WsgenTool.run(WsgenTool.java:113) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at jdk.xml.ws@10.0.1/com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:138) at jdk.xml.ws@10.0.1/com.sun.tools.internal.ws.WsGen.main(WsGen.java:41) Caused by: java.lang.ClassNotFoundException: java.sql.Connection at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) ... 20 more
while wsgen is executed. I also used executable:
`
<phase>prepare-package</phase>
<goals>
<goal>wsgen</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<resourceDestDir>${basedir}/src/wsdl</resourceDestDir>
<inlineSchemas>true</inlineSchemas>
<keep>false</keep>
<wsdl>DctmService.wsdl</wsdl>
<portname>{http://generic.documentum.telekom.si/}DcmtServiceImplPort</portname>
<protocol>soap1.1</protocol>
<sei>si.telekom.documentum.generic.DcmtServiceImpl</sei>
<genWsdl>true</genWsdl>
<verbose>true</verbose>
<useJdkToolchainExecutable>false</useJdkToolchainExecutable>
<executable>${java.home}/bin/wsgen</executable>
<!-- <executable>${tool.wsgen}</executable> -->
<xdebug>true</xdebug>
<xnocompile>false</xnocompile>
</configuration>
</execution>
`
.. like classes that are part of jre 10 are missing that is really strange.
Since JDK11 is lacking of wsimport: Is a JDK11 capable version of this plugin planned in the future?
Indeed wsimport is already removed http://openjdk.java.net/jeps/320
Maybe is possible to add wsimport from another source? AFAIK wsimport was the only option for top-down (WSDL to Java Code) web service generation
There is jaxws-ri
which comes with wsimport
bundled and all this stuff. I guess this is the way to go for a plug-in to use it as a dependency.
com.sun.xml.ws:jaxws-ri 2.3.0.1
Just don't call wsimport
from JDK via command-line. JAXB/XJC plugins won't work this way.
In the maven-jaxb2-plugin
I'm using XJC APIs to invoke XJC to generate code. I'm using dependencies like:
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-xjc-jdk9</artifactId>
<version>${jaxb.version}</version>
</dependency>
Thus I'm always sure which XJC I'm invoking and there are no problems with XJC plugins.
Calling xjc
via command-line would be a dead end for many reasons.
this works on both JDK 9 and JDK 10 under Linux:
tool.wsimport points to JDK_HOME/bin/wsimport
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<executions>
<execution>
<id>wsdl-to-java</id>
<phase>validate</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<executable>${tool.wsimport}</executable>
<wsdlDirectory>${wsdl.directory}</wsdlDirectory>
<wsdlFiles>
<wsdlFile>file1.wsdl</wsdlFile>
<wsdlFile>file2.wsdl</wsdlFile>
<wsdlFile>file3.wsdl</wsdlFile>
</wsdlFiles>
<destDir>${project.build.directory}/generated-sources</destDir>
<sourceDestDir>${wsdl.generated.sources}</sourceDestDir>
<destDir>${wsdl.generated.compiled}</destDir>
<target>${jaxws.version}</target>
<useJdkToolchainExecutable>false</useJdkToolchainExecutable>
<xnocompile>false</xnocompile>
<encoding>${encoding}</encoding>
<verbose>false</verbose>
<quiet>true</quiet>
<!-- Enable access to local DTD files -->
<args>
<arg>-J-Djavax.xml.accessExternalDTD=file</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
@madduci This does not work with XJC plugins like JAXB2 Basics.
@highsource i do not use them
@madduci A lot of people do. And this is advertised as a feature of jaxws-maven-plugin
:
https://www.mojohaus.org/jaxws-maven-plugin/examples/using-jaxb-plugins.html
Which effectively does not work with Java 9 then.
Any updates on support for this OpenJDK v11 ?
Just to mention it... The proposed workaround for JDK9/10 would be for Linux
and for windows
We have both Win/Mac/Linux in our developer environments, so this workaround is not a very practical solution for us.
@Knut-Fjellheim you can work with maven profiles, that trigger the right path to wsimport based on system
Hi @Knut-Fjellheim,
http://www.mojohaus.org/jaxws-maven-plugin/examples/using-wstools-from-jdk.html
Please check this web page to solve your heterogenous developer environnements problem.
Mickael
@jonnybecker Did you solve the problem with JDK 11? I tried adding the dependency and it didn't work
@RobotWizard93
No haven't, but i didn't look into it yet. Just adding it as a dependency won't do the trick, since the plugin will still look for the wsimport
from the JDK.
Has anyone found a workaround for this?
Hi,
Did you know this plugin is available in the official repository of JAXWS => https://github.com/eclipse-ee4j/metro-jax-ws?
As you can see, the jaxws-maven-plugin is proposed with the JAXWS implementation => https://github.com/eclipse-ee4j/metro-jax-ws/tree/master/jaxws-ri/jaxws-maven-plugin
However, two dependencies are missing com.sun.xml.ws:jaxws-tools-bundle:jar:2.3.1 and com.sun.xml.ws:jaxws-tools-bundle:jar:sources:2.3.1. To fix this problem follow this issue => https://github.com/javaee/metro-jax-ws/issues/1251#issuecomment-430988915
Mickael
Hi,
I created a fork at https://github.com/phax/jaxws-maven-plugin that contains the changes from https://github.com/mojohaus/jaxws-maven-plugin/pull/71 and works with Java 8 and 11 (hopefully also 9 and 10).
It is also available on Maven Central at http://repo2.maven.org/maven2/com/helger/maven/jaxws-maven-plugin/2.6/jaxws-maven-plugin-2.6.pom and acts as a drop-in replacement. Please note the changed Maven group, so it's easy to switch back, once this plugin gets updated.
hth,
Edit: here are the Maven coordinates in a nicer way:
<plugin>
<groupId>com.helger.maven</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
...
</configuration>
</plugin>
@phax thanks for your work! Just gave the fork a spin and it seems to behave as advertised :+1:
Thanks @phax for your work on the drop-in replacement. For me it worked on JDK 9, 11 & 12 - but sadly not on JDK 8. But throughout digging deeper into the problem I realized, what was already clear somehow: this plugin here is simply NOT maintained anymore - and many thanks to @mickaelbaron for pointing that out: the sources moved over to the JAX-WS reference implementation inside the eclipse-ee4j/metro-jax-ws project under:
https://github.com/eclipse-ee4j/metro-jax-ws/tree/master/jaxws-ri/jaxws-maven-plugin
To use the maintained version of this plugin, simply replace the old dependency in your pom.xml
by the new one:
OLD!
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.5</version>
</dependency>
NEW!
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3.2</version>
</dependency>
Nevermind the 'lower' version number, the sources have a newer date and adhere to the rest of the JAX-WS sourcecode.
Hi, I can confirm that
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3.2</version>
</dependency>
works in Java 8 to 12 for my projects. It seems like the plugin follows the versioning scheme of JAX-WS itself. Nevertheless please elaborate on the problems you have with Java 8 and
<dependency>
<groupId>com.helger.maven</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.6.1</version>
</dependency>
since I'm running it without issues on OpenJDK. Do you eventually have something in your endorsed path?
I'am using the jaxws-maven-plugin inside the wrapper project called https://github.com/codecentric/cxf-spring-boot-starter-maven-plugin - there I execute the plugin with the help of the https://github.com/TimMoore/mojo-executor, which isn't kind of a standard way I guess. Inside the BootCxfMojo.java class (not inside the current version though, since I switched to com.sun.xml.ws.jaxws-maven-plugin
) I use execute the jaxws-maven-plugin with:
plugin(
groupId("com.helger.maven"),
artifactId("jaxws-maven-plugin"),
version("2.6"),
dependencies(
dependency(
"org.jvnet.jaxb2_commons",
"jaxb2-namespace-prefix",
"1.3"),
dependency(
"com.sun.xml.ws",
"jaxws-tools",
"2.3.2"))
),
Here's the build log: https://travis-ci.org/codecentric/cxf-spring-boot-starter-maven-plugin/builds/548073656?utm_source=github_status&utm_medium=notification
For me I sounds like that adding jaxws-tools
was not enough (I had an error regarding that one on JDK8), but after having another error I luckily found the maintainence problem with the current plugin and didn't go any further there, since I think this is kind of a dead end.
Ah okay - Gradle is tricky here, because it doesn't support JDK version based profile activation. Since jaxws-tools 2.3.2 requires Java 9 or later this doesn't work. See https://github.com/phax/ph-jaxws-pom/#gradle-usage for the different artefacts needed for Java 1.8 and Java 9+
I don't understand. If I try to use:
I get this error :
Error injecting: private org.eclipse.aether.spi.log.Logger org.apache.maven.repository.internal.DefaultVersionRangeResolver.logger
Well, maybe your Eclipse version is too old - no idea. Nevertheless if com.helger.maven jaxws-maven-plugin 2.6.1
works for you - use it. I will have an eye on it anyway
I am not using Eclipse, I am using Netbeans what's why I can't understand where this dependency comes from. Something requires that logger and the version is not aligned correctly ...
I managed to have this working. You have to force using newer version of Maven:
Tested with:
<prerequisites>
<maven>3.5.4</maven>
</prerequisites>
Now everything works with:
<plugin>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3.2</version>
</plugin>
See pull request #71 for a solution of this issue
Just use this fork: https://github.com/phax/jaxws-maven-plugin. It works with Java 9-13. I'm using it with Java 13 right now and is all good!
Because using of unsupported option: -Xbootclasspath/p is no longer a supported option.
Usage: https://github.com/mojohaus/jaxws-maven-plugin/blob/3f61d07c6360433b95304ec4f9706de86ccdabf8/src/main/java/org/codehaus/mojo/jaxws/AbstractJaxwsMojo.java#L442
In java 9 there is option to replace those: https://bugs.openjdk.java.net/browse/JDK-8061972 But it need module name not jar so will be hard to use it.
Is this endorse mechanizm needed?