You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Carver <ca...@gmail.com> on 2007/09/20 12:08:41 UTC

Problem with defining custom Valve in config.xml

hi,

I try to define a custom valve in config.xml by the following XML fragment:

<gbean gbeanInfo="org.apache.geronimo.tomcat.ValveGBean"
name="geronimo/tomcat/1.1.1/car?ServiceModule=geronimo/tomcat/1.1.1/car,j2eeType=TomcatValve,name=SecondValve">
<attribute name="className">org.compnay.valve.MyValve</attribute>
<attribute name="initParams">debug=1</attribute>
</gbean>
<gbean name="TomcatHost">
<reference name="TomcatValveChain"/>
</gbean>
<gbean name="FirstValve">
<reference name="NextValve">
<pattern>
<name>SecondValve</name>
</pattern>
</reference>
</gbean>

The custom valve cannot start since the valve class not found. But I don't
know how to import the third-party classes in the config.xml.

Anyone know how to import the third-party classes?

many thanks
carver


-- 
View this message in context: http://www.nabble.com/Problem-with-defining-custom-Valve-in-config.xml-tf4486628s134.html#a12794364
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Problem with defining custom Valve in config.xml

Posted by Vamsavardhana Reddy <c1...@gmail.com>.
Let me create a JIRA before it is lost.

Vamsi

On 9/21/07, Paul McMahan <pa...@gmail.com> wrote:
>
> On Sep 21, 2007, at 10:40 AM, Vamsavardhana Reddy wrote:
>
> > May be it is a good idea to have redeploy start any dependent
> > configurations it stops.
>
> that sounds useful!
>
>
> Best wishes,
> Paul
>
>

Re: Problem with defining custom Valve in config.xml

Posted by Paul McMahan <pa...@gmail.com>.
On Sep 21, 2007, at 10:40 AM, Vamsavardhana Reddy wrote:

> May be it is a good idea to have redeploy start any dependent  
> configurations it stops.

that sounds useful!


Best wishes,
Paul


Re: Problem with defining custom Valve in config.xml

Posted by Vamsavardhana Reddy <c1...@gmail.com>.
eek...  my bad.  I got confused with "restart" we have for configs in Admin
Console.  May be it is a good idea to have redeploy start any dependent
configurations it stops.

Vamsi

On 9/21/07, Paul McMahan <pa...@gmail.com> wrote:
>
> On Sep 21, 2007, at 9:53 AM, Vamsavardhana Reddy wrote:
>
> > I would suggest not to undeploy tomcat in step 2 and use deploy.sh
> > redeploy  at step 6.  If this works, then you need not worry about
> > restarting any apps that might have got stopped when tomcat was
> > undeployed as redeploy will restart everything that got stopped.
>
> Thanks for the suggestion but that's not the behavior that I observed
> -- using "deploy.sh redeploy" still stopped the dependent modules.
>
>
> Best wishes,
> Paul
>

Re: Problem with defining custom Valve in config.xml

Posted by Joe Bohn <jo...@earthlink.net>.

Paul McMahan wrote:
> On Sep 21, 2007, at 9:53 AM, Vamsavardhana Reddy wrote:
> 
>> I would suggest not to undeploy tomcat in step 2 and use deploy.sh  
>> redeploy  at step 6.  If this works, then you need not worry about 
>> restarting any apps that might have got stopped when tomcat was 
>> undeployed as redeploy will restart everything that got stopped.
> 
> Thanks for the suggestion but that's not the behavior that I observed -- 
> using "deploy.sh redeploy" still stopped the dependent modules.

Right.  Redeploy will only restart the artifact that was specified in 
the command.  It will not restart dependent artifacts that were stopped.

Joe

Re: Problem with defining custom Valve in config.xml

Posted by Paul McMahan <pa...@gmail.com>.
On Sep 21, 2007, at 9:53 AM, Vamsavardhana Reddy wrote:

