我尝试了几个关于如何将数据库连接(mainly this one)添加到jboss的教程,似乎已经丢失了。
如果我错过了某些内容,请更正我的步骤:
我在standalone/configuration.xml
添加了以下说明:
<datasources>
<datasource module="org.postgresql" jndi-name="java:jboss/datasources/Postgres" pool-name="Postgres" enabled="true" use-java-context="true">
<connection-url>jdbc:postgresql://localhost:5432/postgres;DB_CLOSE_DELAY=-1</connection-url>
<driver>postgresDriver</driver>
<security>
<user-name>postgres</user-name>
<password>postgres</password>
</security>
</datasource>
<drivers>
<driver name="postgresDriver" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
我在org/postgres/main/
目录
...modules/system/layers/base/org/
目录
我移动了postgres-9.4.1208.jre6.jar
个文件。
我在org/postgres/main/
文件后面的module.xml
位置创建了
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.postgresql">
<resources>
<resource-root path="postgresql-9.4-1208.jre6.jar" />
</resources>
<dependencies>
<module name="javax.api" />
<module name="javax.transaction.api" />
</dependencies>
</module>
我的persistence.xml
看起来像是:
<persistence 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"
version="2.0">
<persistence-unit name="movie-unit">
<jta-data-source>java:jboss/datasources/Postgres</jta-data-source>
</persistence-unit>
</persistence>
然后我使用部署* .war:
启动服务器/usr/local/share/jboss/bin/standalone.sh
15:36:14,370 INFO [org.jboss.modules] (main) JBoss Modules version 1.2.2.Final-redhat-1
15:36:14,502 INFO [org.jboss.msc] (main) JBoss MSC version 1.0.4.GA-redhat-1
15:36:14,556 INFO [org.jboss.as] (MSC service thread 1-7) JBAS015899: JBoss EAP 6.1.1.GA (AS 7.2.1.Final-redhat-10) starting
15:36:15,188 INFO [org.xnio] (MSC service thread 1-5) XNIO Version 3.0.7.GA-redhat-1
15:36:15,190 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
15:36:15,192 INFO [org.xnio.nio] (MSC service thread 1-5) XNIO NIO Implementation Version 3.0.7.GA-redhat-1
15:36:15,198 INFO [org.jboss.remoting] (MSC service thread 1-5) JBoss Remoting version 3.2.16.GA-redhat-1
15:36:15,243 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 29) JBAS010280: Activating Infinispan subsystem.
15:36:15,267 INFO [org.jboss.as.connector.logging] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (IronJacamar 1.0.19.Final-redhat-2)
15:36:15,327 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 37) JBAS011800: Activating Naming Subsystem
15:36:15,328 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 25) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "postgresDriver")
]) - failure description: "JBAS010441: Failed to load module for driver [org.postgresql]"
请核实我的步骤并帮我弄清楚我的错误在哪里。