I don't know if this is causing your problem, but the lookup call is suspect.
The way to lookup an EJB 1.1 bean is:

// Set your system properties accordingly

Context ctx = new InitialContext();
BaseEJBHome ejbHome = PortableRemoteObject.narrow(ctx.lookup("foo"),
BaseEJBHome.class);

Reason being that the Naming.lookup() is dependent on using rmiregistry for
naming service, which is not guaranteed.  In fact, jBoss does NOT use
rmiregistry, they use jnp.  The PortableRemoteObject stuff isn't actually
necessary for jBoss in particular, but any J2EE implementation that uses RMI
over IIOP will need it, instead of just doing a cast.


Lance Hale wrote:

> Hi folks,
>
> I am using JDK 1.3 on NT and the JBoss 2.0.PR3 distribution.  I am having
> finder method problems with my Entity Beans that use inheritance.
>
> The home interface on an entity bean we'll call BeanAHome extends a
> BaseEJBHome interface that in turn extends EJBHome.
> The remote interface on an entity bean we'll call BeanA extends a
> BaseEJBObject interface that in turn extends EJBObject.
>
> This is what the interfaces look like:
>
> public interface BaseEJBObject
>     extends EJBObject
> {
>     public int getType();
>     public BaseData getData();
> }
>
> public interface BeanA
>         extends BaseEJBObject
> {
>         // possible business methods
> }
>
> public interface BaseEJBHome
>     extends EJBHome
> {
>     public BaseEJBObject create(BaseData data)
>         throws RemoteException, CreateException;
>
>     public BaseEJBObject findByPrimaryKey(BaseKey key)
>         throws RemoteException, FinderException;
> }
>
> public interface BeanAHome
>         extends BaseEJBHome
> {
>         // possible finder methods
> }
>
> After the Bean has been successfully deployed, an attempt to obtain the
> remote interface throws a RemoteException.
> {
>   BaseEJBHome baseHome =
> (BaseEJBHome)Naming.lookupObjec("com.expressware.matex.entity.beana");
>   BaseEJBObject baseObject = baseHome.findByPrimaryKey(key);
> }
>
> The problem could be in EntityContainer.java on line 369.
>         if (!mi.getMethod().getReturnType().equals(getRemoteClass()))
> In this case getReturnType() returns the Class Object for BaseEJBObject,
> however I think the getRemoteClass() returns the Class Object for BeanA and
> since
> they are not equal, the function continues on to perform a mutiple find and
> gives the error shown further below. Shouldn't the check that determines
> whether to perform a multiple or single
> find honor the class hierarchy. In other words shoudn't it know that BeanA
> inherits from BaseEJBObject and hence call the Single Entity Finder.
> At least that was the way it was working with EJBoss 1.0 PR2.  Can somebody
> tell me if I am doing things right?  The stack trace is below.
>
> Thanks,
> Lance Hale
> ExpressWare
>
> [com.expressware.matex.entity.user] java.rmi.RemoteException: result of
> finder method is not a valid return type: class
> com.expressware.matex.business.entity.us
> er.UserKey
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.plugins.BMPPersistenceManager.findEntities(BMPPersistenceManag
> er.java, Compiled Code)
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.EntityContainer.find(EntityContainer.java:369)
> [com.expressware.matex.entity.user]     at
> java.lang.reflect.Method.invoke(Native Method)
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContaine
> r.java:586)
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySync
> hronizationInterceptor.java:147)
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInt
> erceptor.java:77)
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.plugins.TxInterceptor$RunInvokeHome.run(TxInterceptor.java:500
> )
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.plugins.TxInterceptor.runWithTransactions(TxInterceptor.java:2
> 89)
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.plugins.TxInterceptor.invokeHome(TxInterceptor.java:86)
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.jav
> a:75)
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java,
> Compiled Code)
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:308)
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContai
> nerInvoker.java:169)
> [com.expressware.matex.entity.user]     at
> org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContai
> nerInvoker.java:132)
> [com.expressware.matex.entity.user]     at
> java.lang.reflect.Method.invoke(Native Method)
> [com.expressware.matex.entity.user]     at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java, Compiled
> Code)
> [com.expressware.matex.entity.user]     at
> sun.rmi.transport.Transport$1.run(Transport.java, Compiled Code)
> [com.expressware.matex.entity.user]     at
> java.security.AccessController.doPrivileged(Native Method)
> [com.expressware.matex.entity.user]     at
> sun.rmi.transport.Transport.serviceCall(Transport.java, Compiled Code)
> [com.expressware.matex.entity.user]     at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:422)
> [com.expressware.matex.entity.user]     at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:6
> 34)
> [com.expressware.matex.entity.user]     at java.lang.Thread.run(Thread.java,
> Compiled Code)
>
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Problems?:           [EMAIL PROTECTED]



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to