从类加载器看不到接口 [英] Interface is not visible from class loader

查看:255
本文介绍了从类加载器看不到接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手!框架并使用wsdl2java工具.我正在开发剧本!需要与SOAP Web服务进行交互的应用程序.我有WSDL,并使用jaxws从中创建了对象.它正在创建一堆Java类和1个接口.尝试进行Web服务调用时,我收到一个错误,指出类加载器找不到该接口.这是我的代码:

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");

请注意,"MyWebserviceRemote"是接口. getMyWebserviceBeanPort的代码很常见,因为它是自动生成的,但是在这里是:

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);
}

当我尝试调用方法时,例如如上所述的loginUser方法,我得到以下堆栈跟踪:

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

我真的不知道如何解决这个问题,甚至不知道如何调试它.我在哪里看?我从哪里开始?我使用SoapUI测试了Web服务,并且运行良好.

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.

谢谢!

推荐答案

这是由于play框架中的jar文件冲突(总共3个jar,名称中带有"jax")引起的.我删除了它们,现在一切都很好.欢呼描述性错误消息:-)

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

这篇关于从类加载器看不到接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