tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41016] New: - tomcat 5.5 multiple contexts using same realm bug
Date Wed, 22 Nov 2006 14:10:44 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41016>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41016

           Summary: tomcat 5.5 multiple contexts using same realm bug
           Product: Tomcat 5
           Version: Unknown
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: elliott.murray@greencathedral.com


I am trying to set up multiple contexts in Tomcat 5.5 but have a problem in
logging in. I have them both up and running. They both use realms for login
functionality. I wanted to originally use my own custom data source realm
(limitations in the use of the Catalina one) This was working fine for App A but
as soon as I put up App B using the same code but a different configuration
(different tables, jdbc connections etc) I had some strange results. I would get
the login page for App A turning up in App B and vice versa on what seemed
random conditions. Login would only work on one App at a time in best case
scenario. I then regressed back to using the DataSourceRealm but have the same
results. If I use one of each it seems to work in that the correct login pages
appear and I can log into one of the sites (though due to my sql requirements
can only actually log into one app as the DataSourceRealm isn't quite flexible
enough for either of my apps) 

Other notes. They are both FORM login types in web.xml. Example context config
below:

<Context
    docBase="C:/webapps/app1"
    reloadable="true"
    workDir="C:\Java\Tomcat5.5\work">    
  
  <Realm className="org.apache.catalina.realm.DataSourceRealm" debug="99"
        dataSourceName="jdbc/App1MySQLDB"
           userTable="member" userNameCol="email" userCredCol="password"
      userRoleTable="schemes" roleNameCol="name"/>
  
  <Resource
    auth="Container"
    name="jdbc/App1MySQLDB"
    type="javax.sql.DataSource"
    password="xxx"
    driverClassName="com.mysql.jdbc.Driver"
    maxIdle="5"
    maxWait="10000"
    removeAbandoned="true"
    logAbandoned="true"
    username="user"
    url="jdbc:mysql://a-url"
    removeAbandonedTimeout="60"
    factory="org.apache.commons.dbcp.BasicDataSourceFactory"
    maxActive="20"/>
</Context>

The workaround I have found (with help from mailing list) was to add the parameter

localDataSource="true"

to the resource (default is false). There are no GlobalNamingResources
parameters in server xml. A strong suspicion that there is a jndi issue here: 
http://svn.apache.org/repos/asf/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/DataSourceRealm.java
 in the connection open() method.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message