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=33186>.
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=33186

           Summary: JAASRealm uses WebApp classloader even if
                    useContextClassloader is "true"
           Product: Tomcat 5
           Version: 5.0.28
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina:Modules
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


JAASRealm searches the WebApp classloader during authentication even with 
useContextClassLoader="true".  This is the case in the standard single instance 
configuration ($CATALINA_BASE unset) and the multiple-instance configuration 
($CATALINA_BASE set and != $CATALINA_HOME).  Probably a result of feature 
enhancement bug 29406.

Expected behavior is that with useContextClassLoader="true" JAAS authentication 
uses classes from $CATALINA_HOME/server/lib (and JDBC Driver from 
$CATALINA_HOME/common/lib) and WebApp uses classes from 
$CATALINA_BASE/webapps/myWebApp/... using its WebApp classloader.  

Observed behavior is NoClassDefError during JAAS authentication (Hibernate 
trying to load application classes that exist in both $CATALINA_HOME/server/lib 
and $CATALINA_BASE/webapps/myWebApp/... ). 

Verification #1: Confirmed by debugging the code and inspecting 
Thread.currentThread().getContextClassLoader() in code just before 
NoClassDefError is thrown (during execution of LoginContex.login() -> 
LoginContext.invoke() -> our JAAS module execution). Classloader identifies 
itself as the WebApp class loader and has settings and parents appropriate to 
that designation.

Verification #2: The exact same setup works perfectly if we set 
useContextClassloader="false".

Verifcation #3: Removing certain classes and jars from webapps/myWebApp fixes 
the NoClassDefError and allows login/authentication to proceed with 
useContextClassloader="true".  


What is puzzling is why the WebApp classloader is unable to load the user class 
in the original configuration.  It must be in some odd state because with 
useContextClassloader="false" it has access to exactly the same set of classes 
and works.

Setup:

Oracle JDBC drivers (classes12.jar and ojdbc14.jar) in $CATALINA_HOME/common/lib
Custom JAAS module libraries and support (including Hibernate 2.1.7c) in 
$CATALINA_HOME/server/lib/oracle-auth.jar
JAVA_OPTS=-Djava.security.auth.login.config=${CATALINA_HOME}/bin/login.conf
login.conf in $CATALINA_HOME/bin

WebApp myWebApp installed as $CATALINA_BASE/webapps/myWebApp.war (auto-exploded 
into $CATALINA_BASE/webapps/myWebApp/)
myWebApp.war contains all the classes included in oracle-auth.jar plus JDBC 
drivers and additional libraries.

Config files attached.

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to