Re: Hibernate not finding Oracle driver - despite straight JDBC working

From: IINET (mjinteractive_at_iinet.net.au)
Date: 12/23/04


Date: Thu, 23 Dec 2004 11:58:49 +0800

Talking to myself a bit now, I know:

I have managed to get Hibernate working, but only using the driver class
property. I want it to work with my tomcat defined JNDI datasource and I am
expecting something like the following to work:

hibernate.connection.datasource = java:comp/env/jdbc/webApps
hibernate.connection.username = fedup
hibernate.connection.password = *****
My JNDI is set up correctly, I can connect using other hibernate options
(non jndi), I have tried many configurations over the last 2 days, and I can
only afford to plod on one more day before switching over to toplink (with
our jdeveloper/oracle license) as I have had success withing ten minutes
with using this product.

"IINET" <mjinteractive@iinet.net.au> wrote in message
news:41ca2ee2$0$7620$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
> Just an update:
> I can get it going now using a Driver_class property, but NOT with a
> datasource property. I want to use my datasource set up though.
>
> I have to say. the documentation for this stuff is very misleading and not
> at all clear. Even reading 'professional Hibernate" is very weak on set
> up. (Actually that whole book is a bit of a joke -there isn't an ounce of
> source code in there that would comiple and th etypos and grammar is the
> worst I have ever seen - and I have read a LOT of tech books!)
>
> Anyway, I am starting to see a few places I may be going wrong - for
> example having a driver_class AND a datasource property was likely not a
> clever thing to do!
>
> Getting closer....
> "IINET" <mjinteractive@iinet.net.au> wrote in message
> news:41ca24e9$0$7593$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
>> Sorry - heres my resource declareation in server.xml and the relavant
>> web.xml
>>
>> SERVER.XML
>>
>> <resource name="jdbc/webApps" auth="container"
>> type="javax.sql.DataSource">
>> <resourceParams>
>>
>> <paramter>
>> <name>driverClassName</name>
>> <value>oracle.jdbc.OracleDriver</value>
>> </paramter>
>>
>> <paramter>
>> <name>url</name>
>> <value>jdbc:oracle:thin:@localhost:1521:ORCL</value>
>> </paramter>
>>
>> <paramter>
>> <name>store</name>
>> <value></value>
>> </paramter>
>>
>> <paramter>
>> <name>store_password</name>
>> <value></value>
>> </paramter>
>>
>> <paramter>
>> <name>maxActive</name>
>> <value>20</value>
>> </paramter>
>>
>> <paramter>
>> <name>maxIdle</name>
>> <value>30000</value>
>> </paramter>
>>
>> <paramter>
>> <name>maxWait</name>
>> <value>100</value>
>> </paramter>
>>
>> </resourceParams>
>>
>> </resource>
>>
>>
>> WEB.XML
>>
>>
>> <res-ref-name>jdbc/webApps</res-ref-name>
>> <res-type>javax.sql.DataSource</res-type>
>> <res-auth>Container</res-auth>
>> </resource-ref>
>>
>>
>>
>>
>>
>> "IINET" <mjinteractive@iinet.net.au> wrote in message
>> news:41ca2459$0$7569$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
>>> Here is my config, which is in my classpath.
>>>
>>> <hibernate-configuration>
>>>
>>> <session-factory>
>>>
>>> <property
>>> name="connection.datasource">java:comp/env/jdbc/webApps</property>
>>> <property name="show_sql">true</property>
>>> <property
>>> name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
>>> <property
>>> name="connection.url">jdbc:oracle:thin:@localhost:1521:ORCL</property>
>>> <property
>>> name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
>>> <property name="connection.username">store</property>
>>> <property name="connection.password">******</property>
>>>
>>> <property
>>> name="transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
>>>
>>>
>>> <!-- Mapping files -->
>>> <mapping resource="Person.hbm.xml"/>
>>>
>>> </session-factory>
>>>
>>> </hibernate-configuration>
>>>
>>> The only other thing I should add is that I am using Tomcat via JBuilder
>>> and that it is running in embedded mode -that should have nothing to do
>>> with the price of cheese in china, thought I should mention it anyway.
>>>
>>> I have made sure I have DBCP, my Oracle driver etc in the tomcat global
>>> classpath (common/lib) and have tried it just in the context classpath.
>>>
>>> Thanks for your help so far guys, really appreciated.
>>> "Murray" <parps@SMAFFoffSPAMMER.optusnet.SPAMMAGE.com.au> wrote in
>>> message news:aRnyd.85114$K7.69283@news-server.bigpond.net.au...
>>>>
>>>> "IINET" <mjinteractive@iinet.net.au> wrote in message
>>>> news:41c991e3$0$14973$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
>>>>> tomcat 5 / hibernate 2 / oracle 10g
>>>>>
>>>>> - Could not obtain connection metadata
>>>>> org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
>>>>> of class '' for connect URL 'null'
>>>>>
>>>>>
>>>>> Been at this a few hours now - just cant get hibernate to work. I have
>>>>> my driver in the right place (web-inf/lib and also tried common/lib
>>>>> too), my config file and properties files all by the book. My tomcat
>>>>> JNDI resource is all set up right (its working with DBCP in its own
>>>>> right, so driver is working in a non hibernate situation)
>>>>>
>>>>> I have changed the sqlDialect property around a couple of time too -
>>>>> in case it had issue with the generic Oracle dialect and preffered the
>>>>> Oracle9 dialect.
>>>>>
>>>>> No luck - about to give up on Hibernate altogether (I am yet to see it
>>>>> work!)
>>>>> This issue seems to be suggesting my tomcat JNDI set up is
>>>>> incorrect -but its not! Its working just fine using straight JDBC
>>>>> lookups.
>>>>>
>>>>> Any help at all would be appreciated - even sympathy would do.
>>>>>
>>>>> Andles
>>>>
>>>> Can't really help you unless you provide your config files. I'm
>>>> currently running Hibernate with Oracle and have had no problems.
>>>>
>>>
>>>
>>
>>
>
>