Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / December 2004

Tip: Looking for answers? Try searching our database.

Hibernate not finding Oracle driver - despite straight JDBC working

Thread view: 
IINET - 22 Dec 2004 15:25 GMT
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
Murray - 22 Dec 2004 23:56 GMT
> tomcat 5 / hibernate 2 / oracle 10g
>
[quoted text clipped - 20 lines]
>
> Andles

Can't really help you unless you provide your config files. I'm currently
running Hibernate with Oracle and have had no problems.
IINET - 23 Dec 2004 01:50 GMT
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.

>> tomcat 5 / hibernate 2 / oracle 10g
>>
[quoted text clipped - 23 lines]
> Can't really help you unless you provide your config files. I'm currently
> running Hibernate with Oracle and have had no problems.
IINET - 23 Dec 2004 01:52 GMT
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>

> Here is my config, which is in my classpath.
>
[quoted text clipped - 61 lines]
>> Can't really help you unless you provide your config files. I'm currently
>> running Hibernate with Oracle and have had no problems.
IINET - 23 Dec 2004 02:35 GMT
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....
> Sorry - heres my resource declareation in server.xml and the relavant
> web.xml
[quoted text clipped - 116 lines]
>>> Can't really help you unless you provide your config files. I'm
>>> currently running Hibernate with Oracle and have had no problems.
IINET - 23 Dec 2004 03:58 GMT
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.

> Just an update:
> I can get it going now using a Driver_class property, but NOT with a
[quoted text clipped - 131 lines]
>>>> Can't really help you unless you provide your config files. I'm
>>>> currently running Hibernate with Oracle and have had no problems.
Mark Scott - 23 Dec 2004 11:35 GMT
[Please don't top-post]

> Sorry - heres my resource declareation in server.xml and the relavant
> web.xml

You commented in one of your posts on typos in a book.  The words 'pot',
'kettle' and 'black' come to mind ;-)

> SERVER.XML
>
> <resource name="jdbc/webApps" auth="container" type="javax.sql.DataSource">
> <resourceParams>

These elements should be Resource and ResourceParams, respectively (note
the capitalisation, and apply the same to the closing elements).  I don't
believe Tomcat is actually binding your DataSource into JNDI (although you
say somewhere that it is).

During startup, I get NameNotFoundException and HibernateException if I
use your spelling (with Tomcat 5.0.28 and Hibernate 2.1.7b).

I'm not saying that's the only error you've made (and you acknowledge
at least one other in later posts), but it's one I spotted having fallen
foul of it myself in the past.

FWIW, I prefer to leave server.xml alone when defining this sort of thing,
and create context-specific files for the relevant virtual host.

HTH.

Signature

Mark Scott
mark@codebrewer.com

                      GPG Key ID: 0x2CCE1173 - signed/encrypted mail preferred

IINET - 23 Dec 2004 11:44 GMT
re:
You commented in one of your posts on typos in a book.  The words 'pot',
'kettle' and 'black' come to mind ;-)

Hey, when I put this post on sale at $75 a pop, I will ficks upp the
mincsteaks, okay.

re:
> believe Tomcat is actually binding your DataSource into JNDI (although you
> say somewhere that it is).

It is - has been for ages, no issues there whatsoever.

re:
> FWIW, I prefer to leave server.xml alone when defining this sort of thing,
> and create context-specific files for the relevant virtual host.

Actually, I did that too. I am using JBuilder with tomcat in embedded mode,
this is the only way you can do it.

Thanks for the feedback though - much appreciated.

> [Please don't top-post]
>
[quoted text clipped - 26 lines]
>
> HTH.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.