• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

using ejb reference dynamicly

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello
I use ejb in order to modelise other ejb.
so i create an instance of an ejb in an other
ejb wich is not in the same application.
when the method narow is thrown i catch a
Cast exception.
if i put manually a reference i have no exception
but i lost the dynamicity?
did you have the same problem?
what is the solution?
(excuse me for my bad english)
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

if i put manually a reference i have no exception
but i lost the dynamicity?


I havent understood. Can you please explain?
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by marc de toutophone:
when the method narow is thrown i catch a
Cast exception.
if i put manually a reference i have no exception
but i lost the dynamicity?


I think what you're saying is that you need to use the EJB's interface in order to narrow the remote stub, but then you are hard-coding the EJB. Is this correct?
If so, you could pass in the EJB's interface's class as a parameter or make it a configuration item for use with Class.forName().
 
marc de toutophone
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes i uses forName() to modelise the class of the remote interface
but the ejb is deployed on an other application server and so
i use an other context where i do the lookup.
the lookup return the well class , forname also
but narrow can't cast the 2 class.
if i deploy on the same application server and so i have
the same context, narrow dont send an exception
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic