我使用以下注釋將我的無狀態 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.xml 部署描述符中定義了 web 服務,如下所示:
<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(本地實體)中沒有部署其他應用程式。
uj5u.com熱心網友回復:
我可以通過將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>
希望它可以幫助面臨同樣挑戰的人。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/318708.html
