[英]Why can't jboss find a suitable driver for this url?
I need to use jpa implementation of jboss-as-7.1.1 (hibernate) but when deploying the application, the server application shows this message: 我需要使用jboss-as-7.1.1(休眠)的jpa实现,但是在部署应用程序时,服务器应用程序显示以下消息:
Could not obtain connection to query metadata : No suitable driver found for jdbc:oracle:thin:@localhost:1521:xe
I added ojdbc6 jar as a global module. 我添加了ojdbc6 jar作为全局模块。 In fact, server indicates it is able to find the driver class in the class path:
实际上,服务器指示它能够在类路径中找到驱动程序类:
using driver [oracle.jdbc.OracleDriver] at URL [jdbc:oracle:thin:@localhost:1521:xe]
This is my persistence.xml just in case: 这是我的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>
More info: 更多信息:
By the way I used this exact same parameters, created a datasource, updated my persistence.xml to use this datasource and it worked perfectly. 顺便说一下,我使用了完全相同的参数,创建了一个数据源,更新了我的persistence.xml以使用该数据源,并且效果很好。
So, what's the deal? 那怎么办? Does jboss 7 support non datasource connections?
jboss 7是否支持非数据源连接? What could be the problem?
可能是什么问题呢?
JBoss 7 does not ship with the database drivers included so Oracle or MySQL etc. JBoss 7没有附带数据库驱动程序,因此没有Oracle或MySQL等。
You need to create a JBoss Module for them and add it to you JBoss 7 installation. 您需要为它们创建一个JBoss模块并将其添加到JBoss 7安装中。 See the answers to jboss 7 oracle datasource configuration
查看jboss 7 oracle数据源配置的答案
Then you need to add a dependency to the oracle db module from your WAR application. 然后,您需要从WAR应用程序向oracle db模块添加依赖项。 This can be done using a jboss-dependency.xml file or a MANIFEST.MF file.
可以使用jboss-dependency.xml文件或MANIFEST.MF文件来完成。 see Best Practice for loading 3rd party JARs in JBoss AS7 standalone deployment?
请参阅在JBoss AS7独立部署中加载第三方JAR的最佳实践? for details
详情
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.