Look at your database. There should be at least the pool size of connections open when there is no activity.

Whether or not you specify the factory depends on the factory being used. If it is a standard factory in Tomcat that Tomcat is already aware of, it is not needed. But if you use a set of drivers that use a different or special factory you will need to call it out. This information is in the docs but is a little scattered. Read all the pages on jndi, jdbc and global resources.
Including:


http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html


The other simple answer is what code are you using? If you are calling the DriverManager then no, but if you are calling
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/myDB"); or similar then you are using Tomcats built in pooling. Otherwise you would get an error.




Doug



----- Original Message ----- From: "DAVID TURNER" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Friday, February 04, 2005 8:19 AM
Subject: RE: Tomcat 5.5.4/Windows 2000 server - Failed to register in JMX: BasicDataSourceFactory



Hi all,

Most of the examples I've come across specify the factory parameter.  And,
after rereading the Tomcat docs, those additional three commons jar files
are needed.

I too, have gotten the datasource to work when I didn't specify the
factory parameter, but my impression right now is that it's not pooling
the datasources/connections when you don't specify it.

Is there a way to see that Tomcat is actually pooling these
connections/datasources?






"Greg Guerin" <[EMAIL PROTECTED]> 02/03/2005 04:51 PM Please respond to "Tomcat Users List" <tomcat-user@jakarta.apache.org>


To "'Tomcat Users List'" <tomcat-user@jakarta.apache.org> cc

Subject
RE: Tomcat 5.5.4/Windows 2000 server - Failed to register in JMX:
BasicDataSourceFactory






Hi David, Mario,

We actually specify the factory parameter because we extend the
BasicDataSourceFactory so we can encrypt passwords in the resource
definition.  My question is: Is there already a way to do that using
another
factory I'm unaware of? It works fine, but we have to include the jars
that
Mario mentioned and it'd be nice to not have to tie our code that close to
the container.

Greg

-----Original Message-----
From: Mario Winterer [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 03, 2005 4:37 PM
To: Tomcat Users List
Subject: Re: Tomcat 5.5.4/Windows 2000 server - Failed to register in JMX:
BasicDataSourceFactory

Hi David!

I think, you do not need to explicitely define a bean factory because
Tomcat
5 automatically uses dbcp for JNDI-DataSources (I think tomcat looks at
the
type of resource - in your case a javax.sql.DataSource - and uses the
tomcat-internal dbcp-factory). In my project, I've configured a
JNDI-DataSource using the Oracle thin driver and it works perfectly
without
specifying a bean factory and without adding any special libraries to my
tomcat installation (apart from the oracle database driver which is in
commons/lib).

So try the following configuration:

<Resource name="jdbc/as400" auth="Container"
                type="javax.sql.DataSource"
                maxActive="20" maxIdle="10" maxWait="-1"
                removeAbandoned="true"
       removeAbandonedTimeout="60"
       logAbandoned="true"
       driverClassName="com.ibm.as400.access.AS400JDBCDriver"

url="jdbc:as400://a53pb3;naming=system;libraries=,pgmdbt,caelib;errors=full"
       username="userid"
       password="password"
/>

Again: You do not need any additional commons-libraries!

Best regards,
 Tex

Hi Mario,

Thanks for getting back to me.  Below is the context I set up.

After doing my own digging, I realized I was missing some jakarta
commons jar files.  After getting these jars and restarting Tomcat the
ClassNotFoundExceptions went away.

What I find really puzzling though is why I didn't get the same
ClassNotFoundException on my local machine that was running the same
version of Tomcat but on Windows XP profession.


<Context debug="0" privileged="true">

 <!-- the jdbc driver's jar needs to go into $CATALINA_HOME/common/lib
-->
 <Resource name="jdbc/as400" auth="Container"
               type="javax.sql.DataSource"
               factory="org.apache.commons.dbcp.BasicDataSourceFactory"
               maxActive="20"
               maxIdle="10"
               maxWait="-1"
               removeAbandoned="true"
               removeAbandonedTimeout="60"
               logAbandoned="true"
               driverClassName="com.ibm.as400.access.AS400JDBCDriver"

url="jdbc:as400://a53pb3;naming=system;libraries=,pgmdbt,caelib;errors=full
"
               username="userid"
               password="password"/>

</Context>









Mario Winterer <[EMAIL PROTECTED]>
02/02/2005 07:19 PM
Please respond to
"Tomcat Users List" <tomcat-user@jakarta.apache.org>


To Tomcat Users List <tomcat-user@jakarta.apache.org> cc

Subject
Re: Tomcat 5.5.4/Windows 2000 server - Failed to register in JMX:
BasicDataSourceFactory






Hi!

How did you define your JDBC DataSource?
As far as I know, the original jakarta-commons-dbcp and
jakarta-commons-pool-libraries are not included with Tomcat. Instead,
just a subset of the required classes with modified package names
(starting with 'org.apache.tomcat.dbcp') are packed in
'naming-factory-dbcp.jar' that can be found in commons/lib.
But if you configure your JDBC DataSource correctly, this should not
bother. Please post your resource-configuration!

Best regards,
 Tex



I'm running Tomcat 5.5.4 on Windows 2000 Server and encountered the
below





error on Tomcat startup:

Feb 2, 2005 10:50:49 AM org.apache.catalina.core.NamingContextListener
addResource
WARNING: Failed to register in JMX: javax.naming.NamingException:
Could not create resource factory,
ClassNotFoundException:org.apache.commons.dbcp.BasicDataSourceFactory


My webapp uses JDBC DataSource's and the BasicDataSourceFactory for pooling so this problem of "ClassNotFoundException" is causing my webapp to not work properly.

I have Tomcat 5.5.4 also installed on my local maching which has
Windows XP on it, and there is absolutely no problem on startup and
and my


webapp.


Does anyone no what's happening here?  Why does Tomcat register the
BasicDataSourceFactory with no problems in Tomcat 5.5.4 on Windows XP
and





not on Windows 2000 Server?








---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to