Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error casting looked up ejb

 
Jeffrey Coleman
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just trying to get a working example up. I am using rad and running this on the built in websphere server version seven. The app that I am eventually going to be developing with EJBs will be using JEE5 so I cannot use the @EJB annotation outside of the container so I am learning how to do the lookup.

The error msg that I get is this:

Error 500: java.lang.ClassCastException: ejb.EJSLocal0SLHelloEJB_9fbc1047 incompatible with ejb.HelloEJB

Here is the code for the servelet



And here is the web.xml



This is the EJB



And here is the local interface



Any help would be much appreciated. Thanks in advance.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it work if you cast to HelloEJBLocal? The idea of the interfaces is to refer to them rather than bean implementation.
 
Jeffrey Coleman
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes that works. Thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic