You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Aman Nanner/MxI Technologies <am...@mxi.com> on 2007/03/02 07:27:42 UTC

Re: Adding Tomcat Valve specific web apps

Ok, I figured out how to get this to work!

I leave my existing Tomcat Valves that are defined in my config.xml as is.
I then add the web-app specific Tomcat Valve as a GBean in my
geronimo-web.xml, and reference that GBean from the <valve-chain> element.
So my original valves are defined in config.xml as follows:

---
        <gbean name="FirstValve">
            <attribute
name="className">org.apache.catalina.valves.AccessLogValve</attribute>
            <attribute name="initParams">prefix=0.0.0.0_access_log.
            suffix=.txt
            pattern=common</attribute>
            <reference name="NextValve">
                <pattern>
                    <name>SecondValve</name>
                </pattern>
            </reference>
        </gbean>
        <gbean gbeanInfo="org.apache.geronimo.tomcat.ValveGBean"
name="org.apache.geronimo.configs/tomcat/1.2-SNAPSHOT/car?ServiceModule=org.apache.geronimo.configs/tomcat/1.2-SNAPSHOT/car,j2eeType=GBean,name=SecondValve">
            <attribute
name="className">org.apache.catalina.authenticator.SingleSignOn</attribute>
        </gbean>
---


My web-app specific Tomcat Valve is then defined in the geronimo-web.xml
for my web-app like this:

---
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1"
xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1"
xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1"
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
   <cross-context />
   <valve-chain>BasicAuthValve</valve-chain>
   <security-realm-name>MaintenixRealm</security-realm-name>
   <sys:gbean name="BasicAuthValve"
class="org.apache.geronimo.tomcat.ValveGBean">
      <sys:attribute
name="className">org.apache.catalina.authenticator.BasicAuthenticator</sys:attribute>
      <sys:attribute
name="initParams">disableProxyCaching=false</sys:attribute>
   </sys:gbean>
</web-app>
---



                                                                           
             Aman Nanner/MxI                                               
             Technologies                                                  
             <aman.nanner@mxi.                                          To 
             com>                      user@geronimo.apache.org            
                                                                        cc 
             02-27-2007 01:50                                              
             PM                                                    Subject 
                                       Re: Adding Tomcat Valve specific    
                                       web apps                            
             Please respond to                                             
             user@geronimo.apa                                             
                  che.org                                                  
                                                                           
                                                                           
                                                                           




Is the <valve-chain> element supposed to refer to a GBean valve name?  I've
tried this but I'm getting deployment errors.

I have defined the following valve chain in my config.xml

----
            <gbean name="FirstValve">
                  <attribute
name="className">org.apache.catalina.valves.AccessLogValve</attribute>
                  <attribute name="initParams">prefix=0.0.0.0_access_log.
                  suffix=.txt
                  pattern=common</attribute>
                  <reference name="NextValve">
                        <pattern>
                              <name>SecondValve</name>
                        </pattern>
                  </reference>
            </gbean>
            <gbean
name="org.apache.geronimo.configs/tomcat/1.2-SNAPSHOT/car?ServiceModule=org.apache.geronimo.configs/tomcat/1.2-SNAPSHOT/car,j2eeType=GBean,name=SecondValve"

 gbeanInfo="org.apache.geronimo.tomcat.ValveGBean">
                  <attribute
name="className">org.apache.catalina.authenticator.SingleSignOn</attribute>
            </gbean>
            <gbean
name="org.apache.geronimo.configs/tomcat/1.2-SNAPSHOT/car?ServiceModule=org.apache.geronimo.configs/tomcat/1.2-SNAPSHOT/car,j2eeType=GBean,name=BasicAuthValve"

 gbeanInfo="org.apache.geronimo.tomcat.ValveGBean">
                  <attribute
name="className">org.apache.catalina.authenticator.BasicAuthenticator</attribute>

                  <attribute
name="initParams">disableProxyCaching=false</attribute>
                  <reference name="NextValve">
                        <pattern>
                              <name>FirstValve</name>
                        </pattern>
                  </reference>
            </gbean>
----


The config.xml defines a default valve chain consisting of "FirstValve" and
"SecondValve".  Now, in certain specific web apps, I want to define the
<valve-chain> element in the geronimo.web.xml so that I can extend this
valve chain with another valve, but just for the specific web app.  In the
geronimo-web.xml, I will add the following element:

----
<valve-chain>BasicAuthValve</valve-chain>
----

I'm hoping that this "pre-appends" the BasicAuthValve valve to the valve
chain, since the BasicAuthValve has the "FirstValve" as a GBean reference.

As I stated before, I'm getting a deployment error when this occurs:

----
     [java]       The service
     [java]
J2EEApplication=Mxi/Maintenix/1/ear,j2eeType=WebModule,name=induction.war
     [java]     did not start because
     [java]
Mxi/Maintenix/1/ear?J2EEApplication=Mxi/Maintenix/1/ear,WebModule=induction.war,j2eeType=TomcatValve,name=BasicAuthValve

     [java]     did not start.
----

It seems that the deployer is trying look for the BasicAuthValve GBean in
the web app itself.  Anybody have any ideas on how I can get this working?

Thanks,
Aman

Aman Nanner/MxI Technologies <am...@mxi.com> wrote on 02-21-2007
04:58:27 PM:

>
> Hello,
>
> I'm deploying an application EAR file on Geronimo 1.2-beta.  This EAR
> contains several web applications.  When we deploy this application in
> JBoss, we have a META-INF/context.xml file in each web app that lets us
> specify Tomcat valves that only apply to that web app in particular.  We
> would like to do the same thing with Tomcat in Geronimo.
>
> Upon examining the geronimo-tomcat-1.1.xsd descriptor (which is the
schema
> we are using for the geronimo-web.xml), I noticed that there is a
> <tomcat:valve-chain> element.  This would appear to be the element that
> would offer the functionality that we are looking for.  However, it is
only
> defined as a "string" type, and I'm not sure how I'm supposed to specify
> the valve(s) in here.  Also, do these valves get used in addition to the
> valves that are specified in config.xml?  If anybody has any knowledge in
> this area, please let me know.
>
> Thanks,
> Aman
>
>
__________________________________________________________________________________


> * This message is intended only for the use of the individual or
> entity to which it is addressed, and may contain information that is
> privileged, confidential and exempt from disclosure under applicable
> law. Unless you are the addressee (or authorized to receive for the
> addressee), you may not use, copy or disclose the message or any
> information contained in the message. If you have received this
> message in error, please advise the sender by reply e-mail , and
> delete the message, or call (collect) 001 613 747 4698. *
>

__________________________________________________________________________________

* This message is intended only for the use of the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential and exempt from disclosure under applicable law. Unless you
are the addressee (or authorized to receive for the addressee), you may not
use, copy or disclose the message or any information contained in the
message. If you have received this message in error, please advise the
sender by reply e-mail , and delete the message, or call (collect) 001 613
747 4698. *



__________________________________________________________________________________
* This message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Unless you are the addressee (or authorized to receive for the addressee), you may not use, copy or disclose the message or any information contained in the message. If you have received this message in error, please advise the sender by reply e-mail , and delete the message, or call (collect) 001 613 747 4698. *