我之前已经看过这个问题,但是我尝试了各种解决方案,但没有用。
基本上,我有两个EJB企业应用程序,需要相互通信。第一个是Web应用程序,第二个是搜索服务器 - 它们位于不同的开发服务器上,而不是位于同一个节点,单元或JVM中,尽管它们位于同一个物理盒上。
我正在通过IIOP进行JNDI查找,我使用的URL如下:
IIOP:// searchserver:2819
在我的hosts文件中,我将searchserver设置为127.0.0.1。我的搜索服务器的端口也绑定到此主机名。
但是,当Web应用程序(使用Spring btw)尝试查找搜索EJB时,它会因以下错误而失败。这让我很疯狂,当然服务器之间的这种通信应该相当简单。我检查了端口,它们是正确的。
我注意到异常说初始上下文是H00723Node03Cell / nodes / H00723Node03 / servers / server1,名称:ejb / com / hmv / dataaccess / ejb / hmvsearch / HMVSearchHome。这是Web应用服务器而不是搜索服务器。它是否正确?我怎样才能让Spring使用正确的上下文?
[08/06/10 17:14:28:655 BST] 00000028 SystemErr R org.springframework.remoting.RemoteLookupFailureException: Failed to locate remote EJB [ejb/com/hmv/dataaccess/ejb/hmvsearch/HMVSearchHome]; nested exception is javax.naming.NameNotFoundException: Context: H00723Node03Cell/nodes/H00723Node03/servers/server1, name: ejb/com/hmv/dataaccess/ejb/hmvsearch/HMVSearchHome: First component in name hmvsearch/HMVSearchHome not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:101)
at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invoke(AbstractRemoteSlsbInvokerInterceptor.java:140)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy7.doSearchByProductKeywordsForKiosk(Unknown Source)
at com.hmv.web.usecases.search.SearchUC.execute(SearchUC.java:128)
at com.hmv.web.actions.search.SearchAction.executeAction(SearchAction.java:129)
at com.hmv.web.actions.search.KioskSearchAction.executeAction(KioskSearchAction.java:37)
at com.hmv.web.actions.HMVAbstractAction.execute(HMVAbstractAction.java:123)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at com.hmv.web.controller.HMVActionServlet.process(HMVActionServlet.java:149)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:136)
at com.hmv.web.support.SessionFilter.doFilter(SessionFilter.java:137)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:670)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2933)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:221)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1912)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1462)
Caused by: javax.naming.NameNotFoundException: Context: H00723Node03Cell/nodes/H00723Node03/servers/server1, name: ejb/com/hmv/dataaccess/ejb/hmvsearch/HMVSearchHome: First component in name hmvsearch/HMVSearchHome not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
at com.ibm.ws.naming.jndicos.CNContextImpl.processNotFoundException(CNContextImpl.java:4392)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1752)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1707)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1412)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1290)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:145)
at javax.naming.InitialContext.lookup(InitialContext.java:361)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:132)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:130)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:155)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.lookup(AbstractRemoteSlsbInvokerInterceptor.java:98)
at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.getHome(AbstractSlsbInvokerInterceptor.java:143)
at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.create(AbstractSlsbInvokerInterceptor.java:172)
at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.newSessionBeanInstance(AbstractRemoteSlsbInvokerInterceptor.java:226)
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.getSessionBeanInstance(SimpleRemoteSlsbInvokerInterceptor.java:141)
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:97)
... 36 more
非常感谢您的帮助!
马克
P.S。这是ejb的SpringApplicationContext条目:
<bean id="hmvSearch"
class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">
<property name="jndiName" value="ejb/com/hmv/dataaccess/ejb/hmvsearch/HMVSearchHome" />
<property name="lookupHomeOnStartup" value="false" />
<property name="cacheHome" value="false" />
<property name="refreshHomeOnConnectFailure" value="true" />
<property name="businessInterface" value="com.hmv.dataaccess.ejb.hmvsearch.HMVSearch" />
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">com.ibm.websphere.naming.WsnInitialContextFactory</prop>
<prop key="com.ibm.websphere.naming.jndicache.cacheobject">none</prop>
<prop key="java.naming.provider.url">iiop://localhost:2819</prop>
</props>
</property>
</bean>
答案 0 :(得分:3)
我现在已经解决了这个问题。我不得不说,WebSphere是一个真正可怕的东西。作为旁白。
因此,我的机器名称的DNS为H00723.int.hmv.co.uk。我需要将端口绑定到搜索应用程序的该名称,然后更新spring应用程序上下文以使用它们。
为什么我不能简单地使用localhost和正确的端口是我感到困惑的事情。 WAS对同一物理IP上的多个实例感到困惑,其他应用服务器则没有。
很抱歉浪费时间和我自己回答的问题!如果你读过这个,谢谢花时间。
答案 1 :(得分:0)
这old URL表明完全合格的jndiname可以使用。
<value>cell/nodes/machineName/servers/server1/ejb/com/hmv/dataaccess/ejb/hmvsearch/HMVSearchHome</value>