简体   繁体   English

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

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

There are two ear applications on different WebLogic servers: 不同的WebLogic服务器上有两个Ear应用程序:

1) app1.ear 1)app1.ear

2) app2.ear 2)app2.ear

The problem is how can i inject the bean defined in app2.ear into bean defined in app1.ear? 问题是如何将app2.ear中定义的bean注入app1.ear中定义的bean? Should i write configuration in ejb-jar.xml and weblogic-jar.xml? 我应该在ejb-jar.xml和weblogic-jar.xml中编写配置吗? If yes, how? 如果是,怎么办?

I wrote somthing like this on app1 part (The UserService is defined in app2) : 我在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>

And in app1 it is injected this way: 而在app1中,它是通过以下方式注入的:

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

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

But it is not working. 但这是行不通的。 WebLogic says: 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.

Any help would be appreciated. 任何帮助,将不胜感激。

You can use the Services -> Foreign JNDI providers menu item into WebLogic console for adding remote server JNDI area into your WebLogic. 您可以在WebLogic控制台中使用“服务”->“外部JNDI提供程序”菜单项,以将远程服务器JNDI区域添加到WebLogic中。 Then you can lookup your remote bean from that server as local bean. 然后,您可以从该服务器中将远程bean查找为本地bean。 Try use JNDI lookup, not @EJB injection. 尝试使用JNDI查找,而不是@EJB注入。

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

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