31 August 2005

Classloader query framework

With the introduction of the new classloading framework, an advanced diagnostic capability has been added to allow runtime queries to be performed against the current classloader state.

A number of prebuilt-queries are provided.

The query framework can be accessed in two ways.

Command Line Access

From the command line using System properties to specify the query to execute and any parameters to pass to the query.

Try this to see the list of available queries:

>java -Doc4j.start.query=ListQueries+Exit -jar oc4j.jar

To see the current state of the classloader tree for the default application, try this:

>java -Doc4j.start.query=LoaderTree(default.root)+Exit -jar oc4j.jar

+- ascontrol.root:0.0.0
+- test-tl-import.root:0.0.0
| |
| +- test-tl-import.web.web-app-log4j:0.0.0
| |
| +- test-tl-import.web.web-app-log4j.jsp151:0.0.0
+- default.web.defaultWebApp:0.0.0
| +- default.web.defaultWebApp.jsp2152:0.0.0
+- default.web.jmsrouter_web:0.0.0

+- default.web.jmsrouter_web.jsp187:0.0.0

Application Server Control Classloading MBean

Classloading queries can be executed via the Classloading MBean accessible from the System MBean browser available in Application Server Control.

Access the MBean:

Fire up ASC and access the System MBean Browser from the Administration tab.

The ClassLoading > Singleton MBean has an operation called executeQuery.

There are two executeQuery operations. The operation with 2 parameters can be used from this browser MBean client.

Click executeQuery (2) access the invoke operation page.

Invoking the executeQuery operation:

The executeQuery operation page shows the parameters the MBean operation takes.

The first parameter is the fully qualified classname of the query to execute.

All queries are packaged within the oracle.oc4.query package. The actual classname is the name of the query shown with the help page.

The second parameter allows the entry of parameters to be supplied to the query.

To see the state of the current classloader tree for the Default application, and all of it's children use the following parameters

queryClassName: oracle.oc4j.query.LoaderTree
queryArguments: default.root

You can see the list of queries, with a description of each by executing a query using the following parameters.

queryClassName: oracle.oc4j.query.ListQueries

No comments: