简体   繁体   中英

Remote EJB injection on different JVM/Servers on WebLogic

There are two ear applications on different WebLogic servers:

1) app1.ear

2) app2.ear

The problem is how can i inject the bean defined in app2.ear into bean defined in app1.ear? Should i write configuration in ejb-jar.xml and weblogic-jar.xml? If yes, how?

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

@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:

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. Then you can lookup your remote bean from that server as local bean. Try use JNDI lookup, not @EJB injection.

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