Hello,

I have a scenario where I want to inject EJB B that has an interface that
extends EJBObject, in EJB A. When I run the OpenEJB container I get the
following error:

SEVERE - FAIL ... A:    @EJB mistakenly refers to a beans
javax.ejb.EJBObject interface openejbtest.BInterface.  Use the EJBHome
interface instead.
SEVERE - FAIL ... B:    javax.ejb.EJBObject interface declared as
<business-local>. Use <remote>openejbtest.BInterface</remote>

What should I do to fix this? Changing EJB B and its interface is not an
option.

Here is the listing of a simplified scenario:

*class A:*

package openejbtest;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class A implements AInterface {

    @EJB
    protected BInterface b;

    @Override
    public void methodA() {
    }
}

*interface AInterface:*

package openejbtest;


public interface AInterface {

    void methodA();

}

*class B:*

package openejbtest;

import java.rmi.RemoteException;

@Stateless
public class B implements BInterface {

    @EJB
    protected CInterface cEjb;

    @Overr aide
    public void methodB() {
    }

    @Override
    public EJBHome getEJBHome() throws RemoteException {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Handle getHandle() throws RemoteException {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Object getPrimaryKey() throws RemoteException {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public boolean isIdentical(EJBObject obj) throws RemoteException {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public void remove() throws RemoteException, RemoveException {
        // TODO Auto-generated method stub

    }

}
*
interface BInterface:*

package openejbtest;

import javax.ejb.EJBObject;

public interface BInterface extends EJBObject {
    public void methodB();
}

Best regards,
Miguel

-- 
Miguel Figueiredo
Software Developer
http://jaragua.dyndns.org

"I'm a pretty lazy person and am prepared to work quite hard in order to
avoid work."
-- Martin Fowler

Reply via email to