-->
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.  [ 4 posts ] 
Author Message
 Post subject: Problem to switch from default connection pooling to DBCP
PostPosted: Sat Jan 31, 2004 10:05 am 
Newbie

Joined: Sat Jan 31, 2004 9:36 am
Posts: 13
Location: Zurich
Hello,

I'm building my first application with hibernate. I like it very much.

My problem is to switch from default connection pooling to DBCP. The following configuration works fine:

Code:
<hibernate-configuration>
  <session-factory>
    <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://tiger/DokuStelleDB</property>
    <property name="hibernate.connection.username">DokuStelleDBUser</property>
    <property name="hibernate.connection.password">DokuStelleDBUser</property>

    <property name="hibernate.connection.pool_size">10</property>

    <property name="show_sql">false</property>

    <!-- Mapping files -->
    <mapping resource="org/dokustelle/model/place/StandortImpl.hbm.xml"/>

</session-factory>
</hibernate-configuration>


And the next configuration doesn't work:

Code:
<hibernate-configuration>
  <session-factory>
    <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://tiger/DokuStelleDB</property>
    <property name="hibernate.connection.username">DokuStelleDBUser</property>
    <property name="hibernate.connection.password">DokuStelleDBUser</property>

    <property name="hibernate.connection.provider_class">net.sf.hibernate.connection.DBCPConnectionProvider</property>
    <property name="hibernate.dbcp.validationQuery">Select 1</property>
    <property name="hibernate.dbcp.maxActive">50</property>
    <property name="hibernate.dbcp.maxIdle">10</property>
    <property name="hibernate.dbcp.maxWait">3000</property>
    <property name="hibernate.dbcp.whenExhaustedAction">1</property>

    <property name="hibernate.dbcp.ps.maxActive">50</property>
    <property name="hibernate.dbcp.ps.maxIdle">10</property>
    <property name="hibernate.dbcp.ps.maxWait">3000</property>
    <property name="hibernate.dbcp.ps.whenExhaustedAction">1</property>

    <property name="show_sql">false</property>

    <!-- Mapping files -->
    <mapping resource="org/dokustelle/model/place/StandortImpl.hbm.xml"/>

</session-factory>
</hibernate-configuration>


The log-output is:

Code:
...
31.01.2004 14:31:54 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: no JNDI name configured
31.01.2004 14:31:55 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
WARNUNG: SQL Error: 0, SQLState: 08001
31.01.2004 14:31:55 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SCHWERWIEGEND: No suitable driver
31.01.2004 14:31:55 net.sf.hibernate.JDBCException <init>
SCHWERWIEGEND: Cannot open connection
java.sql.SQLException: No suitable driver
   at java.sql.DriverManager.getConnection(DriverManager.java:532)
   at java.sql.DriverManager.getConnection(DriverManager.java:140)
   at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:97)
   at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:300)...

I'm using
  • Hibernate 2.1
  • Tomcat 5.0.16
  • Struts 1.1
  • SUN J2SDK 1.4.2-b28
  • MySQL 4.0.15
  • SUSE Linux 9.0
and I have the following jar's im my WEB-INF/lib:
  • cglib2.jar
  • commons-beanutils.jar
  • commons-collections.jar
  • commons-dbcp.jar
  • commons-digester.jar
  • commons-fileupload.jar
  • commons-lang.jar
  • commons-logging.jar
  • commons-pool.jar
  • commons-validator.jar
  • dom4j.jar
  • ehcache.jar
  • hibernate2.jar
  • jakarta-oro.jar
  • jdbc2_0-stdext.jar
  • jgroups.jar
  • jta.jar
  • mysql-connector-java-3.0.10-stable-bin.jar
  • odmg.jar
  • struts.jar
  • xalan.jar

Any help or hints are welcome!
Olli N.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 31, 2004 10:07 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Try putting the driver jar into common/lib instead ...


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 31, 2004 11:13 am 
Newbie

Joined: Sat Jan 31, 2004 9:36 am
Posts: 13
Location: Zurich
Thanks gloeglm!

It works in my development environment.
But what can I do if I don't have access to common/lib (e.g. in a hosting environment)?

Olli N.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 31, 2004 2:46 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Send your complaints to the Tomcat team, and get them to sort out their classloader architecture :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.