You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Clay Graham <cl...@newobjectivity.com> on 2002/07/09 01:36:17 UTC

going crazy with DBCP

I will pay someone to help me at this point, I am not rich but I know when 
to admit when need help. I am basically at the end of my rope trying to get 
dbcp to work, I have been over

http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2

about one hundred times, basically it's impossible to get the exact 
configuration that he speaks of, like some of the commons stuff I couldn't 
find those versions, anyway it would really suprise me if those EXACT 
versions are the only ones that work.

I tried to install the RPM 4.0.4 version of tomcat and the webapps, but I 
could not get the manager to work, so I went back to 4.0.2. Is there such a 
difference between 4.0.2 and to point versions that it causes this stuff to 
fail? Is the only way to get DBCP to work is to actually build tomcat from 
source? Anyway I have done the best I can and spent two days configuring, 
this where I am at:

tomcat 4.0.2 full
mysql 4.0.1-2

mm.mysql-2.0.14-bin.jar in $TOMCAT_HOME/common/lib

commons-collections-2.0 - commons-collections.jar in 
$TOMCAT_HOME/common/lib
commons-dbcp-20020707.tar.gz - commons-dbcp.jar in $TOMCAT_HOME/common/lib
commons-pool-20020707.tar.gz - commons-pool.jar in $TOMCAT_HOME/common/lib

added to server.xml

<!--  the data source added by Clay-->
<Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true" 
crossContext="true">
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="localhost_DBTest_log." suffix=".txt"
              timestamp="true"/>
      <Resource name="jdbc/TestDB" auth="Container" 
type="javax.sql.DataSource"/>
      <ResourceParams name="jdbc/TestDB">
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>
      <parameter><name>maxActive</name><value>100</value></parameter>
      <parameter><name>maxIdle</name><value>30000</value></parameter>
      <parameter><name>maxWait</name><value>100</value></parameter>
      <parameter><name>username</name><value>tomcat</value></parameter>
      <parameter><name>password</name><value>password</value></parameter> 
     <parameter>
       <name>driverClassName</name><value>org.gjt.mm.mysql.Driver</value>
     </parameter>
    <parameter>
      <name>url</name><value>jdbc:mysql://localhost:3306/test</value>
    </parameter>
  </ResourceParams>
</Context>

when tomcat is started i get the following log errors:

2002-07-08 16:14:38 StandardContext[/DBTest]: Starting
2002-07-08 16:14:38 StandardContext[/DBTest]: Processing start(), current 
available=false
2002-07-08 16:14:38 StandardContext[/DBTest]: Configuring default Resources
2002-07-08 16:14:38 StandardContext[/DBTest]: Error initializing resources: 
Document base /home/tomcat/jwsdp-1_/webapps/DBTest does not exist or is not 
a readable directory
2002-07-08 16:14:38 StandardContext[/DBTest]: Configuring non-privileged 
default Loader
2002-07-08 16:14:38 StandardContext[/DBTest]: Configuring default Manager
2002-07-08 16:14:38 StandardContext[/DBTest]: Processing standard container 
startup
2002-07-08 16:14:38 StandardContext[/DBTest]: Context startup failed due to 
previous errors
2002-07-08 16:14:38 StandardContext[/DBTest]: Exception during cleanup 
after start failed
LifecycleException:  Container StandardContext[/DBTest] has not been 
started
        at 
org.apache.catalina.core.StandardContext.stop(StandardContext.java:3521)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:3499)
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1190)
        at 
org.apache.catalina.core.StandardHost.start(StandardHost.java:739)
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1190)
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
        at org.apache.catalina.core.StandardService.start(StandardServic  
e.java:499)
        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:2187)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:504)
        at org.apache.catalina.startup.Catalina.execute(Catalina.java:399)
        at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav  
a:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor  
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav  
a:39)


I am not an expert, but I feel like I have to be to get DBCP to work....



clay


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: going crazy with DBCP

Posted by Andrew Conrad <an...@msn.com>.
I need to pay more attention to the docs I was reading.  Sorry about the
confusion I may have caused.

