Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB and servlet question....  RSS feed

 
Chuck Meduri
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a servlet through which I am making calls to a EJB.
My home interface has a function 'findAllRecords' which returns an enumeration of PrimaryKeys. I am able to 'lookup' my home interface, call the 'findAllRecords' function on my home interface. When I get the enumeration, I also am sure that I have records in that enumeration. When I hop through the enumeration using next element - from what I read in the Haefel book, I am supposed to get the RemoteInterface of my bean.
My problem is that I am getting a ClassCastException 'org.omg.stub.javax.ejb._EJBObject_Stub' when I get the next element from the enumeration.
I am currently using EJB1.1, VisualAge For java and Websphere Application Server.
Can anyone help me understand why I am getting this Exception and how can I solve this problem?
Thanks in advance,
Chuck
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The EJB Spec requires that when you retrieve an element from an enumeration resulting from a finder method that you use PortableRemoteObject.narrow() to narrow it down to the appropriate type.
So:

Kyle
 
Chuck Meduri
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kyle,
Thanks for the info. That worked for me.
But I thought that narrow was to be used in EJB 1.0 and not in EJB1.1.
Chuck
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chuck Meduri:
Hi Kyle,
Thanks for the info. That worked for me.
But I thought that narrow was to be used in EJB 1.0 and not in EJB1.1.
Chuck
You've got it backwards. EJB 1.1 uses RMI over IIOP therefore you must use narrow.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!