I would update your EJB class to look like this:
@Stateless(name="DataAccessBean", mappedName="ejb/DataAccessBean") @Remote(DataAccessRemote.class) @Local(DataAccessLocal.class) public class DataAccess implements DataAccessLocal, DataAccessRemote { ... }
Search for EJBs from a class deployed in a single EAR (using the local interface):
InitialContext ctx = new InitialContext(); //if not in WebLogic container then you need to add URL and credentials. // use <MAPPED_NAME> Objet obj = ctx.lookup("java:comp/env/ejb/DataAccessBean");
EJB injection is usually preferred, and you can do it like this:
@EJB(name="DataAccessBean") DataAccessLocal myDataAccessBean;
If you are trying to use EJB remotely, you will need to use the remote interface and the following JNDI name:
DataAccessBean#<package>.DataAccessRemote
source share