Jump to content
  • Advertisement
Sign in to follow this  
Toolmaker

Remote SessionBean in JBoss - RMI appears not to work

This topic is 3501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a little problem with some basic J2EE stuff. I want to create a simple 'enterprise' environment consisting of 3 JBoss servers. One of the servers runs the Servlet, a 2nd runs a Webservices and the third one runs a Remote SessionBean. However, it works perfectly once I put the WS and the bean on the same JBoss instance. The moment I move the SessionBean to the third server and add this in the code of the WS I get NamingException / NameNotFoundException. I run all servers from the commandline with run -b0.0.0.0. Any ideas on how to fix this? Partial stack trace:
12:46:27,915 ERROR [STDERR] Nov 22, 2008 12:46:27 PM ws.NewWebServiceImpl lookup
SessionBeanBean
SEVERE: exception caught
javax.naming.NamingException: Could not dereference object [Root exception is ja
vax.naming.NameNotFoundException: SessionBeanBean not bound]
        at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1215)

        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:758)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:774)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at ws.NewWebServiceImpl.lookupSessionBeanBean(NewWebServiceImpl.java:37)

        at ws.NewWebServiceImpl.Login(NewWebServiceImpl.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jboss.wsf.container.jboss42.InvocationHandlerJSE.invoke(Invocatio
nHandlerJSE.java:102)
        at org.jboss.wsf.container.jboss42.InvocationHandlerJAXRPC.invoke(Invoca
tionHandlerJAXRPC.java:57)
        at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpoin
tInvoker.java:221)
        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHan
dlerImpl.java:466)
        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHand
lerImpl.java:284)
        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl
.java:201)
        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(Request
HandlerImpl.java:134)
        at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java
:84)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
lter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
yAssociationValve.java:182)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
e.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC
onnectionValve.java:157)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:262)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
6)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.naming.NameNotFoundException: SessionBeanBean not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
        at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1209)

        ... 37 more
12:46:27,935 ERROR [SOAPFaultHelperJAXRPC] SOAP request exception
java.lang.RuntimeException: javax.naming.NamingException: Could not dereference
object [Root exception is javax.naming.NameNotFoundException: SessionBeanBean no
t bound]
        at ws.NewWebServiceImpl.lookupSessionBeanBean(NewWebServiceImpl.java:43)

        at ws.NewWebServiceImpl.Login(NewWebServiceImpl.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jboss.wsf.container.jboss42.InvocationHandlerJSE.invoke(Invocatio
nHandlerJSE.java:102)
        at org.jboss.wsf.container.jboss42.InvocationHandlerJAXRPC.invoke(Invoca
tionHandlerJAXRPC.java:57)
        at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpoin
tInvoker.java:221)
        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHan
dlerImpl.java:466)
        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHand
lerImpl.java:284)
        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl
.java:201)
        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(Request
HandlerImpl.java:134)
        at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java
:84)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
lter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
yAssociationValve.java:182)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
e.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC
onnectionValve.java:157)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:262)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
6)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.naming.NamingException: Could not dereference object [Root exce
ption is javax.naming.NameNotFoundException: SessionBeanBean not bound]
        at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1215)

        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:758)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:774)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at ws.NewWebServiceImpl.lookupSessionBeanBean(NewWebServiceImpl.java:37)

        ... 32 more
Caused by: javax.naming.NameNotFoundException: SessionBeanBean not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
        at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1209)

        ... 37 more


And the code of grabbing the Session Bean:
            Hashtable environment = new Hashtable();
            environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
            environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
            environment.put(Context.PROVIDER_URL, "jnp://TOOLMAKER:1099");
            Context c = new InitialContext(environment);
                        
            Object remote = c.lookup("java:comp/env/ejb/SessionBeanBean");
            SessionBeanRemoteHome rv = (SessionBeanRemoteHome) PortableRemoteObject.narrow(remote, SessionBeanRemoteHome.class);
            return rv.create();

Toolmaker

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!