3

I'm new to play! framework and using wsdl2java tools. I'm developing a play! application that needs to interact with a SOAP webservice. I have the WSDL and created objects from it using jaxws. It's creating a bunch of java classes and 1 interface. As soon as I try to make a webservice call, I get an error that the interface cannot be found by the classloader. This is my code:

MyWebserviceBeanService service = new MyWebserviceBeanService();
MyWebserviceRemote mwr = service.getMyWebserviceBeanPort();
LoginResponse response = mwr.loginUser("xxx", "xxx");

Notice that 'MyWebserviceRemote' is the interface. The code of getMyWebserviceBeanPort is quite common as it is generated automatically, but here it is:

@WebEndpoint(name = "MyWebserviceBeanPort")
public MyWebserviceRemote getMyWebserviceBeanPort() {
    return super.getPort(new QName("http://xxxxxxxxxx/", "MyWebserviceBeanPort"), MyWebserviceRemote.class);
}

When I try to call a method, e.g. the loginUser method as above, I get the following stacktrace:

play.exceptions.JavaExecutionException: interface xxxx.xxxx.xxxx.MyWebserviceRemote is not visible from class loader
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
    at Invocation.HTTP Request(Play!)
Caused by: java.lang.IllegalArgumentException: interface xxxx.xxxxx.xxxx.MyWebserviceRemote is not visible from class loader
    at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:736)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:408)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:384)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:366)
    at javax.xml.ws.Service.getPort(Service.java:119)
    at xxxx.xxxx.xxxx.MyWebserviceBeanService.getMyWebserviceBeanPort(MyWebserviceBeanService.java:72)
    at controllers.MyController.index(MyController.java:26)
    at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:557)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:508)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
    ... 1 more

I have really no idea how to fix this, or even how to debug this. Where do I look? Where do I start? I tested the webservice using SoapUI and it works fine.

Thanks!

Razzie
  • 30,834
  • 11
  • 63
  • 78

3 Answers3

10

This was caused by conflicting jar files in the play framework (3 jars in total with 'jax' in the name). I removed them and all is well now. Hurray for descriptive error messages :-)

Razzie
  • 30,834
  • 11
  • 63
  • 78
1

See if you have spring-dev-tools enabled. Remove it from dependencies if this is acceptable:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
  <scope>runtime</scope>
</dependency>
Zon
  • 18,610
  • 7
  • 91
  • 99
0

I had same problem, so i had to exclude this dependency from one of dependencies:

<exclusions>
    <exclusion>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>rt</artifactId>
    </exclusion>
</exclusions>
Rasool Ghafari
  • 4,128
  • 7
  • 44
  • 71