Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

TurbineResources.properties wont start up

843859Jul 19 2005 — edited Jul 22 2005
Hi all,
I can seem to get Turbine up and running under Apache Tomcat 4. I've created an initialization class (TurbineInit.java) that is invoked from my "Web.xml" in my application. Log4J runs fine, the Log4j.properties file runs great and works. Here is my "Web.xml"

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app>

<servlet>
<servlet-name>log4j-init</servlet-name>
<servlet-class>com.bfg.services.Log4jInit</servlet-class>

<init-param>
<param-name>log4j-init-file</param-name>
<param-value>WEB-INF/log4j.properties</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>

<servlet>

<servlet-name>turbine-init</servlet-name>
<servlet-class>com.bfg.services.TurbineInit</servlet-class>

<init-param>
<param-name>turbine-resource-directory</param-name>
<param-value>D:/Apache Tomcat 4/webapps/bfg/WEB-INF</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>

</web-app>

Here is my TurbineInit.java class file

package com.bfg.services;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.io.IOException;
import org.apache.turbine.util.TurbineConfig;

public class TurbineInit extends HttpServlet
{

public void init()
{
String prefix = getServletContext().getRealPath("/");
String dir = getInitParameter("turbine-resource-directory");
System.out.println("Attempting to load TurbineResources.properties!");

TurbineConfig turbcon = new TurbineConfig(dir, "TurbineResources.properties");
System.out.println("TurbineResources.properties loaded!");
turbcon.init();
}

public
void doGet(HttpServletRequest req, HttpServletResponse res) {
}

}

As you can see i've put println statement throughout the code so I can isolate where the problem might be. When Tomcat starts up only the first print line statement is executed the secound is not meaning there is a probem with the "TurbineConfig turbcon = new TurbineConfig(dir, "TurbineResources.properties"); System.out.println("TurbineResources.properties loaded!"); turbcon.init();" part of the code.

Finally here is my TurbineResourses.properties file

# -------------------------------------------------------------------
#
# S E R V I C E S
#
# -------------------------------------------------------------------
# Classes for Turbine Services should be defined here.
# Format: services.[name].classname=[implementing class]
#
# To specify properties of a service use the following syntax:
# service.[name].[property]=[value]

services.PoolBrokerService.classname=org.apache.turbine.services.db.
TurbinePoolBrokerService
services.MapBrokerService.classname=org.apache.turbine.services.db.TurbineMapBroker
Service


# -------------------------------------------------------------------
#
# D A T A B A S E S E T T I N G S
#
# -------------------------------------------------------------------
# These are your database settings. Look in the
# org.apache.turbine.util.db.pool.* packages for more information.
# The default driver for Turbine is for MySQL.
#
# The parameters to connect to the default database. You MUST
# configure these properly.
# -------------------------------------------------------------------

database.default.driver=org.gjt.mm.mysql.Driver
database.default.url=jdbc:mysql://localhost/BFG
database.default.username=bfguser
database.default.password=bfg
# The number of database connections to cache per ConnectionPool
# instance (specified per database).

database.default.maxConnections=50

The amount of time (in milliseconds) that database connections will be

# cached (specified per database).
#
# Default: one hour = 60 * 60 * 1000

database.default.expiryTime=3600000

# The amount of time (in milliseconds) a connection request will have to wait
# before a time out occurs and an error is thrown.
#
# Default: ten seconds = 10 * 1000

database.connectionWaitTimeout=10000

# The interval (in milliseconds) between which the PoolBrokerService logs
# the status of it's ConnectionPools.
#
# Default: No logging = 0 = 0 * 1000

database.logInterval=0

# These are the supported JDBC drivers and their associated Turbine
# adaptor. These properties are used by the DBFactory. You can add
# all the drivers you want here.

database.adaptor=DBMM
database.adaptor.DBMM=org.gjt.mm.mysql.Driver

The BFG database is set up in the MYSQL_HOME/data/BFG directory is this correct. I've also set up the username and password for DBROOT as "bfguser" and "bfg" as specified in the properties file above. Where am I going wrong?

Help is much appreciated.
Anand.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 19 2005
Added on Jul 19 2005
2 comments
297 views