Interface is not visible from class loader

扶醉桌前 提交于 2019-12-11 09:50:09

问题


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!


回答1:


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 :-)



来源:https://stackoverflow.com/questions/12199732/interface-is-not-visible-from-class-loader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!