views:

292

answers:

1
public void runTest() throws Exception {
     InitialContext ctx = new InitialContext();
     ResourceManager bean = (ResourceManager) ctx.lookup("ejb/ResourceManagerJNDI");
     System.out.println(bean.DummyText());
}

Hello. So i'm trying to create an EJB application, and this is the test client for it. the JNDI lookup is successful but when calling the "DummyText" method, i get the following error:

javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
    java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB; nested exception is: 
    javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB (...)

This is how the bean class looks:

@Stateless(name="ResourceManager", mappedName="ejb/ResourceManagerJNDI")
@Remote
@Local
public class ResourceManagerBean implements ResourceManager
{
    @EJB
    private AccessDAO accessDAO;
    @EJB
    private ResourceDAO resourceDAO;
    @EJB 
    private DepartmentDAO departmentDAO;

    (list of methods)
}

Any advice will be greatly appreciated. Thank you.

+1  A: 

Here's my first thoughts. You should have something like

@Remote
public interface ResourceManagerSessionRemote {

    (list of methods)

}

Break your remote and local interfaces out

@Stateless(name="ResourceManager", mappedName="ejb/ResourceManagerJNDI")
public class ResourceManagerBean implements ResourceManagerSessionRemote
{
     @EJB
    private AccessDAO accessDAO;
    @EJB
    private ResourceDAO resourceDAO;
    @EJB 
    private DepartmentDAO departmentDAO;

    (list of methods)
}
Preston