You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@roller.apache.org by Karen Milburn/Bill Blackmon <KM...@austin.rr.com> on 2005/12/03 15:00:04 UTC

Roller 1.2 JDBC problems

Hi,
I'm trying to install and run Roller 1.2 under Tomcat 5.5 and I can't
get the connection pooling to work 
correctly. The JDBC driver is located in
tomcat\common\lib\mysql-connector-java-3.1.11-bin-g.jar as well as 
the jdk1.5.0_05\jre\lib\ext directory. The driver is also defined in the
system classpath. 
The roller.xml file is located in
tomcat\conf\Catalina\localhost\roller.xml, as recommended 
in the installation instructions for Tomcat 5.5 . 
 
The Hibernate.config for MySQL is defined as follows:
<!-- By default Roller uses a JNDI DataSource and the MySQLDialect -->
        <property name="show_sql">false</property>
        <property
name="connection.datasource">java:comp/env/jdbc/rollerdb</property>
        <property
name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
     
        <property
name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</proper
ty>
        <property name="hibernate.connection.url">
 
jdbc:mysql://localhost/roller?user=roller&amp;password=tiger</property>
        <property name="hibernate.connection.username">roller</property>
        <property name="hibernate.connection.password">tiger</property>
        <property
name="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</property
>
 
<<<<<<<<<<<< END OF HIBERNATE.CFG >>>>>>>>>>>>>>>>>>
 
The roller.xml follows:
<!-- 
     Example roller context configuration file for Tomcat 5.5.X and
MySQL 4.1.X
     Place this file at CATALINA_HOME/conf/Catalina/localhost/roller.xml
and replace
     the following values:
            DBNAME - The name of your Roller database (the name you used
with 'create database')
            DBUSERNAME - A MySQL user with full access to that database
            DBPASSWORD - The password for that user
     This file assumes you are deploying Roller to the URI "/roller" and
have put it under
     "roller" in your normal Tomcat appbase (typically "webapps").  If
not, see the
     instructions for setting up Roller to run under a different URI.
-->
<Context path="/roller" docBase="roller" debug="99"
workDir="work/Catalina/localhost/roller">
            
    <Realm className="org.apache.catalina.realm.JDBCRealm"      
      driverName="com.mysql.jdbc.Driver"
      connectionURL=
 
"jdbc:mysql://localhost:3306/roller?autoReconnect=true&amp;useUnicode=tr
ue&amp;characterEncoding=utf-8&amp;mysqlEncoding=utf8"      
        connectionName="scott"
      connectionPassword="scott"
      userTable="rolleruser" 
      userNameCol="username" 
      userCredCol="passphrase" 
      userRoleTable="userrole" 
      roleNameCol="rolename" debug="99" />
 
    <Resource name="jdbc/rollerdb" auth="Container"
type="javax.sql.DataSource"
      driverClassName="com.mysql.jdbc.Driver"
 
url="jdbc:mysql://localhost:3306/roller?autoReconnect=true&amp;useUnicod
e=true&amp;characterEncoding=utf-8&amp;mysqlEncoding=utf8"
      username="scott"
      password="tiger"
      maxActive="20"
      maxIdle="3"
      removeAbandoned="true"
      maxWait="3000" />
 
    <!--
      To enable email notification of comments: uncomment the resouce
below, 
      set your mailhost, and make sure you have mail.jar and
activation.jar 
      in <tomcat>/common/lib.
    -->
    <!--
    <Resource name="mail/Session" auth="Container"
type="javax.mail.Session"
      mail.smtp.host="mailhost.example.com" />
    -->
</Context>
<<<<<<<<<<<<<<<<<<<<<< END OF ROLLER.XML >>>>>>>>>>>>>>>>>>
 
 
 
The error from roller.log follows:
 
 
ERROR 2005-11-15 22:03:35,140 JDBCExceptionReporter:logExceptions -
Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
ERROR 2005-11-15 22:03:35,156 JDBCException:<init> - Cannot open
connection
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver
class 'com.mysql.jdbc.Driver'
            at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSo
urce.java:766)
            at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSourc
e.java:554)
            at
net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(D
atasourceConnectionProvider.java:56)
            at
net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278)
            at
net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3302)
            at
net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3282)
            at
net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java
:65)
            at
net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704)
            at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
            at
net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
ader.java:133)
            at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
            at net.sf.hibernate.loader.Loader.list(Loader.java:946)
            at
net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:121)
            at
net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3609)
            at
net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
            at
org.roller.business.hibernate.HibernatePropertiesManagerImpl.getProperti
es(HibernatePropertiesManagerImpl.java:71)
            at
org.roller.business.PropertiesManagerImpl.init(PropertiesManagerImpl.jav
a:55)
            at
org.roller.business.PropertiesManagerImpl.<init>(PropertiesManagerImpl.j
ava:47)
            at
org.roller.business.hibernate.HibernatePropertiesManagerImpl.<init>(Hibe
rnatePropertiesManagerImpl.java:39)
            at
org.roller.business.hibernate.HibernateRollerImpl.getPropertiesManager(H
ibernateRollerImpl.java:197)
            at
org.roller.presentation.RollerContext.setupRollerProperties(RollerContex
t.java:211)
            at
org.roller.presentation.RollerContext.contextInitialized(RollerContext.j
ava:176)
 
<<<<<<<<<<<< END OF ERROR MSG >>>>>>>>>>>>>>>>>>>>>>>>>>>>
 
 
I've been struggling with this for quite awhile and I'm about to give up
and select a different Blogging tool.
Any help would be GREATLY appreciated.
 
Thanks,
Bill

Re: Roller 1.2 JDBC problems

Posted by Anil Gangolli <an...@busybuddha.org>.
A couple of suggestions.

You should not have to edit the Hibernate configuration from what is 
shipped with Roller.  Only the roller.xml context file, following the 
installation instructions step by step.   Both Roller and Hibernate 
lookup the datasource name using JNDI.

Make sure you have specifed the MySQL database name, database username, 
and password correctly.
You have inconsistent settings of username/password pairs in the two 
sections of the context xml (scott/scott v. scott/tiger), and I suspect 
these aren't the username and password you actually setup.  [Make sure 
also that you did set up the database and grants first.]

--a.


Karen Milburn/Bill Blackmon wrote:

>Hi,
>I'm trying to install and run Roller 1.2 under Tomcat 5.5 and I can't
>get the connection pooling to work 
>correctly. The JDBC driver is located in
>tomcat\common\lib\mysql-connector-java-3.1.11-bin-g.jar as well as 
>the jdk1.5.0_05\jre\lib\ext directory. The driver is also defined in the
>system classpath. 
>The roller.xml file is located in
>tomcat\conf\Catalina\localhost\roller.xml, as recommended 
>in the installation instructions for Tomcat 5.5 . 
> 
>The Hibernate.config for MySQL is defined as follows:
><!-- By default Roller uses a JNDI DataSource and the MySQLDialect -->
>        <property name="show_sql">false</property>
>        <property
>name="connection.datasource">java:comp/env/jdbc/rollerdb</property>
>        <property
>name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
>     
>        <property
>name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</proper
>ty>
>        <property name="hibernate.connection.url">
> 
>jdbc:mysql://localhost/roller?user=roller&amp;password=tiger</property>
>        <property name="hibernate.connection.username">roller</property>
>        <property name="hibernate.connection.password">tiger</property>
>        <property
>name="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</property
>  
>
> 
><<<<<<<<<<<< END OF HIBERNATE.CFG >>>>>>>>>>>>>>>>>>
> 
>The roller.xml follows:
><!-- 
>     Example roller context configuration file for Tomcat 5.5.X and
>MySQL 4.1.X
>     Place this file at CATALINA_HOME/conf/Catalina/localhost/roller.xml
>and replace
>     the following values:
>            DBNAME - The name of your Roller database (the name you used
>with 'create database')
>            DBUSERNAME - A MySQL user with full access to that database
>            DBPASSWORD - The password for that user
>     This file assumes you are deploying Roller to the URI "/roller" and
>have put it under
>     "roller" in your normal Tomcat appbase (typically "webapps").  If
>not, see the
>     instructions for setting up Roller to run under a different URI.
>-->
><Context path="/roller" docBase="roller" debug="99"
>workDir="work/Catalina/localhost/roller">
>            
>    <Realm className="org.apache.catalina.realm.JDBCRealm"      
>      driverName="com.mysql.jdbc.Driver"
>      connectionURL=
> 
>"jdbc:mysql://localhost:3306/roller?autoReconnect=true&amp;useUnicode=tr
>ue&amp;characterEncoding=utf-8&amp;mysqlEncoding=utf8"      
>        connectionName="scott"
>      connectionPassword="scott"
>      userTable="rolleruser" 
>      userNameCol="username" 
>      userCredCol="passphrase" 
>      userRoleTable="userrole" 
>      roleNameCol="rolename" debug="99" />
> 
>    <Resource name="jdbc/rollerdb" auth="Container"
>type="javax.sql.DataSource"
>      driverClassName="com.mysql.jdbc.Driver"
> 
>url="jdbc:mysql://localhost:3306/roller?autoReconnect=true&amp;useUnicod
>e=true&amp;characterEncoding=utf-8&amp;mysqlEncoding=utf8"
>      username="scott"
>      password="tiger"
>      maxActive="20"
>      maxIdle="3"
>      removeAbandoned="true"
>      maxWait="3000" />
> 
>    <!--
>      To enable email notification of comments: uncomment the resouce
>below, 
>      set your mailhost, and make sure you have mail.jar and
>activation.jar 
>      in <tomcat>/common/lib.
>    -->
>    <!--
>    <Resource name="mail/Session" auth="Container"
>type="javax.mail.Session"
>      mail.smtp.host="mailhost.example.com" />
>    -->
></Context>
><<<<<<<<<<<<<<<<<<<<<< END OF ROLLER.XML >>>>>>>>>>>>>>>>>>
> 
> 
> 
>The error from roller.log follows:
> 
> 
>ERROR 2005-11-15 22:03:35,140 JDBCExceptionReporter:logExceptions -
>Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
>ERROR 2005-11-15 22:03:35,156 JDBCException:<init> - Cannot open
>connection
>org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver
>class 'com.mysql.jdbc.Driver'
>            at
>org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSo
>urce.java:766)
>            at
>org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSourc
>e.java:554)
>            at
>net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(D
>atasourceConnectionProvider.java:56)
>            at
>net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278)
>            at
>net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3302)
>            at
>net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3282)
>            at
>net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java
>:65)
>            at
>net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704)
>            at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
>            at
>net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
>ader.java:133)
>            at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
>            at net.sf.hibernate.loader.Loader.list(Loader.java:946)
>            at
>net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:121)
>            at
>net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3609)
>            at
>net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
>            at
>org.roller.business.hibernate.HibernatePropertiesManagerImpl.getProperti
>es(HibernatePropertiesManagerImpl.java:71)
>            at
>org.roller.business.PropertiesManagerImpl.init(PropertiesManagerImpl.jav
>a:55)
>            at
>org.roller.business.PropertiesManagerImpl.<init>(PropertiesManagerImpl.j
>ava:47)
>            at
>org.roller.business.hibernate.HibernatePropertiesManagerImpl.<init>(Hibe
>rnatePropertiesManagerImpl.java:39)
>            at
>org.roller.business.hibernate.HibernateRollerImpl.getPropertiesManager(H
>ibernateRollerImpl.java:197)
>            at
>org.roller.presentation.RollerContext.setupRollerProperties(RollerContex
>t.java:211)
>            at
>org.roller.presentation.RollerContext.contextInitialized(RollerContext.j
>ava:176)
> 
><<<<<<<<<<<< END OF ERROR MSG >>>>>>>>>>>>>>>>>>>>>>>>>>>>
> 
> 
>I've been struggling with this for quite awhile and I'm about to give up
>and select a different Blogging tool.
>Any help would be GREATLY appreciated.
> 
>Thanks,
>Bill
>
>  
>