> I would suggest not to undeploy tomcat in step 2 and use deploy.sh   
> redeploy  at step 6.  If this works, then you need not worry about  
> restarting any apps that might have got stopped when tomcat was  
> undeployed as redeploy will restart everything that got stopped.

Thanks for the suggestion but that's not the behavior that I observed  
-- using "deploy.sh redeploy" still stopped the dependent modules.


Best wishes,
Paul

Re: Problem with defining custom Valve in config.xml

Posted by Carver <ca...@gmail.com>.
That's true, I should manually enable load="true" after redeploying tomcat.


Vamsavardhana Reddy-2 wrote:
> 
> On 9/21/07, Paul McMahan <pa...@gmail.com> wrote:
>>
>> 1.) start geronimo 2.0.1
>>
>> 2.) undeploy the Tomcat component:
>>       $G/bin/deploy.sh undeploy org.apache.geronimo.configs/
>> tomcat6/2.0.1/car
>>
>> 3.) install your jar into the repository:
>>       mkdir -p $G/repository/mygroup/myvalve/1.0/
>>       cp myvalve-1.0.jar $G/repository/mygroup/myvalve/1.0/
>>
>> 4.) get a deployment plan for Geronimo's Tomcat component by building
>> it from source
>>      -- or --
>>       http://people.apache.org/~pmcmahan/tomcat_plan.xml
>>
>> 5.) add a dependency on your jar to the deployment plan
>>       <dependencies>
>>          [...]
>>          <dependency>
>>            <groupId>mygroup</groupId>
>>            <artifactId>myvalve</artifactId>
>>            <version>1.0</version>
>>            <type>jar</type>
>>        </dependency>
>>
>> 6.) redeploy the tomcat component using the updated deployment plan
>>       $G/bin/deploy.sh deploy $G/repository/org/apache/geronimo/
>> modules/geronimo-tomcat6/2.0.1/geronimo-tomcat6-2.0.1.jar
>> tomcat_plan.xml
> 
> 
> I would suggest not to undeploy tomcat in step 2 and use deploy.sh
> redeploy  at step 6.  If this works, then you need not worry about
> restarting any apps that might have got stopped when tomcat was undeployed
> as redeploy will restart everything that got stopped.
> 
> 
> 7.) restart any web apps that depend on Tomcat (undeploying Tomcat
>> stopped them).  e.g.
>>       $G/bin/deploy.sh start org.apache.geronimo.configs/welcome-
>> tomcat/2.0.1/car
>>
>>
>> As was mentioned earlier,  this process for adding new dependencies
>> to an existing module needs to be improved in Geronimo.  This would
>> make it easier to use your own classes for Tomcat valves.   BTW,
>> there are several "native" valves already in the Tomcat jars that
>> would not require you to go through this process:
>> http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/
>> valves/package-summary.html
>>
>>
>> Best wishes,
>> Paul
>>
>> On Sep 20, 2007, at 2:34 PM, Carver wrote:
>>
>> >
>> > Thanks Paul! I like this approach, but I don't know how to redeploy
>> > it. Could
>> > you tell me how to redeploy the tomcat module?
>> >
>> >
>> > Paul McMahan-2 wrote:
>> >>
>> >> Geronimo's Tomcat component actually creates the valve and therefore
>> >> needs to have the implementation classes available in its
>> >> classloader.  A component's deployment plan specifies what goes in
>> >> its classloader, so you could add your jar(s) to Tomcat's deployment
>> >> plan and then redeploy it.
>> >>
>> >>
>> >> Best wishes,
>> >> Paul
>> >>
>> >>
>> >> On Sep 20, 2007, at 8:52 AM, Carver wrote:
>> >>
>> >>>
>> >>> It seems that I can merge all the other jar files into the
>> >>> geronimo-tomcat-1.1.1.jar to make it works. Is there other ways to
>> >>> handle
>> >>> it?
>> >>>
>> >>> --
>> >>> View this message in context: http://www.nabble.com/Problem-with-
>> >>> defining-custom-Valve-in-config.xml-tf4486628s134.html#a12796470
>> >>> Sent from the Apache Geronimo - Users mailing list archive at
>> >>> Nabble.com.
>> >>>
>> >>
>> >>
>> >>
>> >
>> > --
>> > View this message in context: http://www.nabble.com/Problem-with-
>> > defining-custom-Valve-in-config.xml-tf4486628s134.html#a12803085
>> > Sent from the Apache Geronimo - Users mailing list archive at
>> > Nabble.com.
>> >
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-defining-custom-Valve-in-config.xml-tf4486628s134.html#a12823102
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Problem with defining custom Valve in config.xml

Posted by Vamsavardhana Reddy <c1...@gmail.com>.
On 9/21/07, Paul McMahan <pa...@gmail.com> wrote:
>
> 1.) start geronimo 2.0.1
>
> 2.) undeploy the Tomcat component:
>       $G/bin/deploy.sh undeploy org.apache.geronimo.configs/
> tomcat6/2.0.1/car
>
> 3.) install your jar into the repository:
>       mkdir -p $G/repository/mygroup/myvalve/1.0/
>       cp myvalve-1.0.jar $G/repository/mygroup/myvalve/1.0/
>
> 4.) get a deployment plan for Geronimo's Tomcat component by building
> it from source
>      -- or --
>       http://people.apache.org/~pmcmahan/tomcat_plan.xml
>
> 5.) add a dependency on your jar to the deployment plan
>       <dependencies>
>          [...]
>          <dependency>
>            <groupId>mygroup</groupId>
>            <artifactId>myvalve</artifactId>
>            <version>1.0</version>
>            <type>jar</type>
>        </dependency>
>
> 6.) redeploy the tomcat component using the updated deployment plan
>       $G/bin/deploy.sh deploy $G/repository/org/apache/geronimo/
> modules/geronimo-tomcat6/2.0.1/geronimo-tomcat6-2.0.1.jar
> tomcat_plan.xml


I would suggest not to undeploy tomcat in step 2 and use deploy.sh
redeploy  at step 6.  If this works, then you need not worry about
restarting any apps that might have got stopped when tomcat was undeployed
as redeploy will restart everything that got stopped.


7.) restart any web apps that depend on Tomcat (undeploying Tomcat
> stopped them).  e.g.
>       $G/bin/deploy.sh start org.apache.geronimo.configs/welcome-
> tomcat/2.0.1/car
>
>
> As was mentioned earlier,  this process for adding new dependencies
> to an existing module needs to be improved in Geronimo.  This would
> make it easier to use your own classes for Tomcat valves.   BTW,
> there are several "native" valves already in the Tomcat jars that
> would not require you to go through this process:
> http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/
> valves/package-summary.html
>
>
> Best wishes,
> Paul
>
> On Sep 20, 2007, at 2:34 PM, Carver wrote:
>
> >
> > Thanks Paul! I like this approach, but I don't know how to redeploy
> > it. Could
> > you tell me how to redeploy the tomcat module?
> >
> >
> > Paul McMahan-2 wrote:
> >>
> >> Geronimo's Tomcat component actually creates the valve and therefore
> >> needs to have the implementation classes available in its
> >> classloader.  A component's deployment plan specifies what goes in
> >> its classloader, so you could add your jar(s) to Tomcat's deployment
> >> plan and then redeploy it.
> >>
> >>
> >> Best wishes,
> >> Paul
> >>
> >>
> >> On Sep 20, 2007, at 8:52 AM, Carver wrote:
> >>
> >>>
> >>> It seems that I can merge all the other jar files into the
> >>> geronimo-tomcat-1.1.1.jar to make it works. Is there other ways to
> >>> handle
> >>> it?
> >>>
> >>> --
> >>> View this message in context: http://www.nabble.com/Problem-with-
> >>> defining-custom-Valve-in-config.xml-tf4486628s134.html#a12796470
> >>> Sent from the Apache Geronimo - Users mailing list archive at
> >>> Nabble.com.
> >>>
> >>
> >>
> >>
> >
> > --
> > View this message in context: http://www.nabble.com/Problem-with-
> > defining-custom-Valve-in-config.xml-tf4486628s134.html#a12803085
> > Sent from the Apache Geronimo - Users mailing list archive at
> > Nabble.com.
> >
>
>

Re: Problem with defining custom Valve in config.xml

Posted by Carver <ca...@gmail.com>.
Thanks Paul! It works!


Paul McMahan-2 wrote:
> 
> 1.) start geronimo 2.0.1
> 
> 2.) undeploy the Tomcat component:
>       $G/bin/deploy.sh undeploy org.apache.geronimo.configs/ 
> tomcat6/2.0.1/car
> 
> 3.) install your jar into the repository:
>       mkdir -p $G/repository/mygroup/myvalve/1.0/
>       cp myvalve-1.0.jar $G/repository/mygroup/myvalve/1.0/
> 
> 4.) get a deployment plan for Geronimo's Tomcat component by building  
> it from source
>      -- or --
>       http://people.apache.org/~pmcmahan/tomcat_plan.xml
> 
> 5.) add a dependency on your jar to the deployment plan
>       <dependencies>
>          [...]
>          <dependency>
>            <groupId>mygroup</groupId>
>            <artifactId>myvalve</artifactId>
>            <version>1.0</version>
>            <type>jar</type>
>        </dependency>
> 
> 6.) redeploy the tomcat component using the updated deployment plan
>       $G/bin/deploy.sh deploy $G/repository/org/apache/geronimo/ 
> modules/geronimo-tomcat6/2.0.1/geronimo-tomcat6-2.0.1.jar  
> tomcat_plan.xml
> 
> 7.) restart any web apps that depend on Tomcat (undeploying Tomcat  
> stopped them).  e.g.
>       $G/bin/deploy.sh start org.apache.geronimo.configs/welcome- 
> tomcat/2.0.1/car
> 
> 
> As was mentioned earlier,  this process for adding new dependencies  
> to an existing module needs to be improved in Geronimo.  This would  
> make it easier to use your own classes for Tomcat valves.   BTW,  
> there are several "native" valves already in the Tomcat jars that  
> would not require you to go through this process:
> http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/ 
> valves/package-summary.html
> 
> 
> Best wishes,
> Paul
> 
> On Sep 20, 2007, at 2:34 PM, Carver wrote:
> 
>>
>> Thanks Paul! I like this approach, but I don't know how to redeploy  
>> it. Could
>> you tell me how to redeploy the tomcat module?
>>
>>
>> Paul McMahan-2 wrote:
>>>
>>> Geronimo's Tomcat component actually creates the valve and therefore
>>> needs to have the implementation classes available in its
>>> classloader.  A component's deployment plan specifies what goes in
>>> its classloader, so you could add your jar(s) to Tomcat's deployment
>>> plan and then redeploy it.
>>>
>>>
>>> Best wishes,
>>> Paul
>>>
>>>
>>> On Sep 20, 2007, at 8:52 AM, Carver wrote:
>>>
>>>>
>>>> It seems that I can merge all the other jar files into the
>>>> geronimo-tomcat-1.1.1.jar to make it works. Is there other ways to
>>>> handle
>>>> it?
>>>>
>>>> -- 
>>>> View this message in context: http://www.nabble.com/Problem-with-
>>>> defining-custom-Valve-in-config.xml-tf4486628s134.html#a12796470
>>>> Sent from the Apache Geronimo - Users mailing list archive at
>>>> Nabble.com.
>>>>
>>>
>>>
>>>
>>
>> -- 
>> View this message in context: http://www.nabble.com/Problem-with- 
>> defining-custom-Valve-in-config.xml-tf4486628s134.html#a12803085
>> Sent from the Apache Geronimo - Users mailing list archive at  
>> Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-defining-custom-Valve-in-config.xml-tf4486628s134.html#a12823076
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Problem with defining custom Valve in config.xml

Posted by Paul McMahan <pa...@gmail.com>.
1.) start geronimo 2.0.1

2.) undeploy the Tomcat component:
      $G/bin/deploy.sh undeploy org.apache.geronimo.configs/ 
tomcat6/2.0.1/car

3.) install your jar into the repository:
      mkdir -p $G/repository/mygroup/myvalve/1.0/
      cp myvalve-1.0.jar $G/repository/mygroup/myvalve/1.0/

4.) get a deployment plan for Geronimo's Tomcat component by building  
it from source
     -- or --
      http://people.apache.org/~pmcmahan/tomcat_plan.xml

5.) add a dependency on your jar to the deployment plan
      <dependencies>
         [...]
         <dependency>
           <groupId>mygroup</groupId>
           <artifactId>myvalve</artifactId>
           <version>1.0</version>
           <type>jar</type>
       </dependency>

6.) redeploy the tomcat component using the updated deployment plan
      $G/bin/deploy.sh deploy $G/repository/org/apache/geronimo/ 
modules/geronimo-tomcat6/2.0.1/geronimo-tomcat6-2.0.1.jar  
tomcat_plan.xml

7.) restart any web apps that depend on Tomcat (undeploying Tomcat  
stopped them).  e.g.
      $G/bin/deploy.sh start org.apache.geronimo.configs/welcome- 
tomcat/2.0.1/car


As was mentioned earlier,  this process for adding new dependencies  
to an existing module needs to be improved in Geronimo.  This would  
make it easier to use your own classes for Tomcat valves.   BTW,  
there are several "native" valves already in the Tomcat jars that  
would not require you to go through this process:
http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/ 
valves/package-summary.html


Best wishes,
Paul

On Sep 20, 2007, at 2:34 PM, Carver wrote:

>
> Thanks Paul! I like this approach, but I don't know how to redeploy  
> it. Could
> you tell me how to redeploy the tomcat module?
>
>
> Paul McMahan-2 wrote:
>>
>> Geronimo's Tomcat component actually creates the valve and therefore
>> needs to have the implementation classes available in its
>> classloader.  A component's deployment plan specifies what goes in
>> its classloader, so you could add your jar(s) to Tomcat's deployment
>> plan and then redeploy it.
>>
>>
>> Best wishes,
>> Paul
>>
>>
>> On Sep 20, 2007, at 8:52 AM, Carver wrote:
>>
>>>
>>> It seems that I can merge all the other jar files into the
>>> geronimo-tomcat-1.1.1.jar to make it works. Is there other ways to
>>> handle
>>> it?
>>>
>>> -- 
>>> View this message in context: http://www.nabble.com/Problem-with-
>>> defining-custom-Valve-in-config.xml-tf4486628s134.html#a12796470
>>> Sent from the Apache Geronimo - Users mailing list archive at
>>> Nabble.com.
>>>
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Problem-with- 
> defining-custom-Valve-in-config.xml-tf4486628s134.html#a12803085
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Re: Problem with defining custom Valve in config.xml

Posted by Carver <ca...@gmail.com>.
Thanks Paul! I like this approach, but I don't know how to redeploy it. Could
you tell me how to redeploy the tomcat module?


Paul McMahan-2 wrote:
> 
> Geronimo's Tomcat component actually creates the valve and therefore  
> needs to have the implementation classes available in its  
> classloader.  A component's deployment plan specifies what goes in  
> its classloader, so you could add your jar(s) to Tomcat's deployment  
> plan and then redeploy it.
> 
> 
> Best wishes,
> Paul
> 
> 
> On Sep 20, 2007, at 8:52 AM, Carver wrote:
> 
>>
>> It seems that I can merge all the other jar files into the
>> geronimo-tomcat-1.1.1.jar to make it works. Is there other ways to  
>> handle
>> it?
>>
>> -- 
>> View this message in context: http://www.nabble.com/Problem-with- 
>> defining-custom-Valve-in-config.xml-tf4486628s134.html#a12796470
>> Sent from the Apache Geronimo - Users mailing list archive at  
>> Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-defining-custom-Valve-in-config.xml-tf4486628s134.html#a12803085
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Problem with defining custom Valve in config.xml

