• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Yet Another Remote Interface Lookup on glassfish problem :)

 
William Bellia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I have been going around lots of forums to figure out how to call a Remote interface in glassfish 3.1.

I have the following:

Stateless Bean:


Remote Intf:


Then, in a different package in eclipse I have the following client, which happens to be a Stateless Bean as well. Basically, I need this 'client' to reside in the same application server, but in a different package:


Whenever I call the client via a web service, which resides in the same package as the client (i.e p2 ) I am getting the following error:

<return>Lookup failed for 'java:global/p1/XbajtBean!p1.XbajtBeanRemote' in SerialContext </return>


Also,
note that when I make a jndi-list lookup on glassfish, I get the following:

java:global: com.sun.enterprise.naming.impl.TransientContext
p1: com.sun.enterprise.naming.impl.TransientContext


so, the JNDI name DOES exist, yet, glassfish is not finding it whenever a call is issued by the cient, which happens to be on the same app server, just a different package.
( I have tried using local interfaces, and still no avail )

Your help would be really apreciated, since I have been pondering on this for days.

Regards,
drg
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William, checkout this page, it contains the syntax to find the JNDI name of beans...
 
William Bellia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:William, checkout this page, it contains the syntax to find the JNDI name of beans...


Thanks Ankit for the reply.

However, p1 & p2 are totally different applications, therefore I have to use the java:global notation.
Moreover, my aim is to eventually call the Remote Interface from another remote application server,
but if I am unable to call remote interfaces within the same app server, then I reckon Im gonna hava a problem with that

Anyway, I did some further research and by doing the asadmin list-jndi-entries command I get the following:


java:global: com.sun.enterprise.naming.impl.TransientContext
com.sun.enterprise.container.common.spi.util.InjectionManager: com.sun.enterprise.container.common.impl.util.InjectionManagerImpl
jdbc: com.sun.enterprise.naming.impl.TransientContext
UserTransaction: com.sun.enterprise.transaction.TransactionNamingProxy$UserTransactionProxy
ejb: com.sun.enterprise.naming.impl.TransientContext
p1: com.sun.enterprise.naming.impl.TransientContext


So p1 is listed in the JNDI dir of my Glassfish.
In fact, when I perform


or


the program doesn't complain.

Also, further to that, by doing asadmin list-jndi-entries --context p1 I get the following:


XbajtBean__3_x_Internal_RemoteBusinessHome__: javax.naming.Reference
XbajtBean: javax.naming.Reference
XbajtBean#p1.XbajtBeanRemote: javax.naming.Reference


So, it seems my Bean and its Remote Interface are also listed in the JNDI dir under p1.

Yet, whenever I make a lookup call or etc,
I would get a Lookup Failed in Serial Context Exception.

Any further help would be greatly appreciated!

Thanks a lot
Will
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From your jndi output:
XbajtBean#p1.XbajtBeanRemote


And your code:

XbajtBeanRemote x = (XbajtBeanRemote)new InitialContext().lookup("java:global/p1/XbajtBean!p1.XbajtBeanRemote");


Shouldn't it be:



Notice the # instead of !
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikiran Pai wrote:

Notice the # instead of !


Which by the way, is contrary to what EJB3.1 global jndi name syntax mandates.
 
William Bellia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jaikiran for the reply.

Yes, I did try that too,
and still getting the Lookup Failed exception:

java.lang.String : "Lookup failed for 'java:global/p1/XbajtBean#p1.XbajtBeanRemote' in SerialContext "

Thanks,
Will
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the entire exception stacktrace?
 
William Bellia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikiran Pai wrote:Can you post the entire exception stacktrace?


Sure. Here it goes:
(Please note that the calling remote client consists of:
p2.XbajtWS which is a simple webservice which calls p2.XbajtCaller. XbajtCaller is basically the client stateless bean invoking the initial lookup)


[com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
javax.naming.InitialContext.lookup(InitialContext.java:409)
javax.naming.InitialContext.lookup(InitialContext.java:409)
p2.XbajtCaller.getResult(XbajtCaller.java:16)
p2.XbajtWS.wa(XbajtWS.java:12)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:616)
org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5243)
com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615)
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567)
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
sun.reflect.GeneratedMethodAccessor1125.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:616)
com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367)
com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5215)
com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5203)
com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:188)
$Proxy323.wa(Unknown Source)
sun.reflect.GeneratedMethodAccessor1124.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:616)
org.glassfish.webservices.InvokerImpl.invoke(InvokerImpl.java:78)
org.glassfish.webservices.EjbInvokerImpl.invoke(EjbInvokerImpl.java:78)
com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:95)
com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:112)
org.glassfish.webservices.MonitoringPipe.process(MonitoringPipe.java:138)
com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:112)
com.sun.xml.ws.tx.service.TxServerPipe.process(TxServerPipe.java:306)
com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:112)
com.sun.enterprise.security.webservices.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:195)
com.sun.enterprise.security.webservices.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:127)
com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:115)
com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:295)
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:515)
com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:285)
com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:143)
org.glassfish.webservices.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:116)
org.glassfish.webservices.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:87)
org.glassfish.webservices.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:196)
org.glassfish.webservices.EjbWebServiceServlet.service(EjbWebServiceServlet.java:127)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
com.sun.grizzly.http.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:195)
com.sun.grizzly.http.servlet.FilterChainImpl.invokeFilterChain(FilterChainImpl.java:139)
com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:376)
com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:329)
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
com.sun.grizzly.ContextTask.run(ContextTask.java:69)
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
java.lang.Thread.run(Thread.java:636)]
 
Pierluigi D'Amadio
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you deploy an artifact (for instance an ejb-jar module), Glassfish prints in the server.log file the portable JNDI namess and non portable JNDI names. Refer to this names if you want to be sure on the right name of your component.

Good luck,

Pierluigi

-------
Pierluigi D'Amadio
Solution Architect
Mobile + 39 338 2757148
Skype: pierluigi6532
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic