简体   繁体   English

多个应用程序共享TomEE中的通用EJB JAR

[英]Multiple applications sharing common EJB JAR in TomEE

I have an EJB jar DetailsLookup.jar which needs to be shared by two consumer applications - VehicleMake.war and VehicleModel.war 我有一个EJB jar DetailsLookup.jar ,它需要由两个使用者应用程序共享VehicleMake.warVehicleModel.war

I have placed the EJB jar file under <catalina_base>/lib and both the war file under <catalina_base>/webapps 我将EJB jar文件放置在<catalina_base>/lib ,并将war文件都放置在<catalina_base>/webapps

When I deploy only one of the WAR files, the deployment is successful, but with 2 WAR files I get the error as below. 当我仅部署一个WAR文件时,部署成功,但是使用2个WAR文件时,出现以下错误。 It seems, TomEE is trying to deploy the EJB for every consumer application instead of deploying it only once 看来,TomEE正在尝试为每个消费者应用程序部署EJB,而不是仅部署一次。

Caused by: org.apache.openejb.DuplicateDeploymentIdException: Application cannot be deployed as it contains deployment-ids which are in use: app: D:\apache-tomcat\instance1\webapps\VehicleModel
    DetailsLookup
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:790)
    at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:756)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1308)
    ... 32 more

I have also noticed that when I deploy only VehicleMake.war , the JNDI name for my EJB has the application context path also appended (which says that the EJB is deployed per project and not common) 我还注意到,当我仅部署VehicleMake.war ,我的EJB的JNDI名称也附加了应用程序上下文路径(这表明EJB是按项目部署的,并不常见)。

Expected JNDI name: 预期的JNDI名称:

global/DetailsLookup!com.my.company.details.service.DetailsLookup 全局/DetailsLookup!com.my.company.details.service.DetailsLookup

Actual JNDI name: 实际的JNDI名称:

global/ VehicleMake /DetailsLookup!com.my.company.details.service.DetailsLookup 全局/ VehicleMake /DetailsLookup!com.my.company.details.service.DetailsLookup

Can anyone help me to identify what the issue is with deploying EJB and if I need to change any configurations to deploy it as a common EJB instead of application specific? 谁能帮助我确定部署EJB的问题,是否需要更改任何配置以将其部署为通用EJB而非特定于应用程序的问题?

In conf/system.properties , you can change the name of deployed artifacts to avoid collisions. conf/system.properties ,您可以更改已部署工件的名称,以避免发生冲突。

Try adding this line: 尝试添加以下行:

openejb.deploymentId.format = {appId}/{ejbJarId}/{ejbName}

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

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