Posted by Paul McMahan <pa...@gmail.com>.
Geronimo's Tomcat component actually creates the valve and therefore  
needs to have the implementation classes available in its  
classloader.  A component's deployment plan specifies what goes in  
its classloader, so you could add your jar(s) to Tomcat's deployment  
plan and then redeploy it.


Best wishes,
Paul


On Sep 20, 2007, at 8:52 AM, Carver wrote:

>
> It seems that I can merge all the other jar files into the
> geronimo-tomcat-1.1.1.jar to make it works. Is there other ways to  
> handle
> it?
>
> -- 
> View this message in context: http://www.nabble.com/Problem-with- 
> defining-custom-Valve-in-config.xml-tf4486628s134.html#a12796470
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Re: Problem with defining custom Valve in config.xml

Posted by Carver <ca...@gmail.com>.
Can I put my jars to the <GERONIMO_HOME>/lib/endorsed to make it works in
Geronimo 2.0.1?


Kevan Miller wrote:
> 
> 
> On Sep 20, 2007, at 9:34 AM, Vamsavardhana Reddy wrote:
> 
>> Put your jars in <GERONIMO_HOME>/lib/endorsed dir.
> 
> Heh. How many answers can we give... ;-)
> 
> I was thinking we had lib/endorsed issues on 1.1. We don't set it as  
> command line option when invoking java. And am not sure how well  
> manifest.mf controls this.
> 
> Assuming this works, it's better than the two hacks. We still need a  
> better solution, IMHO...
> 
> --kevan
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-defining-custom-Valve-in-config.xml-tf4486628s134.html#a12800559
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Problem with defining custom Valve in config.xml

Posted by David Jencks <da...@yahoo.com>.
On Sep 20, 2007, at 10:16 AM, Paul McMahan wrote:

> On Sep 20, 2007, at 9:44 AM, Kevan Miller wrote:
>
>>
>> On Sep 20, 2007, at 9:34 AM, Vamsavardhana Reddy wrote:
>>
>>> Put your jars in <GERONIMO_HOME>/lib/endorsed dir.
>>
>> Heh. How many answers can we give... ;-)
>>
>> I was thinking we had lib/endorsed issues on 1.1. We don't set it  
>> as command line option when invoking java. And am not sure how  
>> well manifest.mf controls this.
>>
>> Assuming this works, it's better than the two hacks. We still need  
>> a better solution, IMHO...
>
> I also seem to recall some issue with using lib/endorsed in 1.1.   
> But if it works then it's definitely the easiest solution.   A  
> similar issue has come up before in the context of replacing Tomcat  
> classes and this type of approach didn't work well [1].   But that  
> circumstance was a little different since Carver needs to add  
> classes to Tomcat's classloader, not replace them.
>
> I think it would be great to have some way to edit a component's  
> environment without having to redeploy it.   Redeploying a  
> component can be difficult because the original plan is not kept  
> after deployment.   In Geronimo 2.1 (not released yet) the  
> deployment plans for Geronimo's native components like Tomcat are  
> available in the repository which would have made this particular  
> task easier.

or maybe more confusing since you have to redeploy after modifying them

Another possibility that may or may not work is to deploy another  
tomcat web container in your configuration that does have the valve  
class in it.  If tomcat uses the thread context classloader for  
constructing valves this ought to work.

thanks
david jencks

>
>
> Best wishes,
> Paul
>
> [1]  http://www.nabble.com/Re%3A-replacing-tomcat-classes- 
> p4346533s134.html


Re: Problem with defining custom Valve in config.xml

Posted by Paul McMahan <pa...@gmail.com>.
On Sep 20, 2007, at 9:44 AM, Kevan Miller wrote:

