0

I need to use jpa implementation of jboss-as-7.1.1 (hibernate) but when deploying the application, the server application shows this message:

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. 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:

<?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.

So, what's the deal? Does jboss 7 support non datasource connections? What could be the problem?

Daniel Calderon Mori
  • 5,466
  • 6
  • 26
  • 36

1 Answers1

0

JBoss 7 does not ship with the database drivers included so Oracle or MySQL etc.

You need to create a JBoss Module for them and add it to you JBoss 7 installation. See the answers to jboss 7 oracle datasource configuration

Then you need to add a dependency to the oracle db module from your WAR application. This can be done using a jboss-dependency.xml file or a MANIFEST.MF file. see Best Practice for loading 3rd party JARs in JBoss AS7 standalone deployment? for details

Community
  • 1
  • 1
ozOli
  • 1,414
  • 1
  • 18
  • 26