tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bodycombe, Andrew" <andrew.bodyco...@siemens.com>
Subject RE: Using jndi to get a DBCP BasicDataSource give ClassCastExce ption
Date Fri, 05 Sep 2003 15:47:42 GMT
You could try 

		<Resource name="jdbc/SessionDBGlobal" auth="Container"
			type="org.apache.commons.dbcp.BasicDataSource"/>
		<Resource name="jdbc/CommerceDBGlobal" auth="Container"
			type="org.apache.commons.dbcp.BasicDataSource"/>


-----Original Message-----
From: Angus Mezick [mailto:amezick@guidestar.org] 
Sent: 05 September 2003 16:37
To: Tomcat Users List
Subject: RE: Using jndi to get a DBCP BasicDataSource give ClassCastExce
ption


Andrew:  I wish, I don't use * in my imports though.  I have attached
the full tag that causes this error.

Adam: Is there a tag named GlobalResourceLink that I am not aware of?  I
am using ResourceLink as the docs tell me.

--Angus 
(3 A's)

> -----Original Message-----
> From: Bodycombe, Andrew [mailto:andrew.bodycombe@siemens.com] 
> Sent: Friday, September 05, 2003 11:11 AM
> To: 'Tomcat Users List'
> Subject: RE: Using jndi to get a DBCP BasicDataSource give 
> ClassCastExce ption
> 
> 
> I suppose there could be two different classes called 
> BasicDataSource, in
> two different packages...
> 
> -----Original Message-----
> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com] 
> Sent: 05 September 2003 16:03
> To: Tomcat Users List
> Subject: Re: Using jndi to get a DBCP BasicDataSource give
> ClassCastException
> 
> 
> And that was with the GlobalResourceLinK???? That doesn't 
> make sense! If 
> you get BasicDataSource as the class's name, then you won't get a 
> ClassCastException if you try to cast it to that, but you did, so.... 
> er..... wow, you've got me stumped.
> 
> On 09/05/2003 02:31 PM Angus Mezick wrote:
> > I did an I got BasicDataSource.
> > --Angus
> > 
> > 
> >>-----Original Message-----
> >>From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com] 
> >>Sent: Friday, September 05, 2003 4:19 AM
> >>To: Tomcat Users List
> >>Subject: Re: Using jndi to get a DBCP BasicDataSource give 
> >>ClassCastException
> >>
> >>
> >>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>
> >>>>


Mime
View raw message