Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet to monitor other application over JMX.

 
raja patil
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am absolute beginner of JMX. We have deployed Symmetric DS replicator at Branch Offices in a local Tomcat Instance and
we can access Mbeans for its Instance to get various values successfully Over JMX with VisualVM/Jconsole etc. etc.
The replicator is replicating Local Database to HO which is Updated by Bunch of Local Applications written in non Java
languages like (VB/Delphi/C++ quite heterogeneous mix of small applications). We plan to extend these applications to
have replication Information dashboard so that users will info about status of replication activity. The information
we would like to show is accessible in Jconsole through Mbeans for Symmetric DS instance.

The idea we would like to implement is to have our own servlet deployed along with symmetric DS in same Tomcat Instance
as Another Context. Local application will pass HTTP Request to this servlet and servlet will respond with information (in XML Format)
about status of replication by querying over JMX to symmetric DS.

Is it possible to connect another context over JMX in same Tomcat Instance ?

if yes, How to do that ? any example/URLs/Books/code snippets etc. etc. are highly appreciated.


Thanks and warm regards.

Raja Patil.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18009
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, without doing anything as ambitious as RTFMing, thus putting you at the mercy of my questionable memory, I believe that JMX runs over a selected network port. So each monitored JVM needs its own unique port, since each JVM is an independent OS process and processes cannot share a port.

Servlets are not an ideal monitoring system, however, since they are expressly forbidden from spawning their own threads and servlets only run when a client request has been received and a response needs to be generated. So unless you're looking for a URL that a third party can use to query the various JMX sources on-demand, a servlet is not what you should use. For continuous or periodic monitoring, spawn a thread from the ServletContextListener.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic