Skip to main content

Web module monitoring using AMX

1 reply [Last post]
lunobili
Offline
Joined: 2008-10-14
Points: 0

Hi,
I have a few web modules with a class that implements the ServletContextListener. I do this because I have got some initialization work that is expensive and I want to make sure it all went well at start time rather then the first time users hit the application.

So here comes to the question:

I would like the application server to tell me if the context initialization went well rather than grepping the log for exceptions. How can I do this?

I figured out that AMX could be a good candidate to query these informations, but I have not found enough documentation to actually understand how to achieve this.
I found this interface https://glassfish.dev.java.net/nonav/javaee5/amx/javadoc/com/sun/appserv... that looks promising, but how do I get an instance of a class implementing it?

Thanks in advance for your kind reply,
Luca Nobili

Really sorry, I just realized that I posted this thread in the wrong forum. I wanted to post it in java.net Forums » GlassFish » GlassFish.
Can an administrator move it in the correct place?

Sorry for the inconvenience,
Luca

Message was edited by: lunobili

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
oleksiys
Offline
Joined: 2006-01-25
Points: 0

> I have a few web modules with a class that implements the ServletContextListener. I do this
> because I have got some initialization work that is expensive and I want to make sure it all
> went well at start time rather then the first time users hit the application.
Did you try servlet's load-on-startup config parameter?

> I would like the application server to tell me if the context initialization went well rather than
> grepping the log for exceptions. How can I do this?
Hmm, not sure I understand what you mean by "tell me"? :))
Just an idea. You can create one more "status" servlet, which will return the initialization state of the main servlet. So if initialization failed - your "status" servlet will return the exception.

> I figured out that AMX could be a good candidate to query these informations, but I have not
> found enough documentation to actually understand how to achieve this.
> I found this interface
> https://glassfish.dev.java.net/nonav/javaee5/amx/javadoc/com/sun/appserv... that looks promising, but how do I get an instance of a class implementing it?

Have no idea about it. Better to ask this on Glassfish forum.

> Really sorry, I just realized that I posted this thread in the wrong forum. I wanted to post it in
> java.net Forums » GlassFish » GlassFish.
> Can an administrator move it in the correct place?
I think it will be easier and faster for you to post new message in appropriate forum :)