简体   繁体   中英

How to define own JNDI name for EJB in an ear

I have an ear which has ejb.jar , core.jar .

core.jar use lookup to find the bean at run time. Now the jndi path is mysystem-server-component-ear-0.0.1-SNAPSHOT/MyServiceBean/local which means <earname>/<beanname>/<localinterface>

I want to define JNDI like MyServiceBean/local . Where my MyServiceBean is the ejb bean and it use local interface.

I use EJB 3.1 without ejb-jar.xml and jboss.xml . All the wiring done through annotation .

How can I define my own JNDI name which I can lookup

Did you try @EJB(mappedName = "yourJndiName") ?

If your JNDI lookups are not working as expected, then you should always check your JNDI tree from within the administration frontend (should be somewhere in jmx-console/JBoss/service=JNDIView or similar). Sometimes the name of the remote interface, etc. is added to your JNDI name by your application server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM