tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Ward" <cw...@horizon-asset.co.uk>
Subject Intermittent failures using DataSources
Date Wed, 26 Nov 2003 20:23:12 GMT



Hi all,

Please excuse any going over of old ground with this question, I have
searched every archive
I can find.  I have recently started using DataSources from JSPs using
the JSTL taglib (I think
this is a Tomcat rather than taglib question).

I've got a <Context> for my apps and initially had my bunch of
DataSources set up within
the <Context>.

No problems.  Happy, happy.

Anyway - a few days ago I set up the required database tables to support
a DataSourceRealm
for FORM authentication and I moved all my DataSource config up to the
<GlobalNamingResources>
since I'm sure I read somewhere that this had to be done.

That initially caused me problems until I added a <ResourceLink> to my
<Context> for each DataSource

	. . . . . . 

	<Context path="/hal" docBase="hal" debug="0" privileged="true"
reloadable="true">
	<Logger className="org.apache.catalina.logger.FileLogger" 
		prefix="HAL." suffix=".txt" timestamp="true"/>

		<!-- DataSources moved from here to
GlobalNamingResources area -->

		<Realm
className="org.apache.catalina.realm.DataSourceRealm" debug="99" 
			dataSourceName="jdbc/Id" userTable="HAL_UserId"

			userNameCol="Name" userCredCol="Password" 
			userRoleTable="HAL_UserRole" roleNameCol="Role"
			/>
		<ResourceLink name="jdbc/Id" global="jdbc/Id"
type="javax.sql.DataSource"/>
		<ResourceLink name="jdbc/Static" global="jdbc/Static"
type="javax.sql.DataSource"/>
		<ResourceLink name="jdbc/Params" global="jdbc/Params"
type="javax.sql.DataSource"/>
		<ResourceLink name="jdbc/Control" global="jdbc/Control"
type="javax.sql.DataSource"/>
		<ResourceLink name="jdbc/SelmaData"
global="jdbc/SelmaData" type="javax.sql.DataSource"/>
		<ResourceLink name="jdbc/BartData"
global="jdbc/BartData" type="javax.sql.DataSource"/>
		<ResourceLink name="jdbc/Beauchamp"
global="jdbc/Beauchamp" type="javax.sql.DataSource"/>
	</Context>

	. . . . . . 



All the <DataSources> are set up along these lines..

		. . . . . . 

		<Resource name="jdbc/Id" auth="Container"
type="javax.sql.DataSource"/>
		<ResourceParams name="jdbc/Id">
			<parameter>
				<name>username</name>
				<value>{deleted in mail}</value>
			</parameter>
			<parameter>
				<name>password</name>
				<value>{deleted in mail}</value>>
			</parameter>
			<parameter>
				<name>driverClassName</name>
				<value>com.inet.tds.TdsDriver</value>
			</parameter>
			<parameter>
				<name>url</name>
				<value>{deleted in mail}</value>
			</parameter>
		</ResourceParams>
	
		. . . . . . 


So I think everthing looks okay.


Problems
========

1) With the above setup I get...
--------------------------------

ServerLifecycleListener: createMBeans: MBeanException
java.lang.Exception: ManagedBean is not found with DataSourceRealm
        at
org.apache.catalina.mbeans.MBeanUtils.createMBean(MBeanUtils.java:642)

In my Tomcat console, unless I comment out these lines in server.xml

	<Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
	<Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>

If I *do* comment them out the Tomcat Admin tool will complain.



2) Sometimes my JSPs just start failing with this message...
------------------------------------------------------------

org.apache.jasper.JasperException: Unable to get connection, DataSource
invalid: "Cannot load JDBC driver class 'null'"
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:254)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)

even though they may have been running fine beforehand.



Any help would be great.  Sorry for the length of the message, it's
driving me
crazy!


Many thanks,
Chris





















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


Mime
View raw message