It is perfectly ok to share classes, such as primary key and bean, between
different type of EJBs; just make sure your deployment descriptor is written
up correctly.
What does your deployment descriptor look like? It should have two sets of
bean descriptors, one for each set of EJBObject/EJBHome... For the sound of
your CCE, I suspect you are only deploying one set and attempting to cast it
to another.
Gene Chuang
Join kiko.com!
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
To: [EMAIL PROTECTED]
Sent: 1/23/01 6:46 PM
Subject: One bean class + two home/remote interface pairs = deployment
problem
Let's say I have a single stateless session bean class, with three
public methods (aside from those in the SessionBean interface):
public void methodA();
public void methodB();
public void methodC();
I want to deploy this class as behind two remote interfaces. (Never
mind why, let's just say I want to.) The first inteface exposes all
three methods to clients:
public interface FirstRemote extends EJBObject {
public void methodA() throws RemoteException;
public void methodB() throws RemoteException;
public void methodC() throws RemoteException;
}
The second exposes only methodC() to clients:
public interface SecondRemote extends EJBObject {
public void methodC() throws RemoteExeption;
}
(I should mention at this point that I tried having FirstRemote extend
SecondRemote but that didn't work either.)
For each remote interface, I create a corresponding home interface
public interface FirstHome extends EJBHome {
public FirstRemote create()
throws RemoteException, CreateException;
}
public interface SecondHome extends EJBHome {
public SecondRemote create()
throws RemoteException, CreateException;
}
Using Sun's J2EE RI server' deploytool, I configure the bean class as
the two different bean types, bound to two different JNDI names. So
far so good. When I go to deploy the app on the J2EE RI Server, it
successfully compiles the stubs and skels, and even creates the jar
files, but when the server is trying to "load the jars" (whatever that
means) it throws a ClassCastException. I added some debugging code to
the RI source code (Sorry Sun, I hope you don't mind!) and found that
it's actually some call inside PortableRemoteObject.narrow(Object
from, Class to) that's failing, and it's using a ClassCastException to
report the problem.
Anyway, I suspect that this is just the way the J2EE RI server is
written; I think that for every bean class it only expects to generate
EJBObject code for one EJBObject. My question is, is what I'm trying
to do explicitly forbidden or discouraged in EJB? Has anyone
sucessfully done what I'm trying to do? If so, what container were you
using?
========================================================================
===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".