[英]Unable to resolve data source dependencies in Jboss
I am trying to deploy a JEE web app on JBoss server through eclipse but i am unable to resolve a dependency error related to data sources. 我正在尝试通过eclipse在JBoss服务器上部署JEE Web应用程序,但是我无法解决与数据源相关的依赖错误。 Strange thing is when i am start deploying console shows this message
奇怪的是,当我开始部署控制台时显示此消息
JBAS014776: Newly corrected services:
service jboss.naming.context.java.jboss.datasources.AssetTrackerDS (no longer required)
But deployment fails with this error. 但是部署失败并显示此错误。
ERROR [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "AssetTracker.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"AssetTracker.war#AssetTracker\" is missing [jboss.naming.context.java.jboss.datasources.AssetTrackerDS]"]}
JBoss server is correctly configured with database, connection test shows positive result. JBoss服务器已正确配置数据库,连接测试显示出肯定的结果。
Data source configuration in standalone.xml standalone.xml中的数据源配置
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jta="true" jndi-name="java:jboss/datasource/AssetTrackerDS" pool-name="AssetTrackerDS" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:postgresql://localhost:5432/test</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>postgresql-9.4.1212.jre6.jar</driver>
<security>
<user-name>***</user-name>
<password>***</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
<background-validation>true</background-validation>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
</validation>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
persistence.xml persistence.xml中
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit transaction-type="JTA" name="AssetTracker">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/AssetTrackerDS</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="transaction.flush_before_completion" value="true" />
<property name="connection.pool_size" value="5" />
<property name="hibernate.format_sql" value="false"/>
</properties>
</persistence-unit>
</persistence>
I am using JBoss EAP 6.2 and Eclipse Neon. 我正在使用JBoss EAP 6.2和Eclipse Neon。
You have a spelling error: 您有拼写错误:
<datasource jta="true" jndi-name="java:jboss/datasource/AssetTrackerDS"
versus 与
<jta-data-source>java:jboss/datasources/AssetTrackerDS</jta-data-source>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.