将JAR部署为JBoss 7.1.1上的模块

时间:2015-02-26 15:13:30

标签: java jar jboss7.x jboss-modules

我在jboss上使用已部署的jar作为模块时遇到问题。

我知道我应该通过以下方式创建一个全局模块:创建JBOSS_HOME / modules的子文件夹,复制jar并创建module.xml文件,但这里http://blog.tier2consulting.com/2013/04/02/understanding-modules-in-jboss-enterprise-application-platform-6/以及更正式的https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Development_Guide/chap-Class_Loading_and_Modules.html我读,逐字,

Dynamic Modules are created and loaded by the application server for each JAR or WAR deployment (or subdeployment in an EAR). The name of a dynamic module is derived from the name of the deployed archive.

但是,当我部署我的JAR时,我只能在JBOSS日志文件中看到:

16:06:18,698 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "Test.jar" 16:06:18,964 INFO [org.jboss.as.server] (HttpManagementService-threads - 14) JBAS018559: Deployed "Test.jar"

而在我链接的第一个网站上的示例的日志文件中,还有一行,即:

Register module: Module "deployment.utils.jar:main" from Service Module Loader

它是仅在EAP 6上可用的还是可以在JBOSS AS 7.1.1-Final或JBOSS AS 7.1.1上实现这样的结果 - 最终你被迫使用文件夹JBOSS_HOME / modules?

1 个答案:

答案 0 :(得分:0)

行。我刚想通了。 JBOSS AS 7.1.1-Final只是没有将有关部署的任何内容写成模块,但它确实作为模块部署。 要在另一个项目中引用它作为依赖项,在MANIFEST.MF文件中,您必须添加Dependencies: deployment.Test.jar,就像引用全局模块但是预先挂起deployment并使用整个存档一样将名称命名为模块名称。

部署的jar不需要任何特定的MANIFEST文件,也不需要嵌入module.xml文件。