>
> On Sep 20, 2007, at 9:34 AM, Vamsavardhana Reddy wrote:
>
>> Put your jars in <GERONIMO_HOME>/lib/endorsed dir.
>
> Heh. How many answers can we give... ;-)
>
> I was thinking we had lib/endorsed issues on 1.1. We don't set it  
> as command line option when invoking java. And am not sure how well  
> manifest.mf controls this.
>
> Assuming this works, it's better than the two hacks. We still need  
> a better solution, IMHO...

I also seem to recall some issue with using lib/endorsed in 1.1.  But  
if it works then it's definitely the easiest solution.   A similar  
issue has come up before in the context of replacing Tomcat classes  
and this type of approach didn't work well [1].   But that  
circumstance was a little different since Carver needs to add classes  
to Tomcat's classloader, not replace them.

I think it would be great to have some way to edit a component's  
environment without having to redeploy it.   Redeploying a component  
can be difficult because the original plan is not kept after  
deployment.   In Geronimo 2.1 (not released yet) the deployment plans  
for Geronimo's native components like Tomcat are available in the  
repository which would have made this particular task easier.


Best wishes,
Paul

[1]  http://www.nabble.com/Re%3A-replacing-tomcat-classes- 
p4346533s134.html

Re: Problem with defining custom Valve in config.xml

Posted by Kevan Miller <ke...@gmail.com>.
On Sep 20, 2007, at 9:34 AM, Vamsavardhana Reddy wrote:

> Put your jars in <GERONIMO_HOME>/lib/endorsed dir.

Heh. How many answers can we give... ;-)

I was thinking we had lib/endorsed issues on 1.1. We don't set it as  
command line option when invoking java. And am not sure how well  
manifest.mf controls this.

Assuming this works, it's better than the two hacks. We still need a  
better solution, IMHO...

--kevan


Re: Problem with defining custom Valve in config.xml

Posted by Vamsavardhana Reddy <c1...@gmail.com>.
Put your jars in <GERONIMO_HOME>/lib/endorsed dir.

Vamsi

On 9/20/07, Carver <ca...@gmail.com> wrote:
>
>
> It seems that I can merge all the other jar files into the
> geronimo-tomcat-1.1.1.jar to make it works. Is there other ways to handle
> it?
>
> --
> View this message in context:
> http://www.nabble.com/Problem-with-defining-custom-Valve-in-config.xml-tf4486628s134.html#a12796470
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>
>

Re: Problem with defining custom Valve in config.xml

Posted by Carver <ca...@gmail.com>.
It seems that appending the jars to the Class-Path in meta-inf/manifest.mf in
server.jar is the simplest simplest way. I try it, but I found that I need
to put all the dependency jars, such as catalina.jar and servlet-api.jar, to
the list. It is really not a good solution. (same problem in the
lib/endorsed folder in Geronimo 2.0.1)

I think the better solution should be redeploy the tomcat module, let me
have a try first.

thanks,
carver


Kevan Miller wrote:
> 
> 
> On Sep 20, 2007, at 8:52 AM, Carver wrote:
> 
>>
>> It seems that I can merge all the other jar files into the
>> geronimo-tomcat-1.1.1.jar to make it works. Is there other ways to  
>> handle
>> it?
> 
> Another technique would be to append your jar to the Class-Path in  
> meta-inf/manifest.mf in server.jar. Both of these are pretty much hacks.
> 
> A cleaner solution would be to build the server from source and add  
> your dependency to the Tomcat module. Or simply tinker with the  
> Tomcat plan and redeploy the module on your server...
> 
> IMO, we need a technique for inserting user-specified jars into a  
> module's CLASSPATH. I'm not feeling like we have a satisfactory  
> solution, from a user's perspective. Using XML to configure modules  
> might help...
> 
> --kevan
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-defining-custom-Valve-in-config.xml-tf4486628s134.html#a12802711
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Problem with defining custom Valve in config.xml

Posted by Kevan Miller <ke...@gmail.com>.
On Sep 20, 2007, at 8:52 AM, Carver wrote:

>
> It seems that I can merge all the other jar files into the
> geronimo-tomcat-1.1.1.jar to make it works. Is there other ways to  
> handle
> it?

