gpt4 book ai didi

java - JBoss AS 7 : how to make independant deployment of EJB and dependent WAR?

转载 作者:行者123 更新时间:2023-12-04 05:50:13 27 4
gpt4 key购买 nike

我有一个包含一个 EJB ( mwf_ejb.jar ) 和一个 WAR ( mwf_web.war ) 的应用程序。如果我将它们打包在同一个 EAR 中,则一切正常。有没有办法先部署 EJB,然后部署 WAR ?

如果我尝试,我的 EJB JAR 部署得很好,但是当我部署我的 WAR 时,我收到以下错误(在 JBoss AS 7.1.1 中):

MSC00001: Failed to start service jboss.deployment.unit."mwf_web.war".STRUCTURE:           org.jboss.msc.service.StartException in service jboss.deployment.unit."mwf_web.war".STRUCTURE: Failed to process phase STRUCTURE of deployment "mwf_web.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_31]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]
Caused by: java.lang.IllegalArgumentException: Given parent is not an ancestor of this virtual file
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:116)
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122)
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122)
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122)
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122)
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122)
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122)
at org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:110)
at org.jboss.as.server.deployment.module.ManifestClassPathProcessor.createAdditionalModule(ManifestClassPathProcessor.java:193) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.module.ManifestClassPathProcessor.handlingExistingClassPathEntry(ManifestClassPathProcessor.java:185) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.module.ManifestClassPathProcessor.deploy(ManifestClassPathProcessor.java:160) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more

在 META-INF/MANIFEST.MF 中,我添加了“Class-Path”语句,以标准方式定义依赖项:
Manifest-Version: 1.0
Dependencies: org.apache.log4j
Class-Path: mwf_ejb.jar

最佳答案

我终于设法让它工作,这个 MANIFEST.MF 文件:

Manifest-Version: 1.0
Dependencies: org.apache.log4j, deployment.mwf_ejb.jar

另外在我的 中添加了一个查找属性@EJB 注释(原来是空白的:@EJB):
@EJB(lookup="java:global/mwf_ejb/UserManager")

但是,我认为 deployment.前缀适用于 JBoss,但不适用于其他应用程序服务器。

关于java - JBoss AS 7 : how to make independant deployment of EJB and dependent WAR?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10152546/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com