Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41073
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
You showed up just in time for the waffles! And this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic