繁体   English   中英

Websphere Web应用程序中Web服务的JNDI查找失败

[英]JNDI lookup of web service fails in Websphere web application

我正在尝试从在Websphere 7上运行的Web应用程序内调用SAP Web Service。

客户端是从WSDL生成的,我使用JNDI查找来找到服务。 查找失败,出现NameNotFoundException

web.xml:

<service-ref>
    <description>
    WSDL Service ZSDWebAddressPrinting</description>
    <service-ref-name>service/ZSDWebAddressPrinting</service-ref-name>
    <service-interface>sap_com.document.sap.soap.functions.mc_style.ZSDWebAddressPrinting_Service</service-interface>
    <wsdl-file>WEB-INF/wsdl/ZSDWebAddressPrinting.wsdl</wsdl-file>
    <jaxrpc-mapping-file>WEB-INF/ZSDWebAddressPrinting_mapping.xml</jaxrpc-mapping-file>
    <service-qname xmlns:pfx="urn:sap-com:document:sap:soap:functions:mc-style">
    pfx:ZSDWebAddressPrinting</service-qname>
    <port-component-ref>
        <service-endpoint-interface>sap_com.document.sap.soap.functions.mc_style.ZSDWebAddressPrinting_PortType</service-endpoint-interface>
    </port-component-ref>
</service-ref>

JNDI查找:

InitialContext ctx = new InitialContext();
return (Service)ctx.lookup("java:comp/env/service/ZSDWebAddressPrinting");

例外:

[10.12.14 10:24:03:645 CET] 00000024 SystemOut     O |2014-12-10 10:24:03,645|ERROR|r : 0|ws.WebServiceLocator.getService - Lookup of service reference with jndi name =  ZSDWebAddressPrinting failed !
javax.naming.NameNotFoundException: Name comp/env/service not found in context "java:".
    at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1837)
    at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1166)
    at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
    at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1235)
    at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:395)
    at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:221)
    at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:161)
    at javax.naming.InitialContext.lookup(InitialContext.java:436)
    at com.acme.ws.WebServiceLocator.getService(WebServiceLocator.java:26)

我已经使用dumpnamespace来显示所有名称,但是看不到ZSDWebAddressPrinting

有许多JDBC资源,这些资源也可以通过JNDI访问。 这些在转储中可见并且可以正常工作。

我在这里忘记了什么吗?

将类加载从PARENT_LAST更改为PARENT_FIRST有所帮助。 服务查找现在可以进行。

我不知道为什么这会对JNDI有所不同。 在两种情况下,JDBC查找均有效。

有人可以对此发表评论吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM