This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

legal RMI-IIOP types?  RSS feed

 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

I have an entity bean finder method which returns a collection. My entity bean is implemented with local interfaces. I want to pass the results of the finder to my remote client and because Collection is not serializable, I loaded the collection into an ArrayList and tried to pass this (I do this via a remote session bean). I get a CORBA_BAD_PARAM: message and something in the stack trace suggesting NotSerializableForCorba. See below. I thought Collection was a legal RMI-IIOP type but the API docs suggested it was not serializable. ArrayList definitely is. Am I missing something here?

Simon

 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are the objects in the ArrayList serializable?
 
Ranch Hand
Posts: 289
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has managed to get me lost a little bit. I have an entity bean that successfully passes a Collection object to a remote client, a servlet. However, the runtime type inside the collection is an ArrayList but I pass it out as a Collection, I wonder if that is what is making the difference.
 
Simon Ingram
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The objects inside the collection are local component interface types from my entity bean. This is usually what multiple-row finders return. The collection would not go across the network and I assumed this was because collection is not serializable. ArrayList is, but it won't go either.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wahtever is put into the ArrayList must be serializable, so some conversion from the interface types looks necessary. If you convert to a wrapper such as Integer you are fine, if you need to use a non-built-in data type then it must be declared serializable.
 
Simon Ingram
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I were using the findByPrimaryKey(key) method on a local entity bean I would get back the local component interface type, which is also an EJBLocalObject for the particular instance of my bean defined by the key. I am using a multiple finder and get back a collection of EJBLocalObjects.
I was trying to pass this collection to a remote session bean and then pass the collection across the network to my client, who wants to call methods on the entity bean. Clearly this doesn't make sense. I can't use EJBLocalObjects as stubs! I now see my mistake, which is a conceptual one and may be of interest to the forum. I will have to encapsulate the data for each of the EJBLocalObjects retrieved from the entity bean and pass this data to the client and as you say Roger, this should probably be a serializable data holder. Then I should be OK. The idea underlying this exercise is that entity beans are fine grained components and should be deployed locally for performance purposes. Remote clients can then access entity beans via course grained (ideally stateless) session beans which move large chunks of data over the network. This approach (the SessionFacade design pattern) should yield a considerable performance advantage.
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!