Search This Blog

Monday, November 19, 2018

@EJB annotation on WebLogic 12 by default

When using the @EJB annotation, WebLogic 12 by default assigns the name to the bean

public class PoolOracleBean {
/** some code **/
and it can be access by the code:
InitialContext initialContext = new InitialContext();
Context context = (Context)initialContext.lookup("java:global/web");
PoolOracleBean pool = (PoolOracleBean)context.lookup("PoolOracleBean");
Connection connection = pool.getConnection();
to get a list of all annotated @EJB, in the console:
Environement --> Servers --> "server name" --> View JNDI Tree
there is java:global node with web sub-node