You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mayer Crystal <mc...@acedsl.com> on 2003/06/29 14:17:18 UTC
JMX question
I apologize if a similar question has been asked before, but I couldn't
find anything like this in the archive.
What I am trying to do is as follows: I have a filter which is attached
to a servlet which is preloaded. When tomcat starts up, it loads the
servlet and its filters into memory and calls the corresponding init
methods. In the init of the filter, the code attempts to retrieve a
reference to the MBeanServer and register an MBean. During startup,
however, it appears that the server is null (i.e. hasn't been started).
I know that Tomcat ships with the mx4j server/classes, so I was
wondering if there is a way to instruct Tomcat to load the mbean server
so that it is available even for filters/servlets that are loaded on
startup? (I know that there is a way to use the mbeans descriptor file,
but unfortunately this mbean is dynamic and created and referenced in
the code directly so it can't be initialized outside of the filter's
scope. )
If anyone has any suggestions, please let me know.
TIA,
Mayer
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JMX question
Posted by Bill Barker <wb...@wilshire.com>.
It forces it to be loaded in the "common loader", which is a parent to both
the "server loader" and the "application context loader". Running a simple
test Servlet shows that putting the JMX jar in common/lib for 4.1.x does
allow it access to MBeanServers, even on non-trusted apps.
Without digging through the 4.1.x JMX code to check, you probably need to
have the ServerLifecycleListener enabled (this is the default).
"Mayer Crystal" <mc...@acedsl.com> wrote in message
news:1056910872.4330.2.camel@mayer...
> Tim,
>
> I understand that this will allow me to reference the classes, but does
> it force the JMX server to be loaded in the application context? For
> example, if my filter executes the following code:
>
> ArrayList servers = MBeanServerFactory.findMBeanServer( null );
>
> will servers be non-null and have a size > 0?
>
>
> Thanks,
> Mayer
>
>
>
> On Sun, 2003-06-29 at 22:10, Bill Barker wrote:
> > Less dangerous is to move the jmx jar(s) from server/lib to common/lib.
> > It's in server/lib since older versions of JMX lacked a way to prevent a
> > rogue Servlet from accessing all of the Tomcat internals via JMX.
> >
> > "Tim Funk" <fu...@joedog.org> wrote in message
> > news:3EFF20A2.8040001@joedog.org...
> > > Hmmm. You might (emphasis might because I have no clue at this point
in
> > time)
> > > need to make you webapp "privileged" so in your webapp declaration
you
> > have:
> > >
> > > <Context ... privileged="true"/>
> > >
> > > -Tim
> > >
> > > Mayer Crystal wrote:
> > > > I apologize if a similar question has been asked before, but I
couldn't
> > > > find anything like this in the archive.
> > > >
> > > > What I am trying to do is as follows: I have a filter which is
attached
> > > > to a servlet which is preloaded. When tomcat starts up, it loads
the
> > > > servlet and its filters into memory and calls the corresponding init
> > > > methods. In the init of the filter, the code attempts to retrieve a
> > > > reference to the MBeanServer and register an MBean. During startup,
> > > > however, it appears that the server is null (i.e. hasn't been
started).
> > > > I know that Tomcat ships with the mx4j server/classes, so I was
> > > > wondering if there is a way to instruct Tomcat to load the mbean
server
> > > > so that it is available even for filters/servlets that are loaded on
> > > > startup? (I know that there is a way to use the mbeans descriptor
file,
> > > > but unfortunately this mbean is dynamic and created and referenced
in
> > > > the code directly so it can't be initialized outside of the filter's
> > > > scope. )
> > > >
> > > > If anyone has any suggestions, please let me know.
> > > >
> > > > TIA,
> > > > Mayer
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> --
> Mayer Crystal <mc...@acedsl.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JMX question
Posted by Mayer Crystal <mc...@acedsl.com>.
Tim,
I understand that this will allow me to reference the classes, but does
it force the JMX server to be loaded in the application context? For
example, if my filter executes the following code:
ArrayList servers = MBeanServerFactory.findMBeanServer( null );
will servers be non-null and have a size > 0?
Thanks,
Mayer
On Sun, 2003-06-29 at 22:10, Bill Barker wrote:
> Less dangerous is to move the jmx jar(s) from server/lib to common/lib.
> It's in server/lib since older versions of JMX lacked a way to prevent a
> rogue Servlet from accessing all of the Tomcat internals via JMX.
>
> "Tim Funk" <fu...@joedog.org> wrote in message
> news:3EFF20A2.8040001@joedog.org...
> > Hmmm. You might (emphasis might because I have no clue at this point in
> time)
> > need to make you webapp "privileged" so in your webapp declaration you
> have:
> >
> > <Context ... privileged="true"/>
> >
> > -Tim
> >
> > Mayer Crystal wrote:
> > > I apologize if a similar question has been asked before, but I couldn't
> > > find anything like this in the archive.
> > >
> > > What I am trying to do is as follows: I have a filter which is attached
> > > to a servlet which is preloaded. When tomcat starts up, it loads the
> > > servlet and its filters into memory and calls the corresponding init
> > > methods. In the init of the filter, the code attempts to retrieve a
> > > reference to the MBeanServer and register an MBean. During startup,
> > > however, it appears that the server is null (i.e. hasn't been started).
> > > I know that Tomcat ships with the mx4j server/classes, so I was
> > > wondering if there is a way to instruct Tomcat to load the mbean server
> > > so that it is available even for filters/servlets that are loaded on
> > > startup? (I know that there is a way to use the mbeans descriptor file,
> > > but unfortunately this mbean is dynamic and created and referenced in
> > > the code directly so it can't be initialized outside of the filter's
> > > scope. )
> > >
> > > If anyone has any suggestions, please let me know.
> > >
> > > TIA,
> > > Mayer
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
--
Mayer Crystal <mc...@acedsl.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JMX question
Posted by Bill Barker <wb...@wilshire.com>.
Less dangerous is to move the jmx jar(s) from server/lib to common/lib.
It's in server/lib since older versions of JMX lacked a way to prevent a
rogue Servlet from accessing all of the Tomcat internals via JMX.
"Tim Funk" <fu...@joedog.org> wrote in message
news:3EFF20A2.8040001@joedog.org...
> Hmmm. You might (emphasis might because I have no clue at this point in
time)
> need to make you webapp "privileged" so in your webapp declaration you
have:
>
> <Context ... privileged="true"/>
>
> -Tim
>
> Mayer Crystal wrote:
> > I apologize if a similar question has been asked before, but I couldn't
> > find anything like this in the archive.
> >
> > What I am trying to do is as follows: I have a filter which is attached
> > to a servlet which is preloaded. When tomcat starts up, it loads the
> > servlet and its filters into memory and calls the corresponding init
> > methods. In the init of the filter, the code attempts to retrieve a
> > reference to the MBeanServer and register an MBean. During startup,
> > however, it appears that the server is null (i.e. hasn't been started).
> > I know that Tomcat ships with the mx4j server/classes, so I was
> > wondering if there is a way to instruct Tomcat to load the mbean server
> > so that it is available even for filters/servlets that are loaded on
> > startup? (I know that there is a way to use the mbeans descriptor file,
> > but unfortunately this mbean is dynamic and created and referenced in
> > the code directly so it can't be initialized outside of the filter's
> > scope. )
> >
> > If anyone has any suggestions, please let me know.
> >
> > TIA,
> > Mayer
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JMX question
Posted by Tim Funk <fu...@joedog.org>.
Hmmm. You might (emphasis might because I have no clue at this point in time)
need to make you webapp "privileged" so in your webapp declaration you have:
<Context ... privileged="true"/>
-Tim
Mayer Crystal wrote:
> I apologize if a similar question has been asked before, but I couldn't
> find anything like this in the archive.
>
> What I am trying to do is as follows: I have a filter which is attached
> to a servlet which is preloaded. When tomcat starts up, it loads the
> servlet and its filters into memory and calls the corresponding init
> methods. In the init of the filter, the code attempts to retrieve a
> reference to the MBeanServer and register an MBean. During startup,
> however, it appears that the server is null (i.e. hasn't been started).
> I know that Tomcat ships with the mx4j server/classes, so I was
> wondering if there is a way to instruct Tomcat to load the mbean server
> so that it is available even for filters/servlets that are loaded on
> startup? (I know that there is a way to use the mbeans descriptor file,
> but unfortunately this mbean is dynamic and created and referenced in
> the code directly so it can't be initialized outside of the filter's
> scope. )
>
> If anyone has any suggestions, please let me know.
>
> TIA,
> Mayer
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org