2014-02-28 55 views
0

服務器上有不同的WebLogic服務器上的兩個耳朵應用:遠程EJB注入/ WebLogic上

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. 

任何幫助,將不勝感激。

回答

0

您可以在WebLogic控制檯中使用Services - > Foreign JNDI providers菜單項將遠程服務器JNDI區域添加到WebLogic中。然後,您可以從該服務器中查找遠程bean作爲本地bean。嘗試使用JNDI查找,而不是@EJB注入。

+0

但是這不可能與@EJB?因爲在jboss中使用ejb-jar.xml只使用jnp協議。我不能用t3或類似的東西來做到這一點嗎? – J3DI