我正在使用一个WAR项目开发Web应用程序。它使用JPA并且有一个我需要配置为在 JBOSS 7 上运行的DataSource。数据库是 Oracle 。
我收到了这个错误:
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDB
我遵循了在Jboss上使用dataSource的说明。所以我有这些配置:
{JBOSS_HOME} /modules/com/oracle/ojdbc6/main/module.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.oracle.ojdbc6">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api" />
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
ojdbc6.jar存在且名称正确。
standalone.xml
<datasources>
<datasource jndi-name="java:jboss/jdbc/batchAdminDB" pool-name="batchAdminDB" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:@HOST:PORT/xe</connection-url>
<driver>oracle</driver>
<security>
<user-name>USER</user-name>
<password>PASSW</password>
</security>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.ojdbc6">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
在申请表上: META-INF /的的persistence.xml:
<persistence-unit name="batchAdminEM" transaction-type="JTA">
<jta-data-source>java:jboss/jdbc/batchAdminDB</jta-data-source>
<class>...</class>
...</persistence-unit>
当Jboss启动时(没有应用程序)它会读取(绑定)数据源。当我尝试部署应用程序时出现错误,它不会运行。
更多StackTrace帮助:
15:57:46,888 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/jdbc/batchAdminDB]
...
15:57:52,356 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-2) HHH000204: Processing PersistenceUnitInfo [
name: batchAdminEM
...]
15:57:53,649 ERROR [org.jboss.as] (MSC service thread 1-1) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 13255ms - Started 325 of 568 services (165 services failed or missing dependencies, 76 services are passive or on-demand)
15:57:53,861 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "BatchAdmin.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.BatchAdmin.BatchAdmin.env.jboss.jdbc.batchAdminDBjboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDBMissing[jboss.naming.context.java.module.BatchAdmin.BatchAdmin.env.jboss.jdbc.batchAdminDBjboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDB]"]}
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDB (missing) dependents: [service jboss.naming.context.java.module.BatchAdmin.BatchAdmin.env.jboss.jdbc.batchAdminDB]
15:57:53,934 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.BatchAdmin.BatchAdmin.env.jboss.jdbc.batchAdminDBjboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDBMissing[jboss.naming.context.java.module.BatchAdmin.BatchAdmin.env.jboss.jdbc.batchAdminDBjboss.naming.context.java.jboss.resources.jboss.jdbc.batchAdminDB]"]}}}
答案 0 :(得分:0)
您使用了错误的连接网址格式。使用xe
作为SID,您必须使用:
jdbc:oracle:thin:@HOST:PORT:xe
或
jdbc:oracle:thin:@//HOST:PORT/xe
查看here了解详情。
ADD
您还必须以这种方式更改module.xml文件中的一行:
<module xmlns="urn:jboss:module:1.0" name="com.oracle.ojdbc6">
答案 1 :(得分:0)
很长一段时间后,我发现了问题所在。
web.xml 包含以前在Tomcat上使用的配置。
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jboss/jdbc/batchAdminDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
这种配置很可能让Jboss感到困惑。没有必要了。
解决方案:
只需评论或删除该部分(资源参考)。
一个有用的链接(葡萄牙语):
http://www.guj.com.br/java/256103-resolvido-seam-3--hibernate-4--jbossas7-erro-de-datasource