我是Wildfly和jpa的新手。
我将eclipselink版本2.7.3用于库
这是我的link,用于POM,持久性和独立文件
当我部署耳朵文件时,出现此错误:
{
"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.app.EnterpriseSPIN-ear.jdbc.digisign_db"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"EnterpriseSPIN-ear.ear#digisignPU\" is missing [jboss.naming.context.java.app.EnterpriseSPIN-ear.jdbc.digisign_db]"]
}
我的持久性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 name="digisignPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/digisign</jta-data-source>
<properties>
<property name="eclipselink.target-server" value="JBoss"/>
<property name="eclipselink.target-database" value="PostgreSQL"/>
<property name="eclipselink.deploy-on-startup" value="true"/>
<property name="eclipselink.jdbc.user" value="someuser"/>
<property name="eclipselink.jdbc.password" value="somepassword"/>
<property name="eclipselink.jdbc.driver" value="org.postgresql.Driver"/>
<property name="eclipselink.jdbc.url" value="jdbc:postgresql://192.168.182.7:5432/digisign_db"/>
<property name="eclipselink.ddl-generation" value="none"/>
</properties>
</persistence-unit>
</persistence>
我的独立xml
<datasources>
<datasource jta="true" jndi-name="java:jboss/datasources/digisign" pool-name="digisign" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://192.168.182.7:5432/digisign_db</connection-url>
<driver>postgresql</driver>
<security>
<user-name>someuser</user-name>
<password>somepassword</password>
</security>
</datasource>
<drivers>
<driver name="postgresql" module="org.postgresql">
<driver-class>org.postgresql.Driver</driver-class>
</driver>
</drivers>
</datasources>
这是我的Postgresql模块xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="org.postgresql">
<resources>
<resource-root path="postgresql-42.2.2.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
和这是我的eclipselink持久性模块xml
<module name="org.eclipse.persistence" xmlns="urn:jboss:module:1.5">
<properties>
<property name="jboss.api" value="public"/>
</properties>
<resources>
<resource-root path="jipijapa-eclipselink-14.0.1.Final.jar"/>
<resource-root path="eclipselink.jar">
<filter>
<exclude path="javax/**"/>
</filter>
</resource-root>
</resources>
<dependencies>
<module name="asm.asm"/>
<module name="javax.api"/>
<module name="javax.annotation.api"/>
<module name="javax.enterprise.api"/>
<module name="javax.persistence.api"/>
<module name="javax.transaction.api"/>
<module name="javax.validation.api"/>
<module name="javax.xml.bind.api"/>
<module name="javax.ws.rs.api"/>
<module name="org.antlr"/>
<module name="org.apache.commons.collections"/>
<module name="org.dom4j"/>
<module name="org.jboss.as.jpa.spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.vfs"/>
</dependencies>
我已经尝试了很多次,但是都没有成功。请帮忙!
答案 0 :(得分:0)
我有一个正在运行的项目(在Wildfly下运行),对于该项目,我不必在persistence.xml中定义的数据源中包括“ java:”前缀:
在standalone.xml中
<datasource jta="true" jndi-name="java:/jdbc/xxx">
在persistence.xml中
<persistence version="2.1" ...>
<persistence-unit name="myPU" >
...
<jta-data-source>jdbc/xxx</jta-data-source>
答案 1 :(得分:0)