我正在尝试使用oracle 10g在jboss 7.1上配置数据源,但我有以下错误:
16:23:24,155 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (MSC service thread 1-4) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277)
...
Caused by: javax.resource.ResourceException: Wrong driver class [class oracle.jdbc.driver.OracleDriver] for this connection URL [jdbc:inetora:...:...:...?timestampToDate=true&streamstolob=true]
我在standalone.xml中的配置是:
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:/OracleDS" pool-name="OracleDS" use-java-context="true">
<connection-url><![CDATA[jdbc:inetora:...:...:...?timestampToDate=true&streamstolob=true]]></connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>5</max-pool-size>
</pool>
<security>
<user-name>user_name</user-name>
<password>password</password>
</security>
<timeout>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>
</timeout>
<validation>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"></exception-sorter>
</validation>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.ojdbc14">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
</driver>
</drivers>
</datasources>
</subsystem>
我的persistence.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<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_1_0.xsd"
version="1.0">
<persistence-unit name="defaultEntityManager" transaction-type="JTA">
<jta-data-source>java:/OracleDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
</properties>
</persistence-unit>
</persistence>
在JBoss modules /中,我添加了一个包含ojdbc14.jar和module.xml文件的com / oracle / ojdbc14 / main目录:
<module xmlns="urn:jboss:module:1.0" name="com.oracle.ojdbc14">
<resources>
<resource-root path="ojdbc14.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
我知道如何解决这个问题?
提前谢谢!
答案 0 :(得分:0)
您的连接网址在独立的xml中不正确。
它是:
<connection-url><![CDATA[jdbc:inetora:...:...:... timestampToDate=true&streamstolob=true]]></connection-url>
然而它应该是:
<connection-url>jdbc:oracle:thin:@//myhost:1521/myservicename