Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7685

WSDL2java -compile fails when run with JDK-9, JDK-10, JDK-11

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Workaround
    • 3.2.2, 3.2.3
    • None
    • Tooling
    • None
    • OS: Fedora 26

      JDK: 9.0.4

      mvn: 3.5.0

      cxf: 3.2.4-SNAPSHOT

    • Unknown

    Description

      JBossws-cxf calls WSDL2java and passes input arguments.  WSDL2java prints the input args it recieves, that information looks like this,

      wsdl2java -compile -d /tmp/output/tmp1993473 -verbose -classdir /tmp/output -allowElementReferences https://raw.githubusercontent.com/jbossws/jbossws-cxf/master/modules/testsuite/shared-tests/src/test/resources/jaxws/smoke/tools/wsdl/TestServiceSoap12.wsdl
      

      Starting with JDK-9 WSDL2java is unable to successfully compile the generated classes.  Class imports, javax.jws.WebMethod, javax.jws.WebService and the like can not be resolved. javac does not find module  java.xml.ws by default.  From StackOverflow discussions it appears the --add-modules java.xml.ws may need to be passed to the compiler.  I see any way in the existing code to do this.

      I think WSDL2java should pass by default java.xml.ws and other related ee modules by default to the compiler.

      Here is the output of the tool.

      1206 > ~/bin/mywsdl2java -compile -d /tmp/output/tmp1993473 -verbose -classdir /tmp/output -allowElementReferences https://raw.githubusercontent.com/jbossws/jbossws-cxf/master/modules/testsuite/shared-tests/src/test/resources/jaxws/smoke/tools/wsdl/TestServiceSoap12.wsdl
      OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
      Listening for transport dt_socket at address: 8787
      SLF4J: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError.
      SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
      Loading FrontEnd jaxws ...
      SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
      SLF4J: Defaulting to no-operation (NOP) logger implementation
      SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
      Loading DataBinding jaxb ...
      wsdl2java -compile -d /tmp/output/tmp1993473 -verbose -classdir /tmp/output -allowElementReferences https://raw.githubusercontent.com/jbossws/jbossws-cxf/master/modules/testsuite/shared-tests/src/test/resources/jaxws/smoke/tools/wsdl/TestServiceSoap12.wsdl
      wsdl2java - Apache CXF 3.2.4-SNAPSHOT-53b2be829ed6cd7660ae90e035cc8588b0a8dfb1
      
      Mar 21, 2018 8:50:56 PM org.apache.cxf.wsdl11.WSDLServiceBuilder checkForWrapped
      INFO: Operation {http://www.openuri.org/2004/04/HelloWorld}echo cannot be unwrapped, input message must reference global element declaration with same localname as operation
      /tmp/output/tmp1993473/org/openuri/_2004/_04/helloworld/EndpointInterface.java:3: error: package javax.jws is not visible
      import javax.jws.WebMethod;
                  ^
        (package javax.jws is declared in module java.xml.ws, which is not in the module graph)
      /tmp/output/tmp1993473/org/openuri/_2004/_04/helloworld/EndpointInterface.java:4: error: package javax.jws is not visible
      import javax.jws.WebParam;
                  ^
        (package javax.jws is declared in module java.xml.ws, which is not in the module graph)
      /tmp/output/tmp1993473/org/openuri/_2004/_04/helloworld/EndpointInterface.java:5: error: package javax.jws is not visible
      import javax.jws.WebResult;
                  ^
        (package javax.jws is declared in module java.xml.ws, which is not in the module graph)
      /tmp/output/tmp1993473/org/openuri/_2004/_04/helloworld/EndpointInterface.java:6: error: package javax.jws is not visible
      import javax.jws.WebService;
                  ^
        (package javax.jws is declared in module java.xml.ws, which is not in the module graph)
      /tmp/output/tmp1993473/org/openuri/_2004/_04/helloworld/EndpointInterface.java:7: error: package javax.jws.soap is not visible
      import javax.jws.soap.SOAPBinding;
                      ^
        (package javax.jws.soap is declared in module java.xml.ws, which is not in the module graph)
      
      WSDLToJava Error: Failed to compile generated code
      
      org.apache.cxf.tools.common.ToolException: Failed to compile generated code
          at org.apache.cxf.tools.common.ClassUtils.compile(ClassUtils.java:125)
          at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:303)
          at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
          at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
          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.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:185)
      
      

      Please find attached script mywsdl2java which will demonstrate this issue.

         Edit mywsdl2java and change CXF_HOME and M2_HOME to be the appropriate path.

      Make directory /tmp/output/tmp1993473

      In a terminal exec cmd

        ./mywsdl2java -compile -d /tmp/output/tmp1993473 -verbose -classdir /tmp/output -allowElementReferences https://raw.githubusercontent.com/jbossws/jbossws-cxf/master/modules/testsuite/shared-tests/src/test/resources/jaxws/smoke/tools/wsdl/TestServiceSoap12.wsdl

       

      This is a significant bug for JBossws-cxf and Wildfly.

       

      Attachments

        1. mywsdl2java
          2 kB
          Rebecca Searls

        Activity

          People

            Unassigned Unassigned
            rsearls Rebecca Searls
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: