File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes How to call Local Home of EJB2.1 from EJB3.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to call Local Home of EJB2.1 from EJB3.0" Watch "How to call Local Home of EJB2.1 from EJB3.0" New topic
Author

How to call Local Home of EJB2.1 from EJB3.0

Arvind Pratap
Greenhorn

Joined: Aug 06, 2010
Posts: 5
I am trying to call localhome of EJB2.1 from EJB 3.0.
But it retuns home interface while lookup, instead of localhome.
Anybody can help how to get localhome while calling from EJB3.0.
Code is loke this -

EJBLocalHome home = (EJBLocalHome) context.lookup(name);

It returns EJBHome instead of EJBLocalHome and throws classcastexeption.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Arvind,
Welcome to JavaRanch!

What JNDI name are you using? Is it the one that goes with the Home interface or Local Home interface?

Also, what server are you using? Some servers give the local home a name based on the home but not the same.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Arvind Pratap
Greenhorn

Joined: Aug 06, 2010
Posts: 5
Thanks for reply Jeanne...

I am using java:comp/env/ejb/AnalysisService JNDI name and JBOSS 4.2.3 server.

Code works fine if call is made from EJB2.1 to EJB2.1. I am using both EJB2.1 and EJB3.0 in project.
Problem is only when making call from EJB3.0 to EJB2.1.
Is there different way of lookup for getting Local home while calling from EJB3.0?
Anurag Bhatia
Greenhorn

Joined: May 12, 2009
Posts: 27
Hi Arvind,

Did you figure out any solution to the issue? I am having the same problem.

Try - http://docs.jboss.org/ejb3/docs/tutorial/1.0.7/html/EJB2.1_and_EJB3_references.html

--Anurag

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to call Local Home of EJB2.1 from EJB3.0