简体   繁体   English

如何从另一个EAR访问一个EAR中定义的EJB

[英]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. 基本上,我不得不从一个EAR中的WAR访问一个EAR中的JAR中声明的EJB。 Both EARs are deployed to the same WebLogic managed server (same domain). 两个EAR都部署到相同的WebLogic受管服务器(相同的域)。 No annotations are used for that EJB in Java code. Java代码中没有对该EJB使用注释。 In ejb-jar.xml it is defined as session stateless container bean. 在ejb-jar.xml中,它被定义为会话无状态容器bean。 In WebLogic-ejb-jar.xml there is local-jndi-name specified. 在WebLogic-ejb-jar.xml中,指定了local-jndi-name。 I tried to look-up this bean using InitialContext and get it LocalHome interface and from that - Home interface. 我试图使用InitialContext查找此bean,并从它-Home接口获取它。 No matter what I try to use as JNDI name in context lookup I get "javax.naming.NameNotFoundException: While trying to look up ". 无论我尝试在上下文查找中用作JNDI名称是什么,我都会得到“ javax.naming.NameNotFoundException:尝试查找时”。 Also there are Local and LocalHome interfaces for that bean programmed in Java. 还有使用Java编程的那个bean的Local和LocalHome接口。 What am I doing wrong? 我究竟做错了什么?

You should be using Remote interfaces between ejbs in different ears. 您应该在不同耳朵的ejb之间使用远程接口。 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. 某些应用程序服务器可能允许您在耳朵之间使用本地接口,但是这充满了困难(例如,类路径问题),到目前为止并不是最好的主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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