Re: Roller 1.2 JDBC problems

Posted by Matt Raible <mr...@gmail.com>.
On 12/3/05, Karen Milburn/Bill Blackmon <KM...@austin.rr.com> wrote:
> Hi,
> I'm trying to install and run Roller 1.2 under Tomcat 5.5 and I can't
> get the connection pooling to work
> correctly. The JDBC driver is located in
> tomcat\common\lib\mysql-connector-java-3.1.11-bin-g.jar as well as
> the jdk1.5.0_05\jre\lib\ext directory. The driver is also defined in the
> system classpath.

You only need the JAR in one location - I'd remove it from your JRE
and from you system classpath.

> The roller.xml file is located in
> tomcat\conf\Catalina\localhost\roller.xml, as recommended
> in the installation instructions for Tomcat 5.5 .
>
> The Hibernate.config for MySQL is defined as follows:
> <!-- By default Roller uses a JNDI DataSource and the MySQLDialect -->
>         <property name="show_sql">false</property>
>         <property
> name="connection.datasource">java:comp/env/jdbc/rollerdb</property>
>         <property
> name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
>
>         <property
> name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</proper
> ty>
>         <property name="hibernate.connection.url">
>
> jdbc:mysql://localhost/roller?user=roller&amp;password=tiger</property>
>         <property name="hibernate.connection.username">roller</property>
>         <property name="hibernate.connection.password">tiger</property>
>         <property
> name="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</property
> >
>
> <<<<<<<<<<<< END OF HIBERNATE.CFG >>>>>>>>>>>>>>>>>>

It seems strange that you have both a JNDI DataSource defined and a
regular datasource with username, password and url properties.  Is
this the default in Roller 1.2?  I see you have an old mm MySQL JAR
defined here - this should still work with the latest JAR, it's just
wierd that both connection types are defined.


