struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alberto A. Flores" <aaflo...@gmail.com>
Subject Re: Why should we keep
Date Tue, 22 Jan 2008 20:11:52 GMT
The "driverClassName" uses reflection to load the driver appropriately, 
so this sounds like a classloading issue. I'm going to guess that you 
are not including the dbcp jar files (you shouldn't be doing this 
anyway), thus the Tomcat classloader is always looking for the jdbc 
driver in the CATALINA/commons/lib (this is where the DBCP jars are 
located by default in Tomcat as per the documentation, see reference).

In general, you want to keep your jdbc drivers maintained by the 
container (and not the application). Depending on the type of 
architecture you have, you may want to reconsider your need to place 
them in WEB-INF/lib to begin with.


Reference:

http://fresh.t-systems-sfr.com/unix/www/apache-tomcat-5.5.25.tar.gz:a/apache-tomcat-5.5.25/webapps/tomcat-docs/class-loader-howto.html


Sai Reddy wrote:
> Hi Friends,
> I'm using Struts 1.2.7, Tomcat 5.5.25. I'm trying to create a datasource for
> my struts application.
> 
> This is my struts-config.xml file
> 
> ########################################################################
> <struts-config>
>     <data-sources>
>         <data-source type="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
>             <set-property property="driverClassName"
> value="com.mysql.jdbc.Driver" />
>             <set-property property="url"
>             value="jdbc:mysql://localhost:3306/test?autoReconnect=true" />
>             <set-property property="username" value="root" />
>             <set-property property="password" value="santhosh" />
>             <set-property property="maxActive" value="10" />
>             <set-property property="maxWait" value="5000" />
>             <set-property property="defaultAutoCommit"  value="false" />
>             <set-property property="defaultReadOnly" value="false" />
> 
>         </data-source>
>     </data-sources>    
> .
> .
> .
> .
> </struts-config>
> ########################################################################
> 
> When I place "mysql-connector-java-5.0.3-bin.jar" file in "/WEB-INF/lib"
> directory, I get an error saying "com.mysql.jdbc.Driver not found". But when
> I place "mysql-connector-java-5.0.3-bin.jar" file in
> "$CATALINA_HOME/commons/lib" directory, everything works fine!
> 
> Why should we must place the .jar file in "$CATALINA_HOME/commons/lib" only
> rather than in "/WEB-INF/lib". Why is Tomcat unable to find when I place it
> in "/WEB-INF/lib" folder??
> 
> D.Sai Reddy
> VNR VJIET.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

-- 

Alberto A. Flores
http://www.linkedin.com/in/aflores



Mime
View raw message