tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <cmanola...@yahoo.com>
Subject Re: setWrapper and getWrapper in ContainerServlet
Date Sun, 04 May 2003 15:32:21 GMT
Rajiv Mordani wrote:

> Also server/lib doesn't work. I created a jar file with the Servlet class
> in com.* package.

Can you debug it with jswat or some debugger ? 
Just add a breakpoint or println in
StandardWrapper.isContainerProvidedServlet.

I very much doubt anyone tested this piece with third party code - all
our use ( for admin and manager ) is based on internal servlets in catalina
package ( so first test will do it ).

If you look at the code - it does a loadClass() with the server class 
loader - and if that fails, it will reject it. If your com. class 
has some dependencies that can't be met in the server loader - the test will
fail.

Again - IMHO you shound't waste time on ContainerServlet, but try using JMX.


Costin

> 
> - Rajiv
> --
> :wq
> 
> On Sun, 4 May 2003, Costin Manolache wrote:
> 
>> Rajiv Mordani wrote:
>> 
>> > Well using o.a.catalina isn't really an option for most folks outside
>> > the tomcat community / commercial products that build on tomcat.. Can
>> > try putting it in server/lib and see if that works.
>> 
>> I think it will work, looking at the code.
>> 
>> 
>> > I do have jmxri in
>> > common/lib. Using the wrapper to see which applications are deployed.
>> > Something similar though not exactly as the manager webapp.
>> 
>> IMO we need to move jmx.jar from server/lib to common/lib, depreate
>> ContainerServlet and use JMX instead for access to the tomcat internals.
>> This provides fine control ( via java policy file ), is much cleaner.
>> 
>> BTW - if you only want to see deployed applications, you can do it
>> using only standard JMX and JSR77, no tomcat specific code. You still
>> need to move jmx.jar to common/lib.
>> 
>> Costin
>> 
>> 
>> 
>> > 
>> > - Rajiv
>> > --
>> > :wq
>> > 
>> > On Sat, 3 May 2003, Costin Manolache wrote:
>> > 
>> >> I think I see the problem - the test in
>> >> ServetWrapper.isContainerProvidedServlet() will try to load the
>> >> servlet class using the container loader..
>> >> 
>> >> You need to place the servlet in server/lib or name it
>> >> o.a.catalina....
>> >>  I can see no other way. All our trusted servlets start with
>> >>  o.a.catalina,
>> >> that's why they work.
>> >> 
>> >> BTW, why do you need the wrapper ? In tomcat5 you can also access the
>> >> internals by using JMX - I think few methods have a "managedObject"
>> >> attribute. You can use non-priv webapp, but if sandbox is enabled you
>> >> need to add permissions for jmx access.
>> >> ( make sure jmxri.jar or mx4j-jmx.jar are in common/lib, not in
>> >> server/lib )
>> >> 
>> >> Costin
>> >> 
>> >> 
>> >> Rajiv Mordani wrote:
>> >> 
>> >> > I have setWrapper implemented as
>> >> > 
>> >> > public void setWrapper(Wrapper wrapper) {
>> >> >     
>> >> >         System.out.println("setting wrapper");
>> >> >         this.wrapper = wrapper;
>> >> >         context = (Context) wrapper.getParent();
>> >> >         host = (Host) context.getParent();
>> >> >         
>> >> >     }
>> >> > 
>> >> > Nothing is printed on the console when I access the servlet.
>> >> > 
>> >> > - Rajiv
>> >> > --
>> >> > :wq
>> >> > 
>> >> > On Sat, 3 May 2003, Rajiv Mordani wrote:
>> >> > 
>> >> >> Yep I have set privileged=true. Yes I am aware of the side effect.
>> >> >> When the servlet is init'd wrapper is null and setWrapper isn't
>> >> >> getting invoked. Also this is with tomcat 5.
>> >> >> 
>> >> >> - Rajiv
>> >> >> --
>> >> >> :wq
>> >> >> 
>> >> >> On Sat, 3 May 2003, Craig R. McClanahan wrote:
>> >> >> 
>> >> >> > 
>> >> >> > 
>> >> >> > On Sat, 3 May 2003, Rajiv Mordani wrote:
>> >> >> > 
>> >> >> > > Date: Sat, 3 May 2003 14:28:27 -0700 (PDT)
>> >> >> > > From: Rajiv Mordani <Rajiv.Mordani@Sun.COM>
>> >> >> > > Reply-To: Tomcat Developers List
>> >> >> > > <tomcat-dev@jakarta.apache.org> To:
>> >> >> > > tomcat-dev@jakarta.apache.org Subject: setWrapper and
>> >> >> > > getWrapper in ContainerServlet
>> >> >> > >
>> >> >> > > Do I have to do anything special to have the container
invoke
>> >> >> > > the setWrapper in a ContainerServlet? I have implemented
a
>> >> >> > > ContainerServlet and the set / getWrapper method but
it doesn't
>> >> >> > > seem to be getting invoked.
>> >> >> > >
>> >> >> > 
>> >> >> > The webapp also has to have privileged="true" in its <Context>
>> >> >> > entry -- see how the manager and admin webapps are configured
for
>> >> >> > an example. As a side effect, the parent class loader becomes
the
>> >> >> > server class loader as well.
>> >> >> > 
>> >> >> > > - Rajiv
>> >> >> > > --
>> >> >> > > :wq
>> >> >> > >
>> >> >> > 
>> >> >> > Craig
>> >> >> > 
>> >> >> >
>> ---------------------------------------------------------------------
>> >> >> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>> >> >> > For additional commands, e-mail:
>> >> >> > tomcat-dev-help@jakarta.apache.org
>> >> >> > 
>> >> >> 
>> >> >> 
>> >> >>
---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>> >> >> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>> >> >>
>> >> 
>> >> 
>> >> 
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>> >> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>> >>
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message