我正在从Weblogic 11g迁移到12c,在部署过程中它失败并显示以下错误:
Caused by: weblogic.application.naming.ReferenceResolutionException: [J2EE:160199]Error resolving ejb-ref "ejb/BizRuleFacade" from module "BizAgi-ejb.jar" of application "BizAgi-ear-Weblogic". 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 multiple EJBs in the application were found to implement the "BizAgi.bpm.rules.entities.BizRuleFacade" interface, including BizAgi-war.war/BizRuleFacadeBean, BizAgi-ejb.jar/BizRuleFacadeBean. Specify a qualified ejb-link for this ejb-ref to indicate which EJB is the target of this ejb-ref.
我的web.xml文件如下所示:
<ejb-local-ref>
<ejb-ref-name>ejb/BAScopeLogFacade</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>BizAgi.PAL.historylog.entities.BAScopeLogFacade</local>
<ejb-link>BizAgi-ejb.jar#BAScopeLogFacadeBean</ejb-link>
</ejb-local-ref>
BizAgi-ejb.jar是耳内的一个模块(BizAgi-ear-Weblogic.ear)。
如何正确部署我的应用程序?
非常感谢大家,我终于找到了解决方案,只需从.war文件中删除/删除META-INF / MANIFEST.MF文件即可。这样,EJB不会被双重引用。
确保在部署中未多次加载相同的EJB。您可以使用weblogic控制台(AdminServer)并检查部署的EJB(通过单击部署概述中失败的部署旁边的小“+”符号)来检查这一点。
在我的情况下,我必须修复maven依赖项(通过将一个项目的一个依赖项设置为“提供”),以便它不会加载相同的EJB两次。
1.在Ear Pom.xml中添加以下依赖项
<dependency>
<groupId>com.example</groupId>
<artifactId>ejbModel</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
2.在模块中的耳朵pom.xml中添加ejb模块
<modules>
<ejbModule>
<groupId>com.example</groupId>
<artifactId>ejbModel</artifactId>
<bundleFileName>ejbModel-1.0-SNAPSHOT.jar</bundleFileName>
</ejbModule>
.......
</modules>
3.更改应用程序pom.xml中提供的ejbmodel依赖的范围
<dependency>
<groupId>com.example</groupId>
<artifactId>ejbModel</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
4.将ejbmodel应用程序的persistence.xml添加到资源文件夹