--- "Fumo, Vince" <[EMAIL PROTECTED]> wrote:
> Thank you David, I gave that a shot and I made some headway, however,
> now at
> Tomcat startup (and obvioulsy Struts startup) I'm getting an exception
> that
> basicly states "Cannot load JDBC driver class 'null'" (full startup is
> below). I'm sure I have my struts-config correct and I have the JDBC
> driver
> in the WEB-INF/lib directory and also the tomcat common/lib directory.
> Any
> ideas on where I'm messed up this time?

It may be a classloader issue with having commons-dbcp installed in
several places.  Configuring DataSources is really the container's
responsibility so I highly recommend you configure this in JNDI instead of
struts-config.xml.  You can remove commons-dbcp.jar, commons-pool.jar, and
your database driver from your lib directory if you do this.  Install the
driver in tomcat's common/lib directory.  

You configure JNDI DataSources in Tomcat's server.xml file.  A good
tutorial can be found here:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

David

> 
> <relevant struts-config>
> 
> <!-- ==================================== Data Source Configuration -->
> 
> <data-sources>
> <data-source type="org.apache.commons.dbcp.BasicDataSource">
>       <set-property property="description"            value="MySQL
> datasource" />
>     <set-property property="driverClass"
> value="com.mysql.jdbc.Driver" />  
>     <set-property property="url"
> value="jdbc:mysql://localhost/ed_test" />  
>     <set-property property="username"                 value="ed-web" />
>     <set-property property="password"                 value="dashboard" />
>       <set-property property="maxActive"                      value="10"
> />
>     <set-property property="maxCount"                 value="10" />
>     <set-property property="minCount"                 value="2" />  
>       <set-property property="maxWait"                        value="5000"
> />                    
>       <set-property property="defaultAutoCommit"      value="false" />
>       <set-property property="defaultReadOnly"        value="false" />
>       <set-property property="validationQuery"        value="SELECT
> COUNT(*) FROM family" />
> </data-source>
> </data-sources>
> 
> <the tomcat startup log>
> 
> Starting service Tomcat-Standalone
> Apache Tomcat/4.1.24
> Aug 22, 2003 3:28:47 PM org.apache.struts.util.PropertyMessageResources
> <init>
> INFO: Initializing, config='org.apache.struts.util.LocalStrings',
> returnNull=true
> Aug 22, 2003 3:28:47 PM org.apache.struts.util.PropertyMessageResources
> <init>
> INFO: Initializing, config='org.apache.struts.action.ActionResources',
> returnNull=true
> Aug 22, 2003 3:28:47 PM org.apache.struts.util.PropertyMessageResources
> <init>
> INFO: Initializing, config='resources.application', returnNull=true
> Aug 22, 2003 3:28:47 PM org.apache.struts.action.ActionServlet
> initModuleDataSources
> SEVERE: Initializing application data source
> org.apache.struts.action.DATA_SOURCE
> java.sql.SQLException: Cannot load JDBC driver class 'null'
>         at
>
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav
> a:529)
>         at
>
org.apache.commons.dbcp.BasicDataSource.setLogWriter(BasicDataSource.java:38
> 1)
>         at
>
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
> ava:1087)
>         at
> org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
>         at javax.servlet.GenericServlet.init(GenericServlet.java:256)
>         at
>
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
> 5)
>         at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
>         at
>
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
> 3420)
>         at
>
org.apache.catalina.core.StandardContext.start(StandardContext.java:3608)
>         at
>
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
> 21)
>         at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
>         at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:579)
>         at
>
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
> ava:307)
>         at
> org.apache.catalina.core.StandardHost.install(StandardHost.java:772)
>         at
>
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559
> )
>         at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401)
>         at
> org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
>         at
>
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358)
>         at
>
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
> t.java:166)
>         at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
>         at
> org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
>         at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
>         at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
>         at
> org.apache.catalina.core.StandardService.start(StandardService.java:497)
>         at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
>         at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
>         at
> org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
>         at
> org.apache.catalina.startup.Catalina.process(Catalina.java:180)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
>         at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
> 
> 
> 
> 
> -----Original Message-----
> From: David Graham [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 22, 2003 2:17 PM
> To: Struts Users Mailing List
> Subject: RE: <data source> problems
> 
> 
> --- "Fumo, Vince" <[EMAIL PROTECTED]> wrote:
> > Yes..I know that I can include the legacy jar but I don't want to. I'd
> > prefer to not use depreciated librarys in my app. The thing I'm
> confused
> > about is that I'm not sure how I'm even using GenericDataSource at
> all.
> > I
> > thought that by explicitly using the BasicDataSource I would be
> avoiding
> > this problem.
> 
> Having the jar in your lib directory doesn't mean you're using
> deprecated
> functionality.  Indeed, you're not even using GenericDataSource.  You
> must
> install that jar because Struts uses it internally.  It has been removed
> for 1.2.
> 
> David
> 
> > 
> > -----Original Message-----
> > From: David Graham [mailto:[EMAIL PROTECTED]
> > Sent: Friday, August 22, 2003 1:08 PM
> > To: Struts Users Mailing List
> > Subject: Re: <data source> problems
> > 
> > 
> > --- "Fumo, Vince" <[EMAIL PROTECTED]> wrote:
> > > Hi all. I'm sure this has been asked before but I can't seem to find
> > it
> > > in
> > > the archives.
> > > 
> > > I'm building a simple web app and I want to use a connection pool.
> > I've
> > > decided to use the commons dbcp BasicDataSource class
> > > (org.apache.commons.dbcp.BasicDataSource). Here is the struts-config
> > I'm
> > > using (based on the one from the struts faq) :
> > > 
> > > <data-sources>
> > > <data-source type="org.apache.commons.dbcp.BasicDataSource">
> > >     <set-property property="autoCommit"  value="true" />
> > >  <set-property property="description" value="MySQL datasource" />
> > >     <set-property property="driverClass"
> value="com.mysql.jdbc.Driver"
> > > />
> > >     <set-property property="maxCount"  value="10" />
> > >     <set-property property="minCount"  value="2" />
> > >     <set-property property="username"  value="username" />
> > >     <set-property property="password"  value="password" />
> > >     <set-property property="url"
> > > value="jdbc:mysql://localhost:3306/databasename" />
> > > </data-source>
> > > </data-sources>
> > > 
> > > I have placed the following jars in my \WEB-INF\lib folder :
> > > 
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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

Reply via email to