简体   繁体   English

为什么jboss找不到适合该URL的驱动程序?

[英]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.

相关问题 尽管已部署Jboss-as7,但找不到oracle驱动程序 - Jboss-as7 can't find oracle driver despite it being deployed 驱动程序为什么无法在类中找到方法? - Why can't the driver find a method in a class? 为什么我不能打开JBoss vfs:/ URL? - Why can't I open a JBoss vfs:/ URL? 无法添加mysql驱动程序到jboss - Can't add mysql driver to jboss 未找到适合JBoss应用程序的MySQL驱动程序 - No suitable MySQL driver found for JBoss application 无法连接到MySQL数据库:找不到合适的驱动程序 - Can't connect to MySQL database: No suitable driver found 为什么我得到java.sql.SQLException:当url正确且驱动程序存在时,找不到合适的驱动程序? - Why am I getting java.sql.SQLException: No suitable driver found when the url is correct and driver is present? 当输入类型是接口且参数类型正在实现类时,Java为什么找不到合适的方法? - Why can't Java find a suitable method when the input types are interfaces and the parameter types are implementing classes? 无法找出 url 有什么问题 - 无法确定合适的驱动程序 class - Not able to find out what's wrong with url - Failed to determine a suitable driver class JBoss 7.1:找不到合适的驱动程序java:mysql - 无法打开连接 - JBoss 7.1: No suitable driver found java:mysql - could not open connection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM