如果将Jboss AS 7中的jdbc部署为Web应用程序,那么该模块名称是什么 [英] What's the module name if deploy jdbc in Jboss AS 7 as web application
问题描述
从此帖子从Jboss AS7开始,jdbc驱动程序能够作为常规应用程序部署。但是有一个问题是,其他应用程序是否能够引用这个jdbc jar?
From this post start from Jboss AS7 the jdbc driver is able to deploy as regular application. However a question is, how other application is able to refer to this jdbc jar?
这里是我尝试的,但它不工作
here is what I tried but it doesn't work
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
......
<deployment>
<dependencies>
<module name="ojdbc6.jar" />
</dependencies>
</deployment>
.....
</jboss-deployment-structure>
更新
部署ojdbc时。 jar有一部分日志从控制台:
UPDATE
When I deploy ojdbc.jar there is a section of log from console:
10:56:20,416 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "ojdbc6.jar"
10:56:21,487 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 11.2)
10:56:21,489 INFO [org.jboss.as.osgi] (MSC service thread 1-7) JBAS011907: Register module: Module "deployment.ojdbc6.jar:main" from Service Module Loader
10:56:21,499 INFO [org.jboss.as.server] (HttpManagementService-threads - 6) JBAS018559: Deployed "ojdbc6.jar"
根据日志jdbc模块的名称为 deployment.ojdbc6.jar:main
,但是在我更新jboss-deployment-structure.xml之后,
Per the log jdbc module is with name deployment.ojdbc6.jar:main
, but after I update jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
......
<deployment>
<dependencies>
<module name="deployment.ojdbc6.jar:main" />
</dependencies>
</deployment>
.....
</jboss-deployment-structure>
它仍然不起作用。以下消息:
it still does not work. with following message:
10:59:34,448 INFO [org.jboss.as.server] (HttpManagementService-threads - 7) JBAS015870: Deploy of deployment "MyApp.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"MyApp.war.war\".POST_MODULE Missing[JBAS014861: <one or more transitive dependencies>]","jboss.module.service.\"deployment.MyApp.war.war\".main Missing[jboss.module.spec.service.\"deployment.ojdbc6.jar:main\".main]"]}
10:59:35,198 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015877: Stopped deployment MyApp.war.war in 749ms
推荐答案
您可以通过以下方式引用其他部署中的jar:
You can reference the jars from other deployments in this way:
<module name="deployment.YourEarOrWar.YourJar.jar" />
其中部署是部署应用程序引用的常用前缀。
但是,对于像jdbc驱动程序的lib,我建议将其放在JBoss的模块文件夹中
Where deployment is the general prefix for a reference to your deployed apps. However, for a lib like a jdbc-driver I recommend to put it in the module-folder of the JBoss
<module xmlns="urn:jboss:module:1.1" name="driver.ojdbc">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
</module>
然后引用它
<module name="driver.ojdbc"/>
另请参见
https://community.jboss.org/thread/169894
和
http://www.mastertheboss.com/jboss-as-7/how-to -install-a-module-on-jboss-as-7
这篇关于如果将Jboss AS 7中的jdbc部署为Web应用程序,那么该模块名称是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!