JNDI not creating for EJB Local interfaces example
murali kankanala
Ranch Hand
Joined: Nov 15, 2004
Posts: 110
posted
0
Hi Friends,
I have created an EJB example with Local interfaces. My problem is its not creating a JNDI name inside JNDI tree.
Its not showing any issues when i start the weblogic server. Other Session beans are deplolyed properly.
@ Murali
1. Check if JNDI is created or not in your weblogic server
2. Use and cast it to CalculatorLocalHome then use that reference and call create method then you will get CalculatorLocal object then call your required method
When you want to get a session bean instance from a standalone-java-client, get it through a remote interface.
This is because, the standalone-java-client runs in one JVM instance and the web-app code in another JVM instance. If the client is a the web-client running in the same JVM, local interface should suffice.
Now i realized that Local EJB means that should be part the same JVM/inside same server ( i knew this basics for forgot - thanks for reminding me).
As you said i moved this look up code from my standalone program to the another EJB impl Bean i have written some test method in that bean impl and pasted this local interface look up code. There also its giving same exception
Vj Vjj
Greenhorn
Joined: Aug 11, 2010
Posts: 1
posted
0
Even I am getting the same exception:
My Directory structure is given in attachment
This is the code of clientBean.java which is accessing the EJB:
and finally the error while running the client code in ecclipse after deploying the jar on weblogic 8.1 server:
javax.naming.NameNotFoundException: Unable to resolve 'TestSessionBean' Resolved [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'TestSessionBean' Resolved ]; remaining name 'TestSessionBean'
at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:290)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:248)
at weblogic.jndi.internal.ServerNamingNode_816_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:375)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:363)
at javax.naming.InitialContext.lookup(Unknown Source)
at example.ClientBean.main(ClientBean.java:24)
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'TestSessionBean' Resolved
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:924)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:230)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:154)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:188)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:491)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:120)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:434)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:429)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)