camel-tooling / vscode-wsdl2rest

Deprecated - VS Code extension that provides access to the jboss-fuse/wsdl2rest utility to generate a Camel Rest DSL configuration
Apache License 2.0
1 stars 7 forks source link

ClassNotFoundException: javax.xml.ws.Service #586

Open bawood opened 3 years ago

bawood commented 3 years ago

I'm hoping to set up an integration using Camel with a Cisco Unified Communication Manager server's SOAP API. I'm developing on a Debian Linux 11 desktop, using VSCode 1.60.2 and OpenJDK 8 from AdoptOpenJDK (I've also tried with the Debian default OpenJDK 11 with the same result). I generated the camel setup with the camel-spring-boot maven archetype. After I run the wsdl2rest command and select the wsdl, it runs through all the services but fails with the following ClassNotFoundException, I've chopped out most of them for brevity.

Executing Wsdl2Rest...
Retrieving document at 'file:/home/abcdef/Dev/phones/Cisco/AXL_toolkit/schema/11.5/AXLAPI.wsdl'.

Retrieving schema wsdl:imported from 'AXLSoap.xsd', relative to 'file:/home/abcdef/Dev/phones/Cisco/AXL_toolkit/schema/11.5/AXLAPI.wsdl'.

Services: 

    AXLAPIService

    Port: AXLPort
    Binding: AXLPort
    PortType: AXLPort

    Operations: 
        Operation: addSipProfile
            Input: 
            Message: addSipProfileIn
            Part: :addSipProfile

                Params: 5.com/AXL/API/11.cisco.www.AddSipProfile {http://www.cisco.com/AXL/API/11.5}addSipProfile

            Output: 

            Message: addSipProfileOut
            Part: :addSipProfileResponse

                Params: 5.com/AXL/API/11.cisco.www.AddSipProfileResponse {http://www.cisco.com/AXL/API/11.5}addSipProfileResponse
            Faults: 

            Message: AXLError

            Part: :axlError
                Params: 5.com/AXL/API/11.cisco.www.AxlError {http://www.cisco.com/AXL/API/11.5}axlError

...<chopped>...

    SOAP Address URL: https://CCMSERVERNAME:8443/axl/
    SOAP Address URL: https://CCMSERVERNAME:8443/axl/

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector (jar:file:/home/abcdef/.vscode/extensions/redhat.vscode-wsdl2rest-0.0.13/jars/wsdl2rest.jar!/BOOT-INF/lib/jaxb-impl-2.3.0.jar!/) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Error executing command
java.lang.NoClassDefFoundError: javax/xml/ws/Service
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer.isJaxws22(JAXWSContainer.java:64)
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer.getServiceTarget(JAXWSContainer.java:61)
    at org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer.validate(JAXWSContainer.java:68)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:164)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:156)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:404)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
    at org.jboss.fuse.wsdl2rest.impl.codegen.JavaTypeGenerator.execute(JavaTypeGenerator.java:36)
    at org.jboss.fuse.wsdl2rest.impl.Wsdl2Rest.process(Wsdl2Rest.java:92)
    at org.jboss.fuse.wsdl2rest.impl.Main.mainInternal(Main.java:60)
    at org.jboss.fuse.wsdl2rest.impl.Main.main(Main.java:36)
    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:566)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: java.lang.ClassNotFoundException: javax.xml.ws.Service
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 21 more

Process finished. Return code 1.
apupier commented 3 years ago

based on the error, it sound slike a Java 11 is used in all cases.

Can you check:

bawood commented 3 years ago

I didn't see java.home set to anything in preferences, but in settings.json I have this; "java.configuration.runtimes": [ { "name": "JavaSE-1.8", "path": "/usr/lib/jvm/jdk8u302-b08", "default": true } ], I don't have JDK_HOME or JAVA_HOME environment variables when I check from a terminal in VSCode, I think because I'm starting it from the application menu.

So I set java.home to /usr/lib/jvm/jdk8u302-b08, but after restarting I see the following error in the Java Tooling Runtime settings.

Java 11 or more recent is required by the Java language support (redhat.java) extension.(Current JDK: /usr/lib/jvm/jdk8u302-b08)

and a notification pop up like

Java 11 or more recent is required to run the Java extension. Please download and install a recent JDK. You can still compile your projects with older JDKs by configuring 'java.configuration.runtimes' So it seems the settings required for wsdl2rest camel tooling are in conflict with the requirements for the extension Language Support for Java by Redhat

apupier commented 3 years ago

So it seems the settings required for wsdl2rest camel tooling are in conflict with the requirements for the extension Language Support for Java by Redhat

agree that it is in conflict.

Is the command to generate the wsdl2rest working in this conflicting case?

bawood commented 3 years ago

In a terminal with JAVA_HOME set to /usr/lib/jvm/jdk8u302-b08/ I was able to run /usr/lib/jvm/jdk8u302-b08/bin/java -jar ~/.vscode/extensions/redhat.vscode-wsdl2rest-0.0.13/jars/wsdl2rest.jar --out src --wsdl file:~/AXL_toolkit/schema/11.5/AXLAPI.wsdl and it generates sources