-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Tomcat/5.0.19 GlobalNamingResources JNDI DBCP problems
PostPosted: Tue Mar 01, 2005 1:41 pm 
Newbie

Joined: Thu Oct 07, 2004 3:53 pm
Posts: 10
I am trying to configure Hibernate to use a global (specified in tomcat server.xml GlobalNamingResources) JNDI supplied DBCP DataSource.

I know that Tomcat is properly configured w/o Hibernate because I was able to run a test JSP that gets connection from JNDI.

config.buildSessionFactory() says:

INFO: Not binding factory to JNDI, no JNDI name configured

I have spend quite a while trying various permutations of
connection.datasource. Any help would be appreciated.

Hibernate version: 2.1?

Mapping documents:
props.put("connection.datasource","java:comp/env/jdbc/cm");
props.put("hibernate.dialect","net.sf.hibernate.dialect.MySQLDialect");

tomcat server.xml:
<GlobalNamingResources>...
<Resource name="jdbc/cm" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/cm">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/nav_db</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>username</name>
<value>portal</value>
</parameter>
<parameter>
<name>password</name>
<value>B0bbyR4h4l</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>3000</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>100</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
</ResourceParams>

.....

<Host ...

<Context path="/auto_admin" docBase="auto_admin">
<ResourceLink
name="jdbc/cm"
global="jdbc/cm"
type="javax.sql.DataSource" />
</Context>


Name and version of the database you are using:
mysql Ver 11.18 Distrib 3.23.58, for redhat-linux-gnu (i386)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 01, 2005 2:21 pm 
Regular
Regular

Joined: Thu Dec 18, 2003 2:14 am
Posts: 103
Location: Brooklyn, NY
No error, I assume?
Nothing is wrong. As the message states, it is not binding the factory to JNDI, because Tomcat has a read-only JNDI. Don't worry about this.
Whether it retrieves the DataSource from JNDI is another issue, and from your test it seems it does.
As for using DHCP, there is a great deal of discussion in the forums about this. the general consensus is to use C3P0 or Proxool instead.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 02, 2005 12:18 pm 
Newbie

Joined: Thu Oct 07, 2004 3:53 pm
Posts: 10
thanks mgreer, i switched to c3p0. works great.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.