>
> The roller.xml follows:
> <!--
>      Example roller context configuration file for Tomcat 5.5.X and
> MySQL 4.1.X
>      Place this file at CATALINA_HOME/conf/Catalina/localhost/roller.xml
> and replace
>      the following values:
>             DBNAME - The name of your Roller database (the name you used
> with 'create database')
>             DBUSERNAME - A MySQL user with full access to that database
>             DBPASSWORD - The password for that user
>      This file assumes you are deploying Roller to the URI "/roller" and
> have put it under
>      "roller" in your normal Tomcat appbase (typically "webapps").  If
> not, see the
>      instructions for setting up Roller to run under a different URI.
> -->
> <Context path="/roller" docBase="roller" debug="99"
> workDir="work/Catalina/localhost/roller">
>
>     <Realm className="org.apache.catalina.realm.JDBCRealm"
>       driverName="com.mysql.jdbc.Driver"
>       connectionURL=
>
> "jdbc:mysql://localhost:3306/roller?autoReconnect=true&amp;useUnicode=tr
> ue&amp;characterEncoding=utf-8&amp;mysqlEncoding=utf8"
>         connectionName="scott"
>       connectionPassword="scott"
>       userTable="rolleruser"
>       userNameCol="username"
>       userCredCol="passphrase"
>       userRoleTable="userrole"
>       roleNameCol="rolename" debug="99" />
>
>     <Resource name="jdbc/rollerdb" auth="Container"
> type="javax.sql.DataSource"
>       driverClassName="com.mysql.jdbc.Driver"
>
> url="jdbc:mysql://localhost:3306/roller?autoReconnect=true&amp;useUnicod
> e=true&amp;characterEncoding=utf-8&amp;mysqlEncoding=utf8"
>       username="scott"
>       password="tiger"
>       maxActive="20"
>       maxIdle="3"
>       removeAbandoned="true"
>       maxWait="3000" />
>
>     <!--
>       To enable email notification of comments: uncomment the resouce
> below,
>       set your mailhost, and make sure you have mail.jar and
> activation.jar
>       in <tomcat>/common/lib.
>     -->
>     <!--
>     <Resource name="mail/Session" auth="Container"
> type="javax.mail.Session"
>       mail.smtp.host="mailhost.example.com" />
>     -->
> </Context>
> <<<<<<<<<<<<<<<<<<<<<< END OF ROLLER.XML >>>>>>>>>>>>>>>>>>
>
>
>
> The error from roller.log follows:
>
>
> ERROR 2005-11-15 22:03:35,140 JDBCExceptionReporter:logExceptions -
> Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
> ERROR 2005-11-15 22:03:35,156 JDBCException:<init> - Cannot open
> connection
> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver
> class 'com.mysql.jdbc.Driver'
>             at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSo
> urce.java:766)
>             at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSourc
> e.java:554)
>             at
> net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(D
> atasourceConnectionProvider.java:56)
>             at
> net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278)
>             at
> net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3302)
>             at
> net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3282)
>             at
> net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java
> :65)
>             at
> net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:704)
>             at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
>             at
> net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Lo
> ader.java:133)
>             at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
>             at net.sf.hibernate.loader.Loader.list(Loader.java:946)
>             at
> net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:121)
>             at
> net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3609)
>             at
> net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
>             at
> org.roller.business.hibernate.HibernatePropertiesManagerImpl.getProperti
> es(HibernatePropertiesManagerImpl.java:71)
>             at
> org.roller.business.PropertiesManagerImpl.init(PropertiesManagerImpl.jav
> a:55)
>             at
> org.roller.business.PropertiesManagerImpl.<init>(PropertiesManagerImpl.j
> ava:47)
>             at
> org.roller.business.hibernate.HibernatePropertiesManagerImpl.<init>(Hibe
> rnatePropertiesManagerImpl.java:39)
>             at
> org.roller.business.hibernate.HibernateRollerImpl.getPropertiesManager(H
> ibernateRollerImpl.java:197)
>             at
> org.roller.presentation.RollerContext.setupRollerProperties(RollerContex
> t.java:211)
>             at
> org.roller.presentation.RollerContext.contextInitialized(RollerContext.j
> ava:176)
>
> <<<<<<<<<<<< END OF ERROR MSG >>>>>>>>>>>>>>>>>>>>>>>>>>>>
>

Roller should be pretty easy to setup out of the box.  Here's how I do it:

1. Copy roller.xml from the following post and change JDBC Driver,
URL, user/pass to match my database:

http://raibledesigns.com/page/rd?entry=roller_gets_some_respect

2. copy jta.jar and JDBC Driver to $CATALINA_HOME/common/lib

3. Create database using scripts in roller/WEB-INF/dbscripts

4. Deploy to Tomcat

HTH,

Matt

>
> I've been struggling with this for quite awhile and I'm about to give up
> and select a different Blogging tool.
> Any help would be GREATLY appreciated.
>
> Thanks,
> Bill
>
>