tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: Using jndi to get a DBCP BasicDataSource give ClassCastException
Date Fri, 05 Sep 2003 08:19:29 GMT
Hi Angus,
looked at your first mail and couldn't see anything wrong with it. I can 
only suggest that you do some debugging, like output the 
.getClass().getName() from the datasource, to see what it really thinks 
it is.

Adam

On 09/04/2003 10:27 PM Angus Mezick wrote:
> Anyone have a clue as to whether or not this is a Real bug, or am I just
> screwing something up?
> 
> 
>>-----Original Message-----
>>From: Angus Mezick 
>>Sent: Wednesday, September 03, 2003 4:32 PM
>>To: tomcat-user@jakarta.apache.org
>>Subject: Using jndi to get a DBCP BasicDataSource give 
>>ClassCastException
>>
>>
>>I am having problems with the GlobalNamingResources.  If I 
>>put my two DB
>>resource entries into the GlobalNamingResources section and just use
>>Resource-Links to access them I cannot cast from DataSource to
>>BasicDataSource.. I need to do this to use this line in my monitoring
>>app: (I can still use the Datasources to get talk to the DB, just not
>>recast it from the interface to the concrete class)
>>
>>pageContext.getOut().println(" jdbc/CommerceDB:  Active: " +
>>((BasicDataSource)ds).getNumActive() + " Idle: " +
>>((BasicDataSource)ds).getNumIdle() + "<br>");
>>
>>If I define the resources directly in the Context everything 
>>works fine.
>>ARGH!  Here is my server.xml snippets:
>>
>>	<GlobalNamingResources>
>>		<Resource name="jdbc/SessionDBGlobal" auth="Container"
>>			type="javax.sql.DataSource"/>
>>		<Resource name="jdbc/CommerceDBGlobal" auth="Container"
>>			type="javax.sql.DataSource"/>
>>		<ResourceParams name="jdbc/SessionDBGlobal">
>>			<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>5</value>
>>			</parameter>
>>			<parameter>
>>				<name>maxWait</name>
>>				<value>10000</value>
>>			</parameter>
>>			<parameter>
>>				<name>username</name>
>>				<value></value>
>>			</parameter>
>>			<parameter>
>>				<name>password</name>
>>				<value></value>
>>			</parameter>
>>			<parameter>
>>				<name>driverClassName</name>
>>				<value>com.inet.tds.TdsDriver</value>
>>			</parameter>
>>			<parameter>
>>				<name>url</name>
>>				<value>jdbc:inetdae7a:IPADDR</value>
>>			</parameter>
>>			<parameter>
>>				<name>validationQuery</name>
>>				<value>select top 1 name from
>>syscolumns</value>
>>			</parameter>
>>			<parameter>
>>				<name>removeAbandoned</name>
>>				<value>true</value>
>>			</parameter>
>>			<parameter>
>>				<name>removeAbandonedTimeout</name>
>>				<value>300</value>
>>			</parameter>
>>			<parameter>
>>				<name>logAbandoned</name>
>>				<value>true</value>
>>			</parameter>
>>			<parameter>
>>	
>><name>timeBetweenEvictionRunsMillis</name>
>>				<value>60000</value>
>>			</parameter>
>>			<parameter>
>>				<name>testOnBorrow</name>
>>				<value>true</value>
>>			</parameter>
>>			<parameter>
>>				<name>testWhileIdle</name>
>>				<value>true</value>
>>			</parameter>
>>		</ResourceParams>
>>		<ResourceParams name="jdbc/CommerceDBGlobal">
>>			<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>5</value>
>>			</parameter>
>>			<parameter>
>>				<name>maxWait</name>
>>				<value>10000</value>
>>			</parameter>
>>			<parameter>
>>				<name>username</name>
>>				<value></value>
>>			</parameter>
>>			<parameter>
>>				<name>password</name>
>>				<value></value>
>>			</parameter>
>>			<parameter>
>>				<name>driverClassName</name>
>>				<value>com.inet.tds.TdsDriver</value>
>>			</parameter>
>>			<parameter>
>>				<name>url</name>
>>				<value>jdbc:inetdae7a:IPADDR</value>
>>			</parameter>
>>			<parameter>
>>				<name>validationQuery</name>
>>				<value>select top 1 name from
>>syscolumns</value>
>>			</parameter>
>>			<parameter>
>>				<name>removeAbandoned</name>
>>				<value>true</value>
>>			</parameter>
>>			<parameter>
>>				<name>removeAbandonedTimeout</name>
>>				<value>300</value>
>>			</parameter>
>>			<parameter>
>>				<name>logAbandoned</name>
>>				<value>true</value>
>>			</parameter>
>>			<parameter>
>>	
>><name>timeBetweenEvictionRunsMillis</name>
>>				<value>60000</value>
>>			</parameter>
>>			<parameter>
>>				<name>testOnBorrow</name>
>>				<value>true</value>
>>			</parameter>
>>			<parameter>
>>				<name>testWhileIdle</name>
>>				<value>true</value>
>>			</parameter>
>>		</ResourceParams>
>>	</GlobalNamingResources>
>>
>>---- 8< ---- 8<  ----
>>			<Host name="wwwHOST_NAME.guidestar.net"
>>debug="1"
>>				appBase="/Guidestar/" unpackWARs="true"
>>autoDeploy="true">
>>				<Logger
>>className="org.apache.catalina.logger.FileLogger"
>>					directory="logs"
>>prefix="wwwHOST_NAME_log." suffix=".txt"
>>					timestamp="true"/>
>>				<Context path="" reloadable="true"
>>	
>>docBase="C:\GuideStar\GsMain\web"
>>	
>>workDir="C:\GuideStar\GsMain\web\work\org\apache\jsp"
>>					debug="1">
>>					<Manager
>>	
>>className="org.apache.catalina.session.JdbcSessionManager"
>>						debug="1"
>>maxInactiveInterval="1800" maxIdleSwap="-1"
>>						maxIdleBackup="-1"
>>checkInterval="60"
>>						useDirtyFlag="true"
>>reaper="yes">
>>					</Manager>
>>					<InstanceListener>
>>	
>>org.apache.catalina.session.JdbcSessionInstanceListener</Insta
>>nceListene
>>r>
>>					<Loader
>>className="org.apache.catalina.loader.DevLoader"
>>						reloadable="true"
>>debug="1"/>
>>					<ResourceLink
>>name="jdbc/SessionDB"
>>	
>>global="jdbc/SessionDBGlobal"
>>	
>>type="javax.sql.DataSource"/>
>>					<ResourceLink
>>name="jdbc/CommerceDB"
>>	
>>global="jdbc/CommerceDBGlobal"
>>	
>>type="javax.sql.DataSource"/>
>>				</Context>
>>			</Host>
>>		</Engine>
>>	</Service>
>></Server>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

-- 
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9


Mime
View raw message