1 Reply Latest reply on Sep 28, 2016 2:30 PM by Tomaz Cerar

    "A WebService annotation is not present on class"

    Alexander Lambley Newbie

      I am working on a project that is trying to create a Service from a .war deployment with the code...

       

      final AtomicReference<T> portReference = new AtomicReference<T>();

      StringBuilder urlString = new StringBuilder("https://");

      urlString.append(getHost()).append(":").append(getPort());

      urlString.append(serviceFolder);

      URL wsdlLocation = new URL(urlString.toString());

      QName serviceName = new QName(serviceAddress, service);

      QName portName = new QName(serviceAddress, port);

      Service webService = Service.create(wsdlLocation, serviceName);

      portReference.set(webService.getPort(portName, portClass));      //failure here

      T webServicePort = portReference.get();

      return webServicePort;

       

      And it fails at webService.getPort() with...

       

      ERROR [stderr] (default task-9) com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService annotation is not present on class: com.mycom.ClientInterface

       

      Looking at ClientInterface.java...

       

      @WebService

      public interface ClientInterface{

      (Various @WebMethod()s)...

      }

       

      As you can see ClientInterface does indeed have a @WebService annotation as does its implementing class Client. Does anyone have any experience with this issue or something similar? A full day of googling has rendered a lot up barren StackTrace questions from 2+ years ago. My current guess is that it is some sort of jax-ws classloading issue but I'm not sure.