tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony J. Biacco" <abia...@formatdynamics.com>
Subject RE: DB connection error -Tomcat 6 config
Date Thu, 04 Mar 2010 16:53:18 GMT
If you're still getting the error:
"Could not create resource factory instance [Root exception is
java.lang.InstantiationException :
org.apache.tomcat.dbcp.dbcp.DataSourceConnectionFactory"

Make sure you have tomcat-dbcp.jar in your tomcat/lib. The .dbcp.dbcp.
factory comes from that jar (versus just plain .dbcp. which comes from
the separate commons-dbcp jar)
If for some reason you want to use commons-dbcp and not tomcat-dbcp
(like me), you can set your tomcat startup options to include this:
-Djavax.sql.DataSource.Factory=org.apache.commons.dbcp.BasicDataSourceFa
ctory
I needed to do that for the eclipselink stuff when I ripped tomcat-dbcp
out of tomcat.


-Tony
---------------------------
Manager, IT Operations
Format Dynamics, Inc.
303-573-1800x27
abiacco@formatdynamics.com
http://www.formatdynamics.com

> -----Original Message-----
> From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> Sent: Monday, March 01, 2010 2:50 PM
> To: 'Tomcat Users List'
> Subject: RE: DB connection error -Tomcat 6 config
> 
> 
> 
> >>>>>>1. Quadruple-check that you have your JDBC driver only in one
> place (in Tomcat's /lib directory) 2. Remove all unnecessary
> configuration from >>>>>>your <Resource> element:
> >>>>>>just (simple) URL, driver class, username and password, just
to
> get things started.
> 
> >>Good luck,
> >>- -chris
> 
> Ok, I did this - blew away the 6.0.24 collection, and re-started with
> 6.0.18.
> 
> Using the below reference, I can create an adequate connection in a
> servlet or JSP, hitting the DB just fine.
> 
> If I try to reference the resource reference in the webapps/META-
> INF/context.xml file,
> I get the following error:
> 
> (on startup, the console shows)
> Mar 1, 2010 3:18:05 PM org.apache.catalina.core.NamingContextListener
> addResource
> WARNING: Failed to register in JMX: javax.naming.NamingException:
Could
> not crea
> te resource factory instance [Root exception is
> java.lang.InstantiationException
> : org.apache.tomcat.dbcp.dbcp.DataSourceConnectionFactory]
> 
> 
> Other error snippets in attempts to reference the res-ref data
include:
> 
> javax.servlet.ServletException: javax.naming.NamingException: Could
not
> create resource factory instance [Root exception is
> java.lang.InstantiationException:
> org.apache.tomcat.dbcp.dbcp.DataSourceConnectionFactory]
>
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(P
> ageContextImpl.java:852)
> 
> javax.naming.NamingException: Could not create resource factory
> instance [Root exception is java.lang.InstantiationException:
> org.apache.tomcat.dbcp.dbcp.DataSourceConnectionFactory]
>
org.apache.naming.factory.ResourceFactory.getObjectInstance(Resou
> rceFactory.java:102)
>
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.ja
> va:304)
> 	org.apache.naming.NamingContext.lookup(NamingContext.java:793)
> 
> java.lang.InstantiationException:
> org.apache.tomcat.dbcp.dbcp.DataSourceConnectionFactory
> 	java.lang.Class.newInstance0(Class.java:340)
> 	java.lang.Class.newInstance(Class.java:308)
>
org.apache.naming.factory.ResourceFactory.getObjectInstance(Resou
> rceFactory.java:98)
>
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.ja
> va:304)
> 
> 
> Looking at the log showed basically the same:
> SEVERE: Servlet.service() for servlet jsp threw exception
> java.lang.InstantiationException:
> org.apache.tomcat.dbcp.dbcp.DataSourceConnectionFactory
> 	at java.lang.Class.newInstance0(Class.java:340)
> 	at java.lang.Class.newInstance(Class.java:308)
> 
> If I omit the factory reference, TC doesn't seem to like that at all
--
> didn't really with the 6.0.24 experiment either.
> 
> But I'm open to suggestions if anyone has something I overlooked. FYI,
> I left the web.xml file in the webapps folder void of any resource
> reference.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message