Arch2Arch Tab BEA.com
Syndicate this blog (XML)

How JMX Saved My Day

Bookmark Blog Post

del.icio.us del.icio.us
Digg Digg
DZone DZone
Furl Furl
Reddit Reddit

Paco Gomez's Blog | April 1, 2005   8:23 PM | Comments (0)


During one of my last proof of concepts, I was helping with the migration of a home grown portal to WebLogic Portal 8.1. One of the old features to reuse was usage tracking, integrating it with WebLogic Portal. The idea was to include a WLP behavior tracking tag in the portal JSPs and to persist the tracking data using the legacy code. The portal tag looks like this:

<BehaviorTracking:displayContentEvent documentId="<%=pageCtx.getTitle()%>" documentType="PortalPage"/>

WLP offers a pluggable architecture for adding custom listeners to events. My custom listener would call the legacy code to persist the tracking information. The listener implements the com.bea.p13n.events.EventListener interface and it is developed as a utility class packaged as a JAR file in the APP-INF/lib directory.

The legacy code to persist tracking data was located under the WEB-INF/lib directory of the portal Web Application. For several reasons that code was packaged in this way and we couldn't change it. This packaging and the standard classloader hierarchy in an enterprise application made impossible to call the persisting function from the custom listener.

Having work with JMX extensively made me think I could use it to solve this dilemma. The JMX libraries are in the system classpath and the MBeanServer can be obtained from the JNDI tree. If any code running on the server can call MBeans, I could wrap the persisting functionality in a custom MBean and make it available for my custom event listener.

I developed the custom MBean and I registered on the MBeanServer from the Web Application, then I invoked one of its methods from the event listener loaded with the application classloader. The approach proved to be a good solution for the restrictions imposed by the classloaders, without having to configure custom classloader hierarchies. The added benefit was that the legacy persisting functionality was now manageable through JMX tools like wlshell.


Comments

Comments are listed in date ascending order (oldest first) | Post Comment



Only logged in users may post comments. Login Here.

Powered by
Movable Type 3.31