Another technique would be to append your jar to the Class-Path in  
meta-inf/manifest.mf in server.jar. Both of these are pretty much hacks.

A cleaner solution would be to build the server from source and add  
your dependency to the Tomcat module. Or simply tinker with the  
Tomcat plan and redeploy the module on your server...

IMO, we need a technique for inserting user-specified jars into a  
module's CLASSPATH. I'm not feeling like we have a satisfactory  
solution, from a user's perspective. Using XML to configure modules  
might help...

--kevan




Re: Problem with defining custom Valve in config.xml

Posted by Carver <ca...@gmail.com>.
It seems that I can merge all the other jar files into the
geronimo-tomcat-1.1.1.jar to make it works. Is there other ways to handle
it?

-- 
View this message in context: http://www.nabble.com/Problem-with-defining-custom-Valve-in-config.xml-tf4486628s134.html#a12796470
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Problem with defining custom Valve in config.xml

Posted by Carver <ca...@gmail.com>.
Oh, my mistake! It should be "org.company". Thanks for your remind.


Janko Heilgeist-2 wrote:
> 
> Hi,
> 
> is that a typo in the attribute "className"? Do you really mean "org.
> compnay" or instead "org.company"?
> 
> Regards, Janko
> 
> Carver wrote:
>> hi,
>> 
>> I try to define a custom valve in config.xml by the following XML
>> fragment:
>> 
>> <gbean gbeanInfo="org.apache.geronimo.tomcat.ValveGBean"
>> name="geronimo/tomcat/1.1.1/car?ServiceModule=geronimo/tomcat/1.1.1/car,j2eeType=TomcatValve,name=SecondValve">
>> <attribute name="className">org.compnay.valve.MyValve</attribute>
>> <attribute name="initParams">debug=1</attribute>
>> </gbean>
>> <gbean name="TomcatHost">
>> <reference name="TomcatValveChain"/>
>> </gbean>
>> <gbean name="FirstValve">
>> <reference name="NextValve">
>> <pattern>
>> <name>SecondValve</name>
>> </pattern>
>> </reference>
>> </gbean>
>> 
>> The custom valve cannot start since the valve class not found. But I
>> don't
>> know how to import the third-party classes in the config.xml.
>> 
>> Anyone know how to import the third-party classes?
>> 
>> many thanks
>> carver
>> 
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-defining-custom-Valve-in-config.xml-tf4486628s134.html#a12801371
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Problem with defining custom Valve in config.xml

Posted by Carver <ca...@gmail.com>.
Thanks your guys help! I get it to works in both Geronimo 1.1.1 and Geronimo
2.0.1.
-- 
View this message in context: http://www.nabble.com/Problem-with-defining-custom-Valve-in-config.xml-tf4486628s134.html#a12823218
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Problem with defining custom Valve in config.xml

Posted by Janko Heilgeist <ge...@dalighe.de>.
Hi,

is that a typo in the attribute "className"? Do you really mean "org.
compnay" or instead "org.company"?

Regards, Janko

Carver wrote:
> hi,
> 
> I try to define a custom valve in config.xml by the following XML fragment:
> 
> <gbean gbeanInfo="org.apache.geronimo.tomcat.ValveGBean"
> name="geronimo/tomcat/1.1.1/car?ServiceModule=geronimo/tomcat/1.1.1/car,j2eeType=TomcatValve,name=SecondValve">
> <attribute name="className">org.compnay.valve.MyValve</attribute>
> <attribute name="initParams">debug=1</attribute>
> </gbean>
> <gbean name="TomcatHost">
> <reference name="TomcatValveChain"/>
> </gbean>
> <gbean name="FirstValve">
> <reference name="NextValve">
> <pattern>
> <name>SecondValve</name>
> </pattern>
> </reference>
> </gbean>
> 
> The custom valve cannot start since the valve class not found. But I don't
> know how to import the third-party classes in the config.xml.
> 
> Anyone know how to import the third-party classes?
> 
> many thanks
> carver
> 
>