gpt4 book ai didi

java - RuntimeModelerException : A WebService annotation is not present on class: clientpackage. IClientPortClass

转载 作者:行者123 更新时间:2023-11-30 11:01:16 29 4
gpt4 key购买 nike

我使用 JDK 1.6.0_45 创建了一个 JAX-WS 客户端。我在一个war项目中使用制作的jar,也是用ear打包的。在 Tomcat 中,我可以使用 Web 服务客户端调用并毫无问题地获得响应。但是在 Weblogic 10.3.6 服务器 中,我得到了这个异常:

ClientPortClass service = new ClientPortClass();
IClientPortClass port = service.getPortXML(); ---> this line produces below error:

com.sun.xml.ws.model.RuntimeModelerException: A WebService annotation is not present on class: clientpackage.IClientPortClass
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:237)
at com.sun.xml.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:762)
at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.buildRuntimeModel(WLSProvider.java:1026)
at com.sun.xml.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:746)
at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:737)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:361)
at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.internalGetPort(WLSProvider.java:978)
at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate$PortClientInstanceFactory.createClientInstance(WLSProvider.java:1083)
at weblogic.wsee.jaxws.spi.ClientInstancePool.takeSimpleClientInstance(ClientInstancePool.java:376)
at weblogic.wsee.jaxws.spi.ClientInstancePool.take(ClientInstancePool.java:232)
at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.getPort(WLSProvider.java:896)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:344)
at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.getPort(WLSProvider.java:836)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:326)
at javax.xml.ws.Service.getPort(Service.java:92)
at clientpackage.ClientPortClass.getPortXML(ClientPortClass.java:58)
...

我检查了 jax ws 生成的 ClientPortClass 类,它具有以下结构:

/**
* Web Service
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.8
* Generated source version: 2.1
*/
@WebServiceClient(name = "ClientPortClass", targetNamespace = "transactionData:ClientPortClass", wsdlLocation = "wsdlURL...")
public class ClientPortClass extends Service{
...
@WebEndpoint(name = "portXML")
public IClientPortClass getPortXML(WebServiceFeature... features) {
...}
}

IClientPortClass:

/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.8
* Generated source version: 2.1
*/
@WebService(name = "IClientPortClass", targetNamespace = "transactionData:ClientPortClass")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
ObjectFactory.class
})
public interface IClientPortClass {

@WebMethod(action = "trigger")
@WebResult(name = "message", targetNamespace = "transactionData:data", partName = "result")
public Message trigger(
@WebParam(name = "requestMessage", targetNamespace = "transactionData:data", partName = "input")
RequestMessage input);
}

我观察到 weblogic 使用 glassfish.jaxws.rt_1.3.0.0_2-1-5.jar。 com.sun.xml.ws.model.RuntimeModelerException 来自那个 jar 。我不知道,但也许它有关。

对于 RuntimeModelerException:WebService 注释不存在于类:clientpackage.IClientPortClass,您有什么建议吗?

最佳答案

需要在实现类上加上@WebService注解,例如@WebService(endpointInterface = "com...", targetNamespace = "http://abc ...")

关于java - RuntimeModelerException : A WebService annotation is not present on class: clientpackage. IClientPortClass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31269651/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com