Menu

Struts-Resume JNDI datasource problem

2003-06-26
2003-06-26
  • Richard Mixon

    Richard Mixon - 2003-06-26

    I thought I would report one small problem we are having with an applicaition that uses Sruts-Resume as a pattern.  We are in the process of preparing our application for production at our hosting provider (http://www.MMAWeb.com - these guys are awesome, read on).

    We are using MySQL and Tomcat 4.1.24 on a Sun SPARC Solaris environment. We noticed that after a some period of inacctivity, if a new user tried to logon we would get an exception with an SQLState of 08S01 (lost connection to database).

    OK,  I checked and "oops" somehow had removed the "?autoReconnect=true" parm from the JDBC URL in  tomcat-setup.xml file that gets customized and copied into the Tomcat webapps directory as "appname.xml".

    I figured that was easy enough to fix. But NO,  the next day we get the same error. I'm really perplexed. I sent a support request to the MMA describing the problem.

    This morning I get a note back from Bill Newell (MMA support). He has figured out that "?autoReconnect=true" does not work if it is specified in a datasource that is in "appname.xml". He's tried moving the datasource definition to conf/server.xml and now everything works fine. That is what I call EXCELLENT, proactive customer support - never seen anything like it at other hosting sites.

    I did some checking on the Tomcat Bugzilla site and found an issue that seems to cover this: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16316

    There's a good bit of discussion over whether it should be fixed. The argument against is that JDBCRealms are really a container-level resource/specification, not an application. There's good argument the other way also.

    Anyway, FWIW, hope this helps someone avoid the problem.

    Also, could the Struts-Resume documentation be updated to mention this issue somehow?

    - Richard

     
    • Matt Raible

      Matt Raible - 2003-06-26

      Are you using virtual hosts in Tomcat?  I've found that if you're using virtual hosts, you must specify the context information with the <host> element, rather than in webapps/appname.xml. 

      As for documentation - here's the main wiki page:

      http://raibledesigns.com/wiki/Wiki.jsp?page=StrutsResume

      And the support page:

      http://raibledesigns.com/wiki/Wiki.jsp?page=StrutsResumeSupport

       
    • Richard Mixon

      Richard Mixon - 2003-06-26

      No, not using virtual hosts - I've got my own private copy of Tomcat - with conf, common, server, webapps, logs, etc.

      Thanks, I will update the Wiki, once I have a better handle on the complete solution. Right now it seems there is a conflict between having autoReconnect=true and autoCommit=false (which I need for transactions).

      Still trying to figure this out. I believe that the 0S801 MySQL timeout occurs only using container managed authentication with the JDBCRealm, NOT for application access via the JNDI datasource. In that case I can probably use "autoReconnect=true" on the  JDBCRealm and ommit this on the JNDI datasource. I'm testing this out now - but will have to wait at least 8 hours to see if it really works :) (of course I may try setting the MySQL timeout to less than 8 hrs to speed this up).

      Thanks for the response.

       

Log in to post a comment.