Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassCastException when casting to home interface

 
Rogerio Kioshi
Ranch Hand
Posts: 690
  • Mark post as helpful
  • send pies
  • 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
 
Ashwini Kumar Sharma
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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: 690
  • Mark post as helpful
  • send pies
  • 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: 690
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic