Generating Java classes from wsdl error Follow
I'm trying to generate Java classes from a wsdl within the Java EE:Webservice plugin but I get the following error message:
/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/java -Xmx128M com.sun.tools.ws.WsImport -p mypackage -d /Users/mgr/IdeaProjects/wstest/src -s /Users/mgr/IdeaProjects/wstest/src -wsdllocation file:/Users/mgr/IdeaProjects/wstest/src/mypackage/dlws.wsdl file:/Users/mgr/IdeaProjects/wstest/src/mypackage/dlws.wsdl
Error: Could not find or load main class com.sun.tools.ws.WsImport
I can however generate the classes if i run the following command line tool:
wsimport -extension dlws.wsdl
IntelliJ IDEA 2016.3.2
Build #IU-163.10154.41, built on December 21, 2016
Licensed to TradeChannel AB / Mikael Grevsten
You have perpetual fallback license for this version
Subscription is active until December 11, 2017
JRE: 1.8.0_112-release-408-b6 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
MacBook /w Sierra 10.12.2
Please sign in to leave a comment.
Edit the JSDK configuration in IntelliJ IDEA and add tools.jar to 1.8 JDK classpath.
It's is there already
Try a more recent Java version from Oracle.
Tried 112 but same result
As far as I can see the WSImport is in the package
You are right, it appears that you need https://jax-ws.java.net/2.2.10/ in the classpath.
com.sun.tools.ws.WsImport is in jaxws-ri-2.2.10.zip\jaxws-ri\lib\jaxws-tools.jar.
Hmm, this didn't work either…
Even when added to JDK classpath?
If this is the right place to put it:
Ok, it appears the classpath has no effect for wsimport.
Please file a bug at https://youtrack.jetbrains.com/issues/IDEA with a small sample project and the exact steps to reproduce.
Thx for your help and input!
So, as per my findings, this is a classpath issue. I faced this issue with jdk 11 on a windows 10 machine. The classpath was the regular ".../jdk-11.0.1/" for me. But I realized that tools.jar was at "C:\Program Files\Java\jdk-11.0.1\lib\src\jdk.jartool\sun\tools.jar". The program run specified WsImport to be searched at "com.sun.tools..." which was obviously the wrong place to search. I solved the issue by reverting back to jdk 8 (since I needed a quick solution).
i have the same problem using jdk 17.
Error: Could not find or load main class com.sun.tools.ws.WsImport intellij
I try to generate a client from a wsdl
i need help
Aristides Figueroa What IDE version do you use? This issue is fixed in 2021.3.1 version.
If it still doesn't work for you in the current IDE release, please contact support at https://intellij-support.jetbrains.com/hc/requests/new and attach a sample project to reproduce the problem.
IntelliJ IDEA 2022.2.3 (Ultimate Edition)
Build #IU-222.4345.14, built on October 4, 2022
Runtime version: 220.127.116.11+7-b469.62 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
GC: G1 Young Generation, G1 Old Generation
Metal Rendering is ON
Aristides Figueroa Make sure your project dependencies include jaxws-ri library.
I have included the dependency. later in the module in tools selections generate java code from Wdls and I have the same result
my test project is pretty simple. I follow the documentation https://www.jetbrains.com/help/idea/web-service-clients.html to generate a web service client. (
Generate Java Code from WSDL
The test wdsl is: http://www.dneonline.com/calculator.asmx?wsdl
Aristides Figueroa You also need this dependency:
friend thanks for the support
I have also added that dependency and I get the same result
I did it in Netbeans with no problem in less than 5 minutes.
And then always in Netbeans I also applied it to other private web services that I needed to test.
Itelleji is one of my favourites, but I lost a day trying to generate java code from a wsdl without success.
maybe you can generate it from this wsdl
Aristides Figueroa Sample project that works for me: https://dl.dropboxusercontent.com/s/bzu7jdw4um3aj7e/wssample.zip.