• 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

ClassCastException while getting Home interface's reference

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

I tried a "Hello world using EJB and Servlet" program. I am getting "ClassCastException" on the line: "testSessionBean = (MyTestSessionHome)PortableRemoteObject.narrow(objref,MyTestSessionHome.class);".

testSessionBean is of home type as expected.

I tried a lot to get the program right but couldn't get it.

Analysis of "objref" shows, though it implements MyTestSessionHome, is not an instance of MyTestSessionHome (?), but it's an instance of EJBHome. Actually both must be true.

I am using JBoss server 4.0.4

Please reply urgently...

THANK YOU.
Lalit.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at Debug ClassCastExceptions in JBoss. Specifically the jmx-console method mentioned over there. Looks like you have packaged the home/remote/local interfaces of the bean in more than one archives.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic