when i am trying to get local reference of my bean from another bean , i am getting naming exception in the look up.Is getting local reference legal from another bean , if yes then how it should be done.
thanx
kapil
-
EJB local reference (3 messages)
- Posted by: kapil jaiswal
- Posted on: May 18 2003 13:14 EDT
Threaded Messages (3)
- EJB local reference by Bert Depaz on May 19 2003 02:35 EDT
- vendor by ohad assulin on May 19 2003 03:28 EDT
- EJB local reference by Preeti Ramesh on May 19 2003 09:41 EDT
-
EJB local reference[ Go to top ]
- Posted by: Bert Depaz
- Posted on: May 19 2003 02:35 EDT
- in response to kapil jaiswal
Are you running both beans in the same jar-file ?
I believe you can only use the local interface to reference a bean if both are in the same jar file.
Hope this helps -
vendor[ Go to top ]
- Posted by: ohad assulin
- Posted on: May 19 2003 03:28 EDT
- in response to kapil jaiswal
which vendor do you use? -
EJB local reference[ Go to top ]
- Posted by: Preeti Ramesh
- Posted on: May 19 2003 09:41 EDT
- in response to kapil jaiswal
Actually Bert, they do not need to be in the same jar file.
As per EJB 2.0
For a client to call the Local interface, they must be running in the same JVM as the JVM that the EJB exists in. This means that not only an EJB can call a local EJB , Servlets or JSPs can also call the EJB via it's local interface if they are packaged together as part of same application.
You can check the ejb-jar.xml deployment descriptor. It shud read something like this:
<entity>
<ejb-name>Emp</ejb-name>
<local-home>ejb.cmplocal.EmpHome</local-home>
<local>ejb.cmplocal.Emp</local>
<ejb-class>ejb.cmplocal.EmpBean</ejb-class>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Emp</abstract-schema-name>
.
.
.
Also in the lookup for local beans, we do not have to use the PortableRemoteObject. The lookup shud be something like:
try
{
Context ctx = new InitialContext();
Object o = ctx.lookup("java:comp/env/LocalEmp");
EmpHome empHome = (EmpHome)o;
return empHome.findByDeptno(getDeptno());
}
What is the exact exception you are getting?