Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ClassCastException at PortableRemoteObject.narrow... HELP ME!

843829Dec 17 2002 — edited Dec 18 2002
Hi folks!

That's my environment:
App.Server: JBoss 3.0
Deployment-Tool: deploytool from J2EE 1.3
Database: Oracle 8.0i

I got 4 different objects according to a customer: the customer-obj himself, address, bankAccount and contact.
When I try to create for ex. an Address with my client like this:
Object ref = jndiContext.lookup("AddressBean");
AddressHome home = (AddressHome) PortableRemoteObject.narrow(ref, AddressHome.class);
AddressRemote remote = home.create(id, customerId, addressData);
... all works great!

But I designed the tool with a CustomerAgent(a SessionBean), who should do all the creation of Customers, Addresses, BankAccounts and Contacts.
So in the client, I only create the customer and tell him to add/create those objects:
Object ref = jndiContext.lookup("CustomerAgent");
CustomerAgentHome custHome = (CustomerAgentHome) PortableRemoteObject.narrow(ref, CustomerAgentHome.class);
CustomerAgentRemote custRemote = custHome.create();
// here starts the object-creation...
custRemote.createCustomer(id, customerData);
custRemote.addAddressToCustomer(customerId, addressData);
...
If I try now in these methods just like createCustomer or addAddressToCustomer to create these objects in the database, I get the exception:
ClassCastException at PortableRemoteObject.narrow()...

Why does the creation work with the client, but not with the CustomerAgent?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2003
Added on Dec 17 2002
2 comments
118 views