Sorry if this sounds like I'm taking the piss but I assume you read
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource- examples- howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations
Ideally you deal with all your connection stuff in you model (separate to the web tier) but as you've taken the struts datasource road then the jndi configuration is the closest alternative.
I haven't used the jndi datasource in a year or so but worked fine when I did (TC4.1).
Regarding your original problem, you could use a try catch as a temporary measure with struts datasource and forward to a formatted error page.
Cheers Mark
On 22 Nov 2003, at 23:23, Eric SCHULTZ wrote:
Good evening...
I was afraid you were going to say that. I was so happy to see data-sources
in Struts 'cuz I've been having so much trouble with JNDI in Tomcat.
Other than the Tomcat docs, did you find any other reference that was really
worthwhile? Guess I'm headed back to Google and the archives.
Thanks.
Eric Schultz Technical Leader Conseiller Technique Elix Specialist in interactive business solutions Specialiste en solutions d'affaires interactives 14 Commerce Place, 5th floor Nun's Island, QC H4E 1T5 t: 514 768-1000 f: 514 768-7680
-----Original Message----- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: November 21, 2003 12:25 To: Struts Users Mailing List Subject: Re: Dealing with Initializaing data source exception
If you've been looking through the archives you'll know that datasource in struts config is considered the devil's spawn and its use isn't recommended.
Have a look at you TC docs as configuring a JNDI datasource is web xml.
You could botch a try catch statement that forwards to your error page.
Cheers Mark
On 21 Nov 2003, at 15:56, Eric SCHULTZ wrote:
Good morning..
I'm running a little Struts Application on Tomcat 4.1.27 and
occassionly the
application won't start because of problems connecting to the database.
Is there someway I can I can avoid having this stop my app from running and just catch the error deal with it in the application (like by telling the user "we are technical difficulties, please try again later")?
Here's the portion of the Tomcat log that shows the error:
2003-11-21 10:28:11 StandardWrapper[/DB2StrutsDemo:action]: Marking servlet action as unavailable 2003-11-21 10:28:11 StandardContext[/DB2StrutsDemo]: Servlet /DB2StrutsDemo threw load() exception javax.servlet.UnavailableException: Initializing application data source org.apache.struts.action.DATA_SOURCE
Googling reveals a lot of people have this problem, and there's a lot of help on solving it. But what if you can't solve it and you just want to deal with it?
And I guess the corollary to all this is whether there's some way to "re-start" the datasources later? Just by calling DataSource.getConnection()?
Schultz.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]