Web services 如果在带有web.xml的web服务中使用@Stateless,则NameReadyBoundException

Web services 如果在带有web.xml的web服务中使用@Stateless,则NameReadyBoundException,web-services,weblogic,web-deployment,weblogic12c,stateless,Web Services,Weblogic,Web Deployment,Weblogic12c,Stateless,我试图使用以下注释在Weblogic 12c中部署一个webservice: @SchemaValidation @BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING) @WebService(serviceName = "xxxxx", targetNamespace = "http://bla/BusinessServices/yyy/xxxxx/V1", wsdlLocation = "M

我试图使用以下注释在Weblogic 12c中部署一个webservice:

@SchemaValidation
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
@WebService(serviceName = "xxxxx",
        targetNamespace = "http://bla/BusinessServices/yyy/xxxxx/V1",
        wsdlLocation = "META-INF/wsdl/zzz/yyy/xxxxx/V1/xxxxxConcrete.wsdl",
        portName = "xxxxxPort",
        endpointInterface = "ble.businessservices.yyy.xxxxx.v1.xxxxx")
//@Transactional(value= Transactional.TransactionFlowType.SUPPORTS, version= Transactional.Version.WSAT12)
@Stateless
@SecurityPolicies(@SecurityPolicy(uri = "my_policy"))
@DeclareRoles("my-role")
@Interceptors({InterceptorClass1.class, InterceptorClass2.class, InterceptorClass3.class})
public class xxxxxV1 extends HttpServlet implements xxxxx {...}
@SchemaValidation
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
@WebService(serviceName = "xxxxx",
        targetNamespace = "http://bla/BusinessServices/yyy/xxxxx/V1",
        wsdlLocation = "META-INF/wsdl/zzz/yyy/xxxxx/V1/xxxxxConcrete.wsdl",
        portName = "xxxxxPort",
        endpointInterface = "ble.businessservices.yyy.xxxxx.v1.xxxxx")
@Transactional(value= Transactional.TransactionFlowType.SUPPORTS, version= Transactional.Version.WSAT12)
@SecurityPolicies(@SecurityPolicy(uri = "my_policy"))
public class xxxxxV1 extends HttpServlet implements xxxxx {...}
@Stateless
@DeclareRoles("my-role")
@Interceptors({InterceptorClass1.class, InterceptorClass2.class, InterceptorClass3.class})
public class xxxxxV1Delegate {...}
我使用web.xml定义servlet别名,使用weblogic.xml文件定义要使用的上下文根

问题是,如果我离开@Stateless注释,部署时会出现以下异常:

Target state: deploy failed on Server services_server
javax.naming.NameAlreadyBoundException: my-webservice-name-impl-1.0.0.0-SNAPSHOT.war#MyWebServiceName is already bound; remaining name 'app/wsee'
    at weblogic.deploy.api.tools.deployer.Jsr88Operation.report(Jsr88Operation.java:547)
    at weblogic.deploy.api.tools.deployer.Deployer.perform(Deployer.java:140)
    at weblogic.deploy.api.tools.deployer.Deployer.runBody(Deployer.java:88)
    at weblogic.utils.compiler.Tool.run(Tool.java:158)
    at weblogic.utils.compiler.Tool.run(Tool.java:115)
    at weblogic.Deployer.run(Deployer.java:74)
    ... 15 more
另一方面,如果我删除web.xml,我可以毫无错误地进行部署,但我的web服务的URL当然不是我想要定义的URL:它使用/
portName
/
serviceName
URL

而且,如果我删除@Stateless注释,我会得到所需的URL,但是拦截器会被忽略,这在逻辑上是不可接受的

我曾尝试使用
@Transactional
注释(参见上面的注释代码),但拦截器一直被忽略

有人知道我错过了什么吗?理想情况下,我会使用web.xml和@Transactional并进入拦截器


谢谢大家!

找到了一个解决方案,可以让一切按需运行:

webservice类现在具有以下注释:

@SchemaValidation
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
@WebService(serviceName = "xxxxx",
        targetNamespace = "http://bla/BusinessServices/yyy/xxxxx/V1",
        wsdlLocation = "META-INF/wsdl/zzz/yyy/xxxxx/V1/xxxxxConcrete.wsdl",
        portName = "xxxxxPort",
        endpointInterface = "ble.businessservices.yyy.xxxxx.v1.xxxxx")
//@Transactional(value= Transactional.TransactionFlowType.SUPPORTS, version= Transactional.Version.WSAT12)
@Stateless
@SecurityPolicies(@SecurityPolicy(uri = "my_policy"))
@DeclareRoles("my-role")
@Interceptors({InterceptorClass1.class, InterceptorClass2.class, InterceptorClass3.class})
public class xxxxxV1 extends HttpServlet implements xxxxx {...}
@SchemaValidation
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
@WebService(serviceName = "xxxxx",
        targetNamespace = "http://bla/BusinessServices/yyy/xxxxx/V1",
        wsdlLocation = "META-INF/wsdl/zzz/yyy/xxxxx/V1/xxxxxConcrete.wsdl",
        portName = "xxxxxPort",
        endpointInterface = "ble.businessservices.yyy.xxxxx.v1.xxxxx")
@Transactional(value= Transactional.TransactionFlowType.SUPPORTS, version= Transactional.Version.WSAT12)
@SecurityPolicies(@SecurityPolicy(uri = "my_policy"))
public class xxxxxV1 extends HttpServlet implements xxxxx {...}
@Stateless
@DeclareRoles("my-role")
@Interceptors({InterceptorClass1.class, InterceptorClass2.class, InterceptorClass3.class})
public class xxxxxV1Delegate {...}
然后,我使用带有以下注释的委托类xxxxx v1 delegate:

@SchemaValidation
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
@WebService(serviceName = "xxxxx",
        targetNamespace = "http://bla/BusinessServices/yyy/xxxxx/V1",
        wsdlLocation = "META-INF/wsdl/zzz/yyy/xxxxx/V1/xxxxxConcrete.wsdl",
        portName = "xxxxxPort",
        endpointInterface = "ble.businessservices.yyy.xxxxx.v1.xxxxx")
//@Transactional(value= Transactional.TransactionFlowType.SUPPORTS, version= Transactional.Version.WSAT12)
@Stateless
@SecurityPolicies(@SecurityPolicy(uri = "my_policy"))
@DeclareRoles("my-role")
@Interceptors({InterceptorClass1.class, InterceptorClass2.class, InterceptorClass3.class})
public class xxxxxV1 extends HttpServlet implements xxxxx {...}
@SchemaValidation
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
@WebService(serviceName = "xxxxx",
        targetNamespace = "http://bla/BusinessServices/yyy/xxxxx/V1",
        wsdlLocation = "META-INF/wsdl/zzz/yyy/xxxxx/V1/xxxxxConcrete.wsdl",
        portName = "xxxxxPort",
        endpointInterface = "ble.businessservices.yyy.xxxxx.v1.xxxxx")
@Transactional(value= Transactional.TransactionFlowType.SUPPORTS, version= Transactional.Version.WSAT12)
@SecurityPolicies(@SecurityPolicy(uri = "my_policy"))
public class xxxxxV1 extends HttpServlet implements xxxxx {...}
@Stateless
@DeclareRoles("my-role")
@Interceptors({InterceptorClass1.class, InterceptorClass2.class, InterceptorClass3.class})
public class xxxxxV1Delegate {...}
在这个类中,所有的实现都完成了(基本上是复制粘贴webservice类中的内容并删除
@Override
s)

webservice类将注入一个
xxxxx v1委托
,并包含所有
@Override
方法。每个方法只调用委托类中完全相同的方法