Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Arvind Pratap
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Arvind Pratap
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic