views:

391

answers:

2

I've seen this question asked before, but I've tried various solutions proposed, to no avail.

Essentially, I have two EJB enterprise applications, that need to communicate with one another. The first is a web application, the second is a search server - they are located on different development servers, not in the same node, cell, or JVM, although they are on the same physical box.

I'm doing the JNDI lookup via IIOP, and the URL I am using is as follows:

iiop://searchserver:2819

In my hosts file, I've set searchserver to 127.0.0.1. The ports for my search server are bound to this hostname too.

However, when the web app (that uses Spring btw) attempts to lookup the search EJB, it fails with the following error. This is driving me nuts, surely this kind of comms between the servers should be fairly simple to get working. I've checked the ports and they are correct.

I note that the exception says the initial context is H00723Node03Cell/nodes/H00723Node03/servers/server1, name: ejb/com/hmv/dataaccess/ejb/hmvsearch/HMVSearchHome. This is the web apps server NOT the search server. Is this correct? How can I get Spring to use the right context?

    [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

Many thanks for any assistance!

Marc

P.S. Here is the SpringApplicationContext entry for the ejb:

<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>
+1  A: 

I've now resolved this. WebSphere is truly hideous, I have to say, as an aside.

So, my machine name has a DNS of H00723.int.hmv.co.uk. I needed to bind the ports to that name for the search application, and then update the spring app context to use those.

Why I can't simply use localhost with the correct port is something I find puzzling. WAS gets confused with multiple instances on the same physical IP, in a way that other app servers don't.

Sorry for wasting peoples time with a question I answered myself! If you did read this, thanks for taking the time.

marc dauncey
Okay just saw your reply - ignore mine then
JoseK
It is not behaving strange. It uses something called as a reverse DNS look up. The parties (let's call them Server1 and Server2) should know each other in exactly the same way as they understand themselves. In your case, you are calling the server as 127.0.0.1 while the server thinks it is H00723.int.hmv.co.uk which does not match the same as 127.0.0.1Hope this clarifies
Manglu
A: 

This old URL suggests the fully qualified jndiname will work.

<value>cell/nodes/machineName/servers/server1/ejb/com/hmv/dataaccess/ejb/hmvsearch/HMVSearchHome</value>
JoseK