Add JbossWebXmlReader to the tomcat server.xml config file:

<Server>
...
      <!-- ==================== Interceptors ==================== -->
        <!-- 
         ContextInterceptor className="org.apache.tomcat.context.LogEvents" 
         -->
        
        <ContextInterceptor className="org.apache.tomcat.context.AutoSetup" />

        <ContextInterceptor 
            className="org.apache.tomcat.context.WebXmlReader" />

        <ContextInterceptor 
            className="org.apache.tomcat.context.LoaderInterceptor" />
        <ContextInterceptor 
            className="org.apache.tomcat.context.DefaultCMSetter" />
        <ContextInterceptor 
            className="org.apache.tomcat.context.WorkDirInterceptor" />
        <ContextInterceptor 
            className="org.jboss.tomcat.naming.JbossWebXmlReader" />

        <!-- Request processing -->
        <!-- Session interceptor will extract the session id from cookies and 
             deal with URL rewriting ( by fixing the URL ).  If you wish to
             suppress the use of cookies for session identifiers, change the
             "noCookies" attribute to "true"
          -->
        <RequestInterceptor 
            className="org.apache.tomcat.request.SessionInterceptor"
            noCookies="false" />

        <!-- Find the container ( context and prefix/extension map ) 
             for a request.
          -->
        <RequestInterceptor 
            className="org.apache.tomcat.request.SimpleMapper1" 
            debug="0" />

        <!-- Non-standard invoker, for backward compat. ( /servlet/* )
             You can modify the prefix that is matched by adjusting the
             "prefix" parameter below.  Be sure your modified pattern
             starts and ends with a slash.

             NOTE:  This prefix applies to *all* web applications that
             are running in this instance of Tomcat.
          -->
        <RequestInterceptor 
            className="org.apache.tomcat.request.InvokerInterceptor" 
            debug="0" prefix="/servlet/" />

        <!-- "default" handler - static files and dirs.  Set the
             "suppress" property to "true" to suppress directory listings
             when no welcome file is present.

             NOTE:  This setting applies to *all* web applications that
             are running in this instance of Tomcat.
          -->
        <RequestInterceptor 
            className="org.apache.tomcat.request.StaticInterceptor" 
            debug="0" suppress="false" />

        <!-- Plug a session manager. You can plug in more advanced session
             modules.
          -->
        <RequestInterceptor 
            className="org.apache.tomcat.session.StandardSessionInterceptor" />

        <!-- Check if the request requires an authenticated role.
          -->
        <RequestInterceptor 
            className="org.apache.tomcat.request.AccessInterceptor" 
            debug="0" />

       <!-- Check permissions using the simple xml file. You can 
             plug more advanced authentication modules.
          -->
        <RequestInterceptor 
            className="org.apache.tomcat.request.SimpleRealm" 
            debug="0" />

  <!-- jBoss -->
        <RequestInterceptor
            className="org.apache.tomcat.request.Jdk12Interceptor" />

        <!-- Loaded last since JSP's that load-on-startup use request handling -->
        <ContextInterceptor 
            className="org.apache.tomcat.context.LoadOnStartupInterceptor" />

      <!-- ==================== Connectors ==================== -->
...
</Server>

With this and updated versions of the petstore patches I am able to run the petstore
app against a cloudscape db. Attempting to login is back to throwing a NPE because
the context principal is not being set so I have to track this down.

----- Original Message ----- 
From: "Anatoly Akkerman" <[EMAIL PROTECTED]>
To: "JBoss-Dev" <[EMAIL PROTECTED]>; "jboss-user mailing list" 
<[EMAIL PROTECTED]>
Sent: Sunday, February 18, 2001 10:03 AM
Subject: [jBoss-Dev] latest tomcat-service.jar broke JNDI namespace integration


> 
> Hello, everybody
> 
> I am one of the people fighting with the PetStore. After having figured
> out that EmbeddedTomcat was not handling form-based logins and the
> prevented PetStore from functioning, I followed the advice of Scott M
> Stark to upgrade to the latest tomcat-service snapshot. Indeed, I
> preceeded in that direction. It turns out, that the latest snapshot of
> tomcat-service.jar breaks JNDI integration between Tomcat and JBoss
> (though it does fix form-based logins, as advertised).
> 
> I tried to fix that myself. Here is what I did and problems I ran into. At
> this moment I'm stuck.
> 
> 1. I've tried adding JbossWebXmlReader interceptor to Tomcat's
> ContextManager as soon as TomcatEntry creates it in execute() method.
> 
> 3. PROBLEM. Trying to run this caused an exception when JbossWebXmlReader
> tries to get ServletLoader from the Context upon a initContext() call into
> it. I get a null pointer exception. Presumably, TomCat has not initialized
> the ServletLoader at this moment for this context and will do it sometime
> later.
> 
> 4. Attempt to fix: I tried simply removing this line from
> JbossWebXmlReader (it was needed to set current thread's
> ContextClassLoader and keep mapping between the classloader and document
> base, since I was not sure how it was being used, I commented it out,
> stupid, but what the heck!) This prevented the exception, jboss-web.xml
> was read by TomCat, but my problem -- that a servlet failed on JNDI lookup
> for the SecurityAdapter classname -- was not resolved. So, I guess that
> knowing the classloader was essential for proper operation of JNDI (sorry 
> for my illiteracy in this, I am very new to J2EE and related technologies,
> have to learn on the fly by trial and error)
> 
> I've looked around a bit how to obtain the classloader that
> JbossWebXmlReader wants but at this moment I did not figure this out, so
> anyone has suggestions?
> 
> 
> -------------------------------------------------------------------------
> Anatoly Akkerman
> Computer Science Dept.
> Courant Institute of Mathematical Sciences, NYU
> 719 Broadway, #715                      Tel: 212 998-3525
> New York, NY 10003                      Fax: 212 995-4123
> -------------------------------------------------------------------------
> 
> 
> 
> 
> 


Reply via email to