Thanks for the catch Jacob.


- Andrew

-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com] 
Sent: Tuesday, July 09, 2002 12:53 AM
To: Tomcat Users List
Subject: RE: going crazy with DBCP



At 11:05 PM 7/8/2002 -0400, you wrote:
>Hey Clay, here's something I noticed.  With Tomcat 4.0.x the place to 
>put your jars for server wide access is in %CATALINA%\lib, not 
>%CATALINA%\common\lib.  (the common\lib is the new location for 4.1.x)


This is not at all correct.

%CATALINA%\common\lib existed in Tomcat-4.0 and continues to exist in 
Tomcat-4.1.  It is used for cases where both the server and your webapps

require access to libraries.  This would be the case with your JDBC
driver 
when using DBCP connection pooling.

What changed between 4.0 and 4.1 is that %CATALINA%\lib is now 
%CATALINA%\shared\lib.  Actually, the only thing that changed was the 
name.  There is no functional difference here.  These respective 
directories are be used to store jars that need to be accessed by your 
webapps, but you don't need to have the server itself see them.

We don't need any more confusion about that on this list.

Jake

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: going crazy with DBCP

Posted by Jacob Kjome <ho...@visi.com>.
At 11:05 PM 7/8/2002 -0400, you wrote:
>Hey Clay, here's something I noticed.  With Tomcat 4.0.x the place to
>put your jars for server wide access is in %CATALINA%\lib, not
>%CATALINA%\common\lib.  (the common\lib is the new location for 4.1.x)


This is not at all correct.

%CATALINA%\common\lib existed in Tomcat-4.0 and continues to exist in 
Tomcat-4.1.  It is used for cases where both the server and your webapps 
require access to libraries.  This would be the case with your JDBC driver 
when using DBCP connection pooling.

What changed between 4.0 and 4.1 is that %CATALINA%\lib is now 
%CATALINA%\shared\lib.  Actually, the only thing that changed was the 
name.  There is no functional difference here.  These respective 
directories are be used to store jars that need to be accessed by your 
webapps, but you don't need to have the server itself see them.

We don't need any more confusion about that on this list.

Jake

Re: going crazy with DBCP

Posted by Jacob Kjome <ho...@visi.com>.
Try using Tomcat 4.1.3 or 4.1.7 (not anything in between because I think 
DBCP was broken for a bit there).  Everything should work just great.

Jake


At 04:36 PM 7/8/2002 -0700, you wrote:
>I will pay someone to help me at this point, I am not rich but I know when
>to admit when need help. I am basically at the end of my rope trying to get
>dbcp to work, I have been over
>
>http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2
>
>about one hundred times, basically it's impossible to get the exact
>configuration that he speaks of, like some of the commons stuff I couldn't
>find those versions, anyway it would really suprise me if those EXACT
>versions are the only ones that work.
>
>I tried to install the RPM 4.0.4 version of tomcat and the webapps, but I
>could not get the manager to work, so I went back to 4.0.2. Is there such a
>difference between 4.0.2 and to point versions that it causes this stuff to
>fail? Is the only way to get DBCP to work is to actually build tomcat from
>source? Anyway I have done the best I can and spent two days configuring,
>this where I am at:
>
>tomcat 4.0.2 full
>mysql 4.0.1-2
>
>mm.mysql-2.0.14-bin.jar in $TOMCAT_HOME/common/lib
>
>commons-collections-2.0 - commons-collections.jar in
>$TOMCAT_HOME/common/lib
>commons-dbcp-20020707.tar.gz - commons-dbcp.jar in $TOMCAT_HOME/common/lib
>commons-pool-20020707.tar.gz - commons-pool.jar in $TOMCAT_HOME/common/lib
>
>added to server.xml
>
><!--  the data source added by Clay-->
><Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true"
>crossContext="true">
>       <Logger className="org.apache.catalina.logger.FileLogger"
>               prefix="localhost_DBTest_log." suffix=".txt"
>               timestamp="true"/>
>       <Resource name="jdbc/TestDB" auth="Container"
>type="javax.sql.DataSource"/>
>       <ResourceParams name="jdbc/TestDB">
>       <parameter>
>         <name>factory</name>
>         <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>       </parameter>
>       <parameter><name>maxActive</name><value>100</value></parameter>
>       <parameter><name>maxIdle</name><value>30000</value></parameter>
>       <parameter><name>maxWait</name><value>100</value></parameter>
>       <parameter><name>username</name><value>tomcat</value></parameter>
>       <parameter><name>password</name><value>password</value></parameter>
>      <parameter>
>        <name>driverClassName</name><value>org.gjt.mm.mysql.Driver</value>
>      </parameter>
>     <parameter>
>       <name>url</name><value>jdbc:mysql://localhost:3306/test</value>
>     </parameter>
>   </ResourceParams>
></Context>
>
>when tomcat is started i get the following log errors:
>
>2002-07-08 16:14:38 StandardContext[/DBTest]: Starting
>2002-07-08 16:14:38 StandardContext[/DBTest]: Processing start(), current
>available=false
>2002-07-08 16:14:38 StandardContext[/DBTest]: Configuring default Resources
>2002-07-08 16:14:38 StandardContext[/DBTest]: Error initializing resources:
>Document base /home/tomcat/jwsdp-1_/webapps/DBTest does not exist or is not
>a readable directory
>2002-07-08 16:14:38 StandardContext[/DBTest]: Configuring non-privileged
>default Loader
>2002-07-08 16:14:38 StandardContext[/DBTest]: Configuring default Manager
>2002-07-08 16:14:38 StandardContext[/DBTest]: Processing standard container
>startup
>2002-07-08 16:14:38 StandardContext[/DBTest]: Context startup failed due to
>previous errors
>2002-07-08 16:14:38 StandardContext[/DBTest]: Exception during cleanup
>after start failed
>LifecycleException:  Container StandardContext[/DBTest] has not been
>started
>         at
>org.apache.catalina.core.StandardContext.stop(StandardContext.java:3521)
>         at
>org.apache.catalina.core.StandardContext.start(StandardContext.java:3499)
>         at
>org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1190)
>         at
>org.apache.catalina.core.StandardHost.start(StandardHost.java:739)
>         at
>org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1190)
>         at
>org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
>         at org.apache.catalina.core.StandardService.start(StandardServic
>e.java:499)
>         at
>org.apache.catalina.core.StandardServer.start(StandardServer.java:2187)
>         at org.apache.catalina.startup.Catalina.start(Catalina.java:504)
>         at org.apache.catalina.startup.Catalina.execute(Catalina.java:399)
>         at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
>a:39)
>         at
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
>Impl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
>a:39)
>
>
>I am not an expert, but I feel like I have to be to get DBCP to work....
>
>
>
>clay
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>

RE: going crazy with DBCP

Posted by Andrew Conrad <an...@msn.com>.
Hey Clay, here's something I noticed.  With Tomcat 4.0.x the place to
put your jars for server wide access is in %CATALINA%\lib, not
%CATALINA%\common\lib.  (the common\lib is the new location for 4.1.x)

Also, double-check your URL in your <Resource> tag.  I'm not famaliar
with the tag for MySQL, but I thought that there should be a colon
between your Port and your Database.  


Finally, there is an error saying that DBTest
("/home/tomcat/jwsdp-1_/webapps/DBTest" ??) does not exist within your
webapps folder.  Your <Context> tag has a docBase attribute that either
points to a relative path to the webapps folder (by default) or you need
to put in an absolute path.


Good luck.  Also, if you used Tomcat 4.1.x, (4.1.7 hint hint) all the
Commons Jars are included, so all you would have to do is add your MySQL
Jars.  Plus you can configure your Resources through the Admin GUI if
you really wanted too.



- Andrew

