Generating Java classes from wsdl error

Answered

Hi

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
Done

 

I can however generate the classes if i run the following command line tool:

wsimport -extension dlws.wsdl

 

 

I'm using

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

 

Pls advice

 

/M

0
22 comments

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.

1

Edit the JSDK configuration in IntelliJ IDEA and add tools.jar to 1.8 JDK classpath.

0

Hi, thanks

 

It's is there already

0

Try a more recent Java version from Oracle.

0

Tried 112 but same result

0

As far as I can see the WSImport is in the package

com.sun.tools.internal.ws

0

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.

0

Hmm, this didn't work either…

 

0

Even when added to JDK classpath?

0

If this is the right place to put it:

0

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.

0

Done!

Thx for your help and input!

 

https://youtrack.jetbrains.com/issue/IDEA-166705

0

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).

0

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

 

0

Hi Serge

IntelliJ IDEA 2022.2.3 (Ultimate Edition)
Build #IU-222.4345.14, built on October 4, 2022
Runtime version: 17.0.4.1+7-b469.62 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.7.4
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Metal Rendering is ON
Non-Bundled Plugins:
    org.xiaogang.unit.test (0.0.4.8)
    com.mirkoalicastro.mavenversionrefactor (1.0.5)
    org.jetbrains.kotlin (222-1.8.10-release-430-IJ4167.29)
    com.jetbrains.jax.ws (222.4345.14)

Kotlin: 222-1.8.10-release-430-IJ4167.29

0

Aristides Figueroa Make sure your project dependencies include jaxws-ri library.

0

Serge Baranov

I have included the dependency. later in the module in tools selections generate java code from Wdls and I have the same result

 

0

Serge Baranov

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

 

0

Aristides Figueroa You also need this dependency:

<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>4.0.1</version>
</dependency>
0

Serge Baranov

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

http://www.dneonline.com/calculator.asmx?wsdl

0

Please sign in to leave a comment.