You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Kedar Hirve <kh...@evincible.com> on 2001/07/09 22:07:40 UTC

Probably a simple problem with an equally simple solution...

	I was trying to develop my own valve to plug into Catalina, but
running into some problems. I wrote up a little class that implements Valve
and has empty code for getInfo() and invoke(). I put it in its own package
called valvetest, compiled it just fine, put that folder
with the class in it in Catalina's startup classpath, and added a valve
element to my server.xml.
	Catalina could find the class when it started, but would give me an
IllegalArgumentException - argument type mismatch for the valve. Finally I
decided to stick the classes into catalina.jar, and it worked. The odd thing
here is that before I jarred it, Catalina found the class just fine, and
even _ran its constructor_.
	Though I have one solution for this now (jarring it into
catalina.jar), I'm not terribly satisfied with that. I wanted to know if
there's a more convenient way of adding my custom components without
modifying catalina.jar.

Thanks, in advance.
-KSH

Re: Probably a simple problem with an equally simple solution...

Posted by Remy Maucherat <re...@betaversion.org>.
Quoting Kedar Hirve <kh...@evincible.com>:

> 	I was trying to develop my own valve to plug into Catalina, but
> running into some problems. I wrote up a little class that implements
> Valve
> and has empty code for getInfo() and invoke(). I put it in its own
> package
> called valvetest, compiled it just fine, put that folder
> with the class in it in Catalina's startup classpath, and added a valve
> element to my server.xml.
> 	Catalina could find the class when it started, but would give me an
> IllegalArgumentException - argument type mismatch for the valve. Finally
> I
> decided to stick the classes into catalina.jar, and it worked. The odd
> thing
> here is that before I jarred it, Catalina found the class just fine,
> and
> even _ran its constructor_.
> 	Though I have one solution for this now (jarring it into
> catalina.jar), I'm not terribly satisfied with that. I wanted to know
> if
> there's a more convenient way of adding my custom components without
> modifying catalina.jar.

It doesn't work even if you put the valve class in server/classes 
(common/classes should work too) ?

Remy

Re: Probably a simple problem with an equally simple solution...

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 9 Jul 2001, Kedar Hirve wrote:

> 	I was trying to develop my own valve to plug into Catalina, but
> running into some problems. I wrote up a little class that implements Valve
> and has empty code for getInfo() and invoke(). I put it in its own package
> called valvetest, compiled it just fine, put that folder
> with the class in it in Catalina's startup classpath, and added a valve
> element to my server.xml.
> 	Catalina could find the class when it started, but would give me an
> IllegalArgumentException - argument type mismatch for the valve. Finally I
> decided to stick the classes into catalina.jar, and it worked. The odd thing
> here is that before I jarred it, Catalina found the class just fine, and
> even _ran its constructor_.
> 	Though I have one solution for this now (jarring it into
> catalina.jar), I'm not terribly satisfied with that. I wanted to know if
> there's a more convenient way of adding my custom components without
> modifying catalina.jar.
> 
> Thanks, in advance.
> -KSH
> 

You should put Valve classes in one of the following two places:
- Unpacked under $CATALINA_HOME/server/classes
- In a JAR file under $CATALINA_HOME/server/lib

The startup processing automatically adds these repositories to the
correct class loader, so no mucking around with CLASSPATH is required (or
allowed).

Craig