-----Original Message-----
From: Clay Graham [mailto:clayg@newobjectivity.com] 
Sent: Monday, July 08, 2002 7:36 PM
To: 'tomcat-user@jakarta.apache.org'
Subject: going crazy with DBCP


I will pay someone to help me at this point, I am not rich but I know
when 
to admit when need help. I am basically at the end of my rope trying to
get 
dbcp to work, I have been over

http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2

about one hundred times, basically it's impossible to get the exact 
configuration that he speaks of, like some of the commons stuff I
couldn't 
find those versions, anyway it would really suprise me if those EXACT 
versions are the only ones that work.

I tried to install the RPM 4.0.4 version of tomcat and the webapps, but
I 
could not get the manager to work, so I went back to 4.0.2. Is there
such a 
difference between 4.0.2 and to point versions that it causes this stuff
to 
fail? Is the only way to get DBCP to work is to actually build tomcat
from 
source? Anyway I have done the best I can and spent two days
configuring, 
this where I am at:

tomcat 4.0.2 full
mysql 4.0.1-2

mm.mysql-2.0.14-bin.jar in $TOMCAT_HOME/common/lib

commons-collections-2.0 - commons-collections.jar in 
$TOMCAT_HOME/common/lib
commons-dbcp-20020707.tar.gz - commons-dbcp.jar in
$TOMCAT_HOME/common/lib commons-pool-20020707.tar.gz - commons-pool.jar
in $TOMCAT_HOME/common/lib

added to server.xml

<!--  the data source added by Clay-->
<Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true" 
crossContext="true">
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="localhost_DBTest_log." suffix=".txt"
              timestamp="true"/>
      <Resource name="jdbc/TestDB" auth="Container" 
type="javax.sql.DataSource"/>
      <ResourceParams name="jdbc/TestDB">
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>
      <parameter><name>maxActive</name><value>100</value></parameter>
      <parameter><name>maxIdle</name><value>30000</value></parameter>
      <parameter><name>maxWait</name><value>100</value></parameter>
      <parameter><name>username</name><value>tomcat</value></parameter>
 
<parameter><name>password</name><value>password</value></parameter> 
     <parameter>
 
<name>driverClassName</name><value>org.gjt.mm.mysql.Driver</value>
     </parameter>
    <parameter>
      <name>url</name><value>jdbc:mysql://localhost:3306/test</value>
    </parameter>
  </ResourceParams>
</Context>

when tomcat is started i get the following log errors:

2002-07-08 16:14:38 StandardContext[/DBTest]: Starting 2002-07-08
16:14:38 StandardContext[/DBTest]: Processing start(), current 
available=false
2002-07-08 16:14:38 StandardContext[/DBTest]: Configuring default
Resources 2002-07-08 16:14:38 StandardContext[/DBTest]: Error
initializing resources: 
Document base /home/tomcat/jwsdp-1_/webapps/DBTest does not exist or is
not 
a readable directory
2002-07-08 16:14:38 StandardContext[/DBTest]: Configuring non-privileged

default Loader
2002-07-08 16:14:38 StandardContext[/DBTest]: Configuring default
Manager 2002-07-08 16:14:38 StandardContext[/DBTest]: Processing
standard container 
startup
2002-07-08 16:14:38 StandardContext[/DBTest]: Context startup failed due
to 
previous errors
2002-07-08 16:14:38 StandardContext[/DBTest]: Exception during cleanup 
after start failed
LifecycleException:  Container StandardContext[/DBTest] has not been 
started
        at 
org.apache.catalina.core.StandardContext.stop(StandardContext.java:3521)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:3499
)
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1190)
        at 
org.apache.catalina.core.StandardHost.start(StandardHost.java:739)
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1190)
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
        at org.apache.catalina.core.StandardService.start(StandardServic

e.java:499)
        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:2187)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:504)
        at
org.apache.catalina.startup.Catalina.execute(Catalina.java:399)
        at
org.apache.catalina.startup.Catalina.process(Catalina.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav

a:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor

Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav

a:39)


I am not an expert, but I feel like I have to be to get DBCP to work....



clay


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>