• 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 when casting to home interface

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

I have the following code on my Delegate class:


I get a ClassCastException on





Debugging code in Eclipse I see that "initContext.lookup(JNDIName)" is an object type "_RecursoHome_Stub". So the error should't happen, isn't it?


I use Sun One Appication Server 7, Struts and EJB. The application structure is the same as it was in JBoss, on which worked fine.

Follwing the contents of ejb-jar.xml, sun-ejb-jar.xml, sun-web.xml and web.xml:

ejb-jar.xml:



sun-ejb-jar.xml:




sun-web.xml:

web.xml:




Thanks in advance
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am not sure if it works..but try doing a explicit type cast of the object returned by initialContext into your Remote Home Interface.

User PortableRemoteObject.narrow() and check if it still gives the same exception.

Ashwini
 
Rogerio Kioshi
Ranch Hand
Posts: 701
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

Tried to do:



But the ClassCastException still happens. Any other idea?


Following the complete class code:

[ June 07, 2006: Message edited by: Oscar Kinto ]
 
Rogerio Kioshi
Ranch Hand
Posts: 701
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've solved the problem! The packaging structure used in JBoss does not work at SunOne.
I put the remote and bean classes in the same package (ejb), and put this at ejb jar.
reply
    Bookmark Topic Watch Topic
  • New Topic