简体   繁体   中英

How to access EJB defined in one EAR from another EAR

Basically, I have a situation where I have to access EJB declared in a JAR within one EAR from WAR in another EAR. Both EARs are deployed to the same WebLogic managed server (same domain). No annotations are used for that EJB in Java code. In ejb-jar.xml it is defined as session stateless container bean. In WebLogic-ejb-jar.xml there is local-jndi-name specified. I tried to look-up this bean using InitialContext and get it LocalHome interface and from that - Home interface. No matter what I try to use as JNDI name in context lookup I get "javax.naming.NameNotFoundException: While trying to look up ". Also there are Local and LocalHome interfaces for that bean programmed in Java. What am I doing wrong?

You should be using Remote interfaces between ejbs in different ears. Some app servers may let you use Local interfaces between ears, but it's fraught with difficulty (eg classpath problems) and by far not the best idea.

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