JBoss AS 7:如何使EJB和依赖WAR独立部署? [英] JBoss AS 7 : how to make independant deployment of EJB and dependent WAR?

查看:273
本文介绍了JBoss AS 7:如何使EJB和依赖WAR独立部署?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序与一个EJB( mwf_ejb.jar )和一个WAR( mwf_web.war )。如果我把它们包装在同一个EAR中,一切都OK。有没有办法首先部署EJB,然后是WAR?



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

  MSC00001:无法启动服务jboss.deployment.unitmwf_web。 war.STRUCTURE:org.jboss.msc.service.StartException in service jboss.deployment.unit。mwf_web.war.STRUCTURE:无法处理阶段STRUCTURE部署mwf_web.war
在org.jboss .as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119)[jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
在org.jboss.msc.service .ServiceControllerImpl $ StartTask.startService(ServiceControllerImpl.java:1811)[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
在org.jboss.msc.service.ServiceControllerImpl $ StartTask.run (ServiceControllerImpl.java:1746)[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
在java.util.concurrent.ThreadPoolExecutor $ Worker.runTask(ThreadPoolExecutor.java:886)[ rt.jar:1.6.0_31]
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:908)[rt.jar:1.6.0_31]
在java.lang.Thread .run(Thread.java:662)[rt.jar:1.6.0_31]
导致:java.lang.IllegalArgumentException:给定父对象不是此虚拟文件的祖先
在org.jboss。 vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:116)
在org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122)
在org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile。 java:122)
在org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122)
在org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122)
在org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122)
在org.jboss.vfs.VirtualFile.getPathNameRelativeTo(VirtualFile.java:122)
在org.jboss.vfs.VirtualFile .getPathNameRelativeTo(VirtualFile.java:110)
在org.jboss.as.server.deployment.m odule.ManifestClassPathProcessor.createAdditionalModule(ManifestClassPathProcessor.java:193)[jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
在org.jboss.as.server.deployment.module。 ManifestClassPathProcessor.handlingExistingClassPathEntry(ManifestClassPathProcessor.java:185)[jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
在org.jboss.as.server.deployment.module.ManifestClassPathProcessor。 deploy(ManifestClassPathProcessor.java:160)[jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
在org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService。 java:113)[jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5更多


中,我添加了一个Class-Path语句,以标准方式定义依赖关系:

  Manifest-Version:1.0 
依赖关系:org.apache.log4j
类路径:mwf_ejb.jar


解决方案

p>我最后设法使其工作,这个 MANIFEST.MF 文件:

 版本:1.0 
依赖关系:org.apache.log4j,deployment.mwf_ejb.jar

Plus在我的 @EJB 注释中添加一个查找属性(原始空白:@EJB):

  @EJB(lookup =java:global / mwf_ejb / UserManager)

但是, code>部署。前缀对JBoss而言是确定的,但不适用于其他应用程序服务器。


I have an application with one EJB (mwf_ejb.jar) and a WAR (mwf_web.war). If I package them in the same EAR, everything is OK. Is there any way to deploy the EJB first, then the WAR ?

If I try it, my EJB JAR deploys well, but when I deploy my WAR, I get the following error (in 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

in the META-INF/MANIFEST.MF, I've added a "Class-Path" statement, to define dependency in the standard way:

Manifest-Version: 1.0
Dependencies: org.apache.log4j
Class-Path: mwf_ejb.jar

解决方案

I finaly manage to make it work, with this MANIFEST.MF file:

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

Plus adding, a lookup attribute in my @EJB annotations (which were originaly blank: @EJB):

@EJB(lookup="java:global/mwf_ejb/UserManager")

However, I think deployment. prefix is ok for JBoss, but not for other application servers.

这篇关于JBoss AS 7:如何使EJB和依赖WAR独立部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