我需要使用JPA實現的jboss-AS-7.1.1(休眠),但在部署應用程序時,服務器應用程序顯示了這個消息:爲什麼不能jboss找到適合此網址的驅動程序?
Could not obtain connection to query metadata : No suitable driver found for jdbc:oracle:thin:@localhost:1521:xe
我加入ojdbc6罐子作爲一個全球性的模塊。事實上,服務器表明它是能夠找到驅動程序類的類路徑:
using driver [oracle.jdbc.OracleDriver] at URL [jdbc:oracle:thin:@localhost:1521:xe]
這是我的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 name="HBOService">
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
<property name="hibernate.connection.username" value="HBOWEB"/>
<property name="hibernate.connection.password" value="****"/>
</properties>
</persistence-unit>
</persistence>
更多信息:
通過我使用這個完全相同的參數的方式,創建了一個數據源,更新了我的persistence.xml以使用這個數據源並且它完美地工作。
那麼,這是怎麼回事? jboss 7是否支持非數據源連接?可能是什麼問題呢?
我做到了。你可以看到我在問題中添加了ojdbc6.jar。 –