newer wsgen cannot find existing WebService annotation

397 views Asked by At

We have a working web service using Java 8 that we are trying to upgrade to Java 11.

jaxws-ri\bin\wsgen.bat (version "JAX-WS RI 4.0.0-M4 git-revision#ac6e723") displays the following exception:

  Exception in thread "main" com.sun.xml.ws.model.RuntimeModelerException: A WebService annotation is not present on class: com.xxxxxx.security.services.webservice.SecurityServiceImpl
      at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:234)
      at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:70)
      at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:51)
      at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:28)
      at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:92)
      at com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:247)
      at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:102)
      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 com.sun.tools.ws.Invoker.invoke(Invoker.java:132)
      at com.sun.tools.ws.WsGen.main(WsGen.java:29)
  Result: 1

However, our SecurityServiceImpl.java class DOES contain the @Webservice annotation, as shown below

import javax.jws.WebService;

@WebService(name="Foundation Security", serviceName="FoundationSecurityWS", portName="FoundationSecurityWSPort")
public class SecurityServiceImpl  {

Our ant build script uses the following wsgen.bat arguments:

        <arg line="-cp ${wsgen.classpath.string}"/>
        <arg line="-d ${build.webservice}/server"/>
        <arg line="-s ${build.webservice}/serversource"/>
        <arg line="-r ${build.webservice}/resource"/>
        <arg line="-wsdl"/>
        <arg line="-keep"/>
        <arg line="com.xxxxxx.security.services.webservice.SecurityServiceImpl"/>

Thank you in advance for any suggestions

1

There are 1 answers

0
7579 On

after adding debug logging to JAX-WS com.sun.xml.ws.model.*, the issue seemed to be that "import javax.jws.WebService;" needed to be updated to "import jakarta.jws.WebService;"