繁体   English   中英

WebLogic上不同JVM /服务器上的远程EJB注入

[英]Remote EJB injection on different JVM/Servers on WebLogic

不同的WebLogic服务器上有两个Ear应用程序:

1)app1.ear

2)app2.ear

问题是如何将app2.ear中定义的bean注入app1.ear中定义的bean? 我应该在ejb-jar.xml和weblogic-jar.xml中编写配置吗? 如果是,怎么办?

我在app1部分上写了这样的东西(UserService在app2中定义):

<weblogic-enterprise-bean>
    <ejb-name>UserManagementServiceRemote</ejb-name>
    <ejb-reference-description>
        <ejb-ref-name>tadUserService</ejb-ref-name>
        <jndi-name>t3://192.168.137.99:7001/UserService#com.abc.remote.UserService</jndi-name>
    </ejb-reference-description>
</weblogic-enterprise-bean>

而在app1中,它是通过以下方式注入的:

@Stateless(name = "UserManagementService", mappedName = "UserManagementService")
public class UserManagementServiceImpl implements UserManagementServiceLocal, UserManagementServiceRemote, Serializable {

@EJB(name = "tadUserService")
private UserService tadUserService;
.
.
.

但这是行不通的。 WebLogic说:

Caused By: weblogic.application.naming.ReferenceResolutionException: [J2EE:160200]Error resolving ejb-ref "tadUserService" from module "tps-business-14.1.2.jar" of application "_appsdir_tps-ear-14.1.2_ear". The ejb-ref does not have an ejb-link and the JNDI name of the target bean has not been specified. Attempts to automatically link the ejb-ref to its target bean failed because no EJBs in the application were found to implement the "com.transwide.twadmin.business.uma.remote.UserService" interface. Link or map this ejb-ref to its target EJB and ensure the interfaces declared in the ejb-ref are correct.

任何帮助,将不胜感激。

您可以在WebLogic控制台中使用“服务”->“外部JNDI提供程序”菜单项,以将远程服务器JNDI区域添加到WebLogic中。 然后,您可以从该服务器中将远程bean查找为本地bean。 尝试使用JNDI查找,而不是@EJB注入。

暂无
暂无

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

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