Search code examples
jakarta-eeglassfishjax-ws

Why do I need sun-jaxws.xml file on glassfish 4?


I am making some first steps into the world of JAX-WS and use glassfish 4.

I just tried to rebuild the JavaEE7 Oracle Jax-WS examples and have the following webservice:

@WebService
public class Hello {

    @WebMethod
    public String sayHello(String name) {
        System.out.println("Webservice sayHello called...");
        return "Hello " + name;
    }
}

There is nothing more.. I have deployed it on glassfish, I can use the Tester, I can see the WSDL - fine.

Now I was writing the client that should be called by a JSF2 view.. Here comes the bean:

@Named
@RequestScoped
public class HelloServiceClient {

    @WebServiceRef(wsdlLocation="http://localhost:8080/HelloService/HelloService?WSDL")
    private HelloService service;

    public String callHello() {
        Hello helloPort = service.getHelloPort();
        return helloPort.sayHello(" JSF2 View!");
    }

    public String callWSSayHello(String name) {
        Hello helloPort = service.getHelloPort();
        return helloPort.sayHello(name);
    }
}

There is also a minimalistic view just calling the callHello() method and display the result.

I was deploying that application to the same glassfish server and got the following error:

java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: Laufzeitdeskriptor konnte nicht geparst werden: javax.xml.ws.WebServiceException: Laufzeitdeskriptor "/WEB-INF/sun-jaxws.xml" fehlt. Please see server.log for more details.

So I do not understand that concept of sun-jaxws - and even though - the oracle docs and example don't tell me anything about it.

Did I do something wrong - maybe in my IDE or anything else?


Solution

  • I have found the answer for my problem:

    My IDE automatically added the WSServlet as a listener to my web.xml -> if you remove that from the web.xml it is working as expected.