You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2006/11/22 15:10:44 UTC

DO NOT REPLY [Bug 41016] New: - tomcat 5.5 multiple contexts using same realm bug

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


DO NOT REPLY [Bug 41016] - tomcat 5.5 multiple contexts using same realm bug

Posted by bu...@apache.org.
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





------- Additional Comments From elliott.murray@greencathedral.com  2006-12-07 03:40 -------
I have investigated this a little further. It seems on startup one of the
applications still has this problem (but not both?!) until I do a reload of the
broken app. A touch on the context xml is all I do. The reload fixes the
problem. I have seen similar behaviour on Windows and Linux on Tomcat 5.5.x.

-- 
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


DO NOT REPLY [Bug 41016] - tomcat 5.5 multiple contexts using same realm bug

Posted by bu...@apache.org.
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





------- Additional Comments From elliott.murray@greencathedral.com  2006-11-28 01:44 -------
(In reply to comment #3)
> Hi
>  Not so sure, when we spotted the "issues". I told elliot to add the
> "localDatasource" attribute to "true" in the *realm* (
>
http://mail-archives.apache.org/mod_mbox/tomcat-users/200611.mbox/%3c2e851c270611220409uebc780agbcc875440d1f9361@mail.gmail.com%3e
> )
> Perhaps it a bug in the bugreport :-)

Apologies and correct. I did add "localDataSource" to the realm - my bug report
does in fact have a bug in it! But App A and App B context's are exactly the
same but for the names/paths. I also do not believe there is a problem with them
as either runs independantly or both sort of work with the localDataSource fix.
I have noticed since I tried this "fix" that sometimes on tomcat start up it
doesn't seem to work and takes a redeploy to resolve the issue. This may be an
error my side (that I am looking at) but is part of some strange behaviour
generally. 


-- 
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


DO NOT REPLY [Bug 41016] - tomcat 5.5 multiple contexts using same realm bug

Posted by bu...@apache.org.
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


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Additional Comments From markt@apache.org  2006-12-09 20:48 -------
If a DataSourceRealm is specified at the Context level and the DataSource
resource is also specified at the Context level (rather than as a global
resource) the localDataSource="true" must be used as per the documentation. Any
unusual behaviour with this configuration when localDataSource="true" is not
specified is irrelevant since the configuration is invalid.

I have created two identical contexts (with just index, login and error JSPs),
both using a DataSourceRealm defined at the context level and both with local
DataSources and both contexts are accessible on Tomcat startup. The report also
mentions the login form for one context being displayed for a second context. I
have also not been able to reproduce this.

I suspect a configuration or possibly an application issue is at the heart of this.

I suggest you try to reproduce this with the simplest possible test WAR rather
than your entire application to rule out any application issues. If you do
reproduce it with a simple test WAR please re-open this report and I'll take
another look.

-- 
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


DO NOT REPLY [Bug 41016] - tomcat 5.5 multiple contexts using same realm bug

Posted by bu...@apache.org.
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





------- Additional Comments From remm@apache.org  2006-11-22 06:53 -------
Before you spend time investigating this "issue", you might want to consider the
"workaround" was to add localDataSource="true" to the Resource element (not the
realm element).

-- 
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


DO NOT REPLY [Bug 41016] - tomcat 5.5 multiple contexts using same realm bug

Posted by bu...@apache.org.
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





------- Additional Comments From olivier@orcades.net  2006-11-25 09:18 -------
Hi
 Not so sure, when we spotted the "issues". I told elliot to add the
"localDatasource" attribute to "true" in the *realm* (
http://mail-archives.apache.org/mod_mbox/tomcat-users/200611.mbox/%3c2e851c270611220409uebc780agbcc875440d1f9361@mail.gmail.com%3e
)
Perhaps it a bug in the bugreport :-)

-- 
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


DO NOT REPLY [Bug 41016] - tomcat 5.5 multiple contexts using same realm bug

Posted by bu...@apache.org.
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





------- Additional Comments From markt@apache.org  2006-11-22 06:27 -------
Please provide the realm config for appB to confirm this is not a configuration
issue.

-- 
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