You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Rajiv Mordani <Ra...@Sun.COM> on 2003/05/03 23:28:27 UTC

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. 

- Rajiv
--
:wq



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


Re: setWrapper and getWrapper in ContainerServlet

Posted by Costin Manolache <cm...@yahoo.com>.
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 <Ra...@Sun.COM>
>> >> >> > > Reply-To: Tomcat Developers List
>> >> >> > > <to...@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


Re: setWrapper and getWrapper in ContainerServlet

Posted by Rajiv Mordani <Ra...@Sun.COM>.
Also server/lib doesn't work. I created a jar file with the Servlet class
in com.* package.

- 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 <Ra...@Sun.COM>
> >> >> > > Reply-To: Tomcat Developers List <to...@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


Re: setWrapper and getWrapper in ContainerServlet

Posted by Rajiv Mordani <Ra...@Sun.COM>.
Ok. Thanks. 

- 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 <Ra...@Sun.COM>
> >> >> > > Reply-To: Tomcat Developers List <to...@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


Re: setWrapper and getWrapper in ContainerServlet

Posted by Costin Manolache <cm...@yahoo.com>.
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 <Ra...@Sun.COM>
>> >> > > Reply-To: Tomcat Developers List <to...@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


Re: setWrapper and getWrapper in ContainerServlet

Posted by Rajiv Mordani <Ra...@Sun.COM>.
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 do have jmxri in
common/lib. Using the wrapper to see which applications are deployed.
Something similar though not exactly as the manager webapp.

- 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 <Ra...@Sun.COM>
> >> > > Reply-To: Tomcat Developers List <to...@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


Re: setWrapper and getWrapper in ContainerServlet

Posted by Costin Manolache <cm...@yahoo.com>.
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 <Ra...@Sun.COM>
>> > > Reply-To: Tomcat Developers List <to...@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


Re: setWrapper and getWrapper in ContainerServlet

Posted by Rajiv Mordani <Ra...@Sun.COM>.
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 <Ra...@Sun.COM>
> > > Reply-To: Tomcat Developers List <to...@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


Re: setWrapper and getWrapper in ContainerServlet

Posted by Rajiv Mordani <Ra...@Sun.COM>.
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 <Ra...@Sun.COM>
> > Reply-To: Tomcat Developers List <to...@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


Re: setWrapper and getWrapper in ContainerServlet

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

On Sat, 3 May 2003, Rajiv Mordani wrote:

> Date: Sat, 3 May 2003 14:28:27 -0700 (PDT)
> From: Rajiv Mordani <Ra...@Sun.COM>
> Reply-To: Tomcat Developers List <to...@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