有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Weblogic 14c webservicedescriptionname在weblogicwebservices中不是唯一的

我使用以下注释将无状态ejb公开为web服务:

@WebService(
    name = "MyServicePort",
    portName = "MyServicePort",
    serviceName = "MyService",
)
@SOAPBinding(
    style = SOAPBinding.Style.RPC
)
@Stateless(mappedName="MyServiceEJB", name = "MyServiceEJB")
public class MyServiceBean {

为了在weblogic中定义上下文根,我在weblogic webservices中定义了web服务。xml部署描述符如下所示:

<weblogic-webservices
    xmlns="http://xmlns.oracle.com/weblogic/weblogic-webservices"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-webservices http://xmlns.oracle.com/weblogic/weblogic-webservices/1.1/weblogic-webservices.xsd">
    <webservice-description>
        <webservice-description-name>MyService</webservice-description-name>
        <port-component>
            <port-component-name>MyServicePort</port-component-name>
            <service-endpoint-address>
                <webservice-contextpath>/mycontext</webservice-contextpath>
                <webservice-serviceuri>/myservice</webservice-serviceuri>
            </service-endpoint-address>
        </port-component>
    </webservice-description>
</weblogic-webservices>

然而,weblogic在部署时抛出以下错误:

[ERROR] weblogic.wsee.ws.WsException: Error encountered while deploying WebService module 'myservice-ejb.jar'.
In weblogic-webservices.xml, webservice-description-name MyService is not unique within weblogic-webservices

知道我做错了什么吗?这是我的web应用程序中唯一的bean/服务,在weblogic(本地实例)中没有部署其他应用程序


共 (1) 个答案

  1. # 1 楼答案

    我可以通过将包含以下内容的webservices.xml放入META-INF文件夹(weblogic webservices.xml旁边)来解决这个问题

    <webservices xmlns="http://xmlns.jcp.org/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/javaee_web_services_1_4.xsd"
        version="1.4">
        <display-name>MyService</display-name>
        <webservice-description>
            <webservice-description-name>MyService</webservice-description-name>
            <port-component>
                <port-component-name>MyServicePort</port-component-name>
                <wsdl-port xmlns:tns="http://schemas.mycompany.com/webservices/MyService">tns:MyServicePort</wsdl-port>
                <service-endpoint-interface>mypackage.MyServiceBean</service-endpoint-interface>
                <service-impl-bean>
                    <ejb-link>MyServiceEJB</ejb-link>
                </service-impl-bean>
            </port-component>
        </webservice-description>
    </webservices>
    

    希望它能帮助面临同样挑战的人