dev@glassfish.java.net

Re: servlet and web module naming WRT AMX MBeans

From: Lloyd L Chambers <lloyd.chambers_at_Sun.COM>
Date: Thu, 27 Oct 2005 13:24:50 -0700
[resend, with html formatting for improved readability]

Jan,

Like JSR 77, AMX imposes a containment hierarchy, as well as certain relationships.  Here's how it's done for Servlets, WebModules and J2EEApplications:

Servlets and WebModules


A Servlet must refer to a WebModule via the 'WebModule=web-module-name' property in its ObjectName.  This WebModule must exist with j2eeType=WebModule,name=web-module-name in its ObjectName.

A Servlet or WebModule must also contain the property  J2EEApplication=app-name in its ObjectName.  If the WebModule is a standalone war file, then J2EEApplication=null, per JSR 77 specification.

Putting this all together, we should see the following proeprties in the JSR 77 Servlet and WebModule ObjectNames:

j2eeType=Servlet,name=servlet-name,WebModule=web-module-name,J2EEApplication=app-name
j2eeType=WebModule,name=web-module-name,J2EEApplication=app-name
j2eeType=J2EEApplication,name=app-name      // exists only if app-name != null

Servlet and WebModule monitoring

The Monitoring hierarchy mimics this more or less.  There is one wrinkle: standalone web modules and embedded web modules are a different 'type' and have different name structure.

For monitoring a standalone WebModule:
JSR 77: (category=runtime omitted from name)
j2eeType=WebModule,name=//virtual-server-name/web-module-name,J2EEServer=server-name,J2EEApplication=null
j2eeType=Servlet,name=servlet-name,WebModule=//virtual-server-name/web-module-name,J2EEServer=server-name,J2EEApplication=null

Monitoring (category=monitor omitted from name)
[the following is workable, but inconsistent]
type=webmodule-virtual-server,name=virtual-server-name,server=server-name,standalone-web-module=web-module-name
type=servlet,name=servlet-name,server=server-name,standalone-web-module=web-module-name,webmodule-virtual-server=server-name
type=web-module,name=//virtual-server-name/web-module-name,server=server-name
For monitoring an embedded  WebModule, the following is needed:
JSR 77: (category=runtime omitted from name)
j2eeType=J2EEApplication,name=app-name,J2EEServer=server-name
j2eeType=WebModule,name=web-module-name,J2EEApplication=app-name,J2EEServer=server-name
j2eeType=Servlet,name=servlet-name,WebModule=web-module-name,J2EEApplication=app-name,J2EEServer=server-name
Monitoring (category=monitor omitted from name)
type=application,name=app-name,server=server-name
type=web-module,name=//virtual-server-name/web-module-name,application=app-name,server=server-name
type=servlet,name=servlet-name,web-module=//virtual-server-name/web-module-name,webmodule-virtual-server=server-name,application=app-name
type=webmodule-virtual-server,name=virtual-server-name,application=app-name,web-module=web-module-name
type=application,name=app-name,server=server-name

Thoughts

The above names do require special-case code because the names aren't consistent:

type=webmodule-virtual-server,name=virtual-server-name,standalone-web-module=web-module-name,server=server-name
...vs...

type=web-module,name=//virtual-server-name/web-module-name


It would be nice if webmodule-virtual-server were modified to use the ObjectName:

type=webmodule-virtual-server,name=//virtual-server-name/web-module-name,server=server-name

However, the AMX code currently special-cases this, so it is not a show-stopper.

Thanks,
Lloyd

Jan Luehe wrote On 10/26/05 10:05,:
  
Lloyd,

Lloyd L Chambers wrote On 10/25/05 18:33,:

    
Jan,

I'm at home unfortunately.  Here is what I'm seeing--ghese names are
after running the AMX unit tests, which deploy most of the sample apps. 
I've grouped related names together as best I can figure out (see below
after my comments).
      
thanks for grouping the names! That helps.

I know what's going on: I had confused a web-module monitoring object
name with a virtual-server monitoring object name. I think the reason I
had confused the two is because the virtual-server monitoring object
name is a misnomer: it really represents a web module or app deployed on
a particular vs, and not the vs itself.

I had never understood why
MonitoringObjectNames.getVirtualServerObjectName()
would take "app" and "module" arguments. Now I understand.
It's really unfortunate that this method has been named this way.

As part of my recent changes, I had only modified
MonitoringObjectNames.getWebModuleObjectName() and
MonitoringObjectNames.getServletObjectName() to take into
consideration the ctx root, but I had not changed
MonitoringObjectNames.getVirtualServerObjectName().

Sorry for the confusion.

I take it you are only interested in object names of the form

type=webmodule-virtual-server

and

type=server,
    

I meant type=servlet.

Jan


  
but not type=web-module, right?

So the equivalent of j2eeType=WebModule in the monitoring world is
type=webmodule-virtual-server, not type=web-module, right?

Why are we even registering monitoring beans for type=web-module,
if those beans don't have any attributes?

Anyway, I'll send you a patch shortly to try out.

Thanks for your patience,


Jan




    
Looks like there are several issues:
1.  *For a web module within an application*:

Names are taken from two different places!

(a) The value of <web-uri> is being used for the  'web-module' property
value in type=webmodule-virtual-server:

type=webmodule-virtual-server,name=server,application=HelloWorld,category=monitor,server=server,web-module=*stateless-simple.war*

(c) The name used for the j2eeType=WebModule is taken from
<context-root> in application.xml. Ditto for type=web-module:

j2eeType=WebModule,name=//server/*helloworld*,J2EEServer=server,J2EEApplication=HelloWorld
type=web-module,name=//server/*helloworld*,application=HelloWorld,category=monitor,server=server

*Solution: *make the name used be context-root in both cases.  This
applies to servlets as well.
*Alternative*: /application-name/./context-root/


*2.  For a standalone web module:
*
Names are taken from two different places:

(a) The value of the "name" Attribute in <web-module> is being used for
the  'standalone-web-module' property value in
type=webmodule-virtual-server:

type=webmodule-virtual-server,name=server,category=monitor,server=server,standalone-web-module=*Car_Store**
***
**(b) The name used for j2eeType=WebModule is the <context-root> within
domain.xml:

j2eeType=WebModule,name=//server/jsf-carstore.war29357,J2EEServer=server,J2EEApplication=null

*Solution: *make the name used be context-root in both cases.  This
applies to servlets as well.
*Alternative*: /web-module-name/./context-root/
*
***
*3. Other notes*

(a) There are *two* category=monitor MBeans for the same web module. 
The important one is 'type=webmodule-virtual-server'.  The
'type=web-module' one seems to be useless, since it has no Attributes. 
Ditto for type=application.

type=webmodule-virtual-server,name=*server*,application=*HelloWorld*,category=monitor,server=server,web-module=stateless-simple.war

type=web-module,name=//server/*helloworld*,application=*HelloWorld*,category=monitor,server=server

(b) There are two JSR 77 MBeans j2eeType=WebModule for the same
WebModule within an application.  One of these has J2EEApplication=null:

j2eeType=WebModule,name=//server/*rmi-iiop-simple*,J2EEServer=server,J2EEApplication=*RMIConverterApp*
j2eeType=WebModule,name=//server/*RMIConverterApp*,J2EEServer=server,J2EEApplication=null
*!**null J2EEApplication**!**
*
Lloyd

----------------

jmxcmd> find type=web-module type=webmodule-virtual-server
type=application &category=monitor j2eeType=WebModule
j2eeType=J2EEApplication
*
Applications (OK):*

j2eeType=J2EEApplication,name=*MEjbApp*,J2EEServer=server,category=runtime
type=application,name=*MEjbApp*,category=monitor,server=server

j2eeType=J2EEApplication,name=*ManagementServiceEAR*,J2EEServer=server,category=runtime
type=application,name=*ManagementServiceEAR*,category=monitor,server=server

j2eeType=J2EEApplication,name=*__ejb_container_timer_app*,J2EEServer=server,category=runtime 
!no WebModule (OK)!
type=application,name=*__ejb_container_timer_app*,category=monitor,server=server
*
Applications (name mismatches and/or null J2EEApplication):*

j2eeType=J2EEApplication,name=*CartApp*,J2EEServer=server,category=runtime
j2eeType=WebModule,name=//server/*CartApp*,J2EEServer=server,J2EEApplication=null
*!**null J2EEApplication**!***
type=application,name=*CartApp*,category=monitor,server=server

j2eeType=J2EEApplication,name=*CustomJndiFactory*,J2EEServer=server,category=runtime
j2eeType=WebModule,name=//server/*CustomJndiFactory*,J2EEServer=server,J2EEApplication=null
*!**null J2EEApplication**!*

j2eeType=J2EEApplication,name=*ExternalJndiFactory*,J2EEServer=server,category=runtime
j2eeType=WebModule,name=//server/*ExternalJndiFactory*,J2EEServer=server,J2EEApplication=null
*!**null J2EEApplication**!***

j2eeType=J2EEApplication,name=*HelloWorld*,J2EEServer=server,category=runtime
j2eeType=WebModule,name=//server/*helloworld*,J2EEServer=server,J2EEApplication=HelloWorld
type=webmodule-virtual-server,name=*server*,application=*HelloWorld*,category=monitor,server=server,web-module=stateless-simple.war
!*???*!
/type=web-module,name=//server/*helloworld*,application=*HelloWorld*,category=monitor,server=server
type=application,name=*HelloWorld*,category=monitor,server=server/

j2eeType=J2EEApplication,name=*RMIConverterApp*,J2EEServer=server,category=runtime
j2eeType=WebModule,name=//server/*rmi-iiop-simple*,J2EEServer=server,J2EEApplication=*RMIConverterApp*
j2eeType=WebModule,name=//server/*RMIConverterApp*,J2EEServer=server,J2EEApplication=null
*!**null J2EEApplication**!*
type=webmodule-virtual-server,name=*server*,application=*RMIConverterApp*,category=monitor,server=server,web-module=*rmi-simple.war*
/type=application,name=*RMIConverterApp*,category=monitor,server=server
type=web-module,name=//server/*rmi-iiop-simple*,application=//*null
J2EEApplication*//,category=monitor,server=server/**

j2eeType=J2EEApplication,name=*__JWSappclients*,J2EEServer=server,category=runtime
j2eeType=WebModule,name=//server/*__JWSappclients*,J2EEServer=server,J2EEApplication=*__JWSappclients*
type=webmodule-virtual-server,name=*server*,application=_*_JWSappclients*,category=monitor,server=server,web-module=*sys.war*
/type=web-module,name=//server/*__JWSappclients*,application=*__JWSappclients*,category=monitor,server=server
type=application,name=*__JWSappclients*,category=monitor,server=server/

j2eeType=J2EEApplication,name=*jaxrpc-simple*,J2EEServer=server,category=runtime
j2eeType=WebModule,name=//server/*jaxrpc-simple*,J2EEServer=server,J2EEApplication=*jaxrpc-simple*
j2eeType=WebModule,name=//server/*jaxrpc-simple*,J2EEServer=server,J2EEApplication=null
*!**null J2EEApplication**!*
type=webmodule-virtual-server,name=*server*,application=*jaxrpc-simple*,category=monitor,server=server,web-module=*jaxrpc-simple.war*
/type=application,name=*jaxrpc-simple*,category=monitor,server=server//
type=web-module,name=//server/*jaxrpc-simple*,application=*jaxrpc-simple*,category=monitor,server=server/**

j2eeType=J2EEApplication,name=*jdbc-simple*,J2EEServer=server,category=runtime
j2eeType=WebModule,name=//server/*jdbc-simple*,J2EEServer=server,J2EEApplication=*jdbc-simple*
type=webmodule-virtual-server,name=*server*,application=*jdbc-simple*,category=monitor,server=server,web-module=*jdbc-simple.war*
/type=application,name=*jdbc-simple*,category=monitor,server=server//
type=web-module,name=//server/*jdbc-simple*,application=*jdbc-simple*,category=monitor,server=server/

j2eeType=J2EEApplication,name=*jndi-url*,J2EEServer=server,category=runtime
j2eeType=WebModule,name=//server/*jndi-url*,J2EEServer=server,J2EEApplication=null*
!**null J2EEApplication**!*
/type=application,name=*jndi-url*,category=monitor,server=server/

j2eeType=J2EEApplication,name=*logging-helloworld*,J2EEServer=server,category=runtime
j2eeType=WebModule,name=//server/*logging-helloworld*,J2EEServer=server,J2EEApplication=*logging-helloworld
*type=webmodule-virtual-server,name=*server*,application=logging-helloworld,category=monitor,server=server,web-module=*logging-helloworld.war*
/type=application,name=*logging-helloworld*,category=monitor,server=server//
type=web-module,name=//server/*logging-helloworld*,application=*logging-helloworld*,category=monitor,server=server/
**

j2eeType=WebModule,name=//server/*SimpleMessageApp*,J2EEServer=server,J2EEApplication=null
!*ORPHAN*?!
type=application,name=*SimpleMessageApp*,category=monitor,server=server

j2eeType=WebModule,name=//server/,J2EEServer=server,J2EEApplication=null
j2eeType=WebModule,name=//__asadmin/web1,J2EEServer=server,J2EEApplication=null
type=webmodule-virtual-server,name=*__asadmin*,category=monitor,server=server,standalone-web-module=*adminapp*

j2eeType=WebModule,name=*//__asadmin/*,J2EEServer=server,J2EEApplication=null
!*ORPHAN*?!
j2eeType=WebModule,name=//__asadmin/*asadmin*,J2EEServer=server,J2EEApplication=null
!*ORPHAN*?!
type=webmodule-virtual-server,name=*__asadmin*,category=monitor,server=server,standalone-web-module=*admingui***

*ORPHANS?:*

j2eeType=WebModule,name=//server/*service*,J2EEServer=server,J2EEApplication=null
type=application,name=*InboundMessageApp*,category=monitor,server=server


*Standalone web modules:

Looks like context-root is used for the standalone-web-module property,
but the name of the app is used for WebModule.
*
j2eeType=WebModule,name=//server/*bookstore*,J2EEServer=server,J2EEApplication=null
type=webmodule-virtual-server,name=server,category=monitor,server=server,standalone-web-module=*BookstoreWAR*

j2eeType=WebModule,name=//server/*jsf-carstore.war29357*,J2EEServer=server,J2EEApplication=null
type=webmodule-virtual-server,name=server,category=monitor,server=server,standalone-web-module=*Car_Store*

j2eeType=WebModule,name=//server/*jsf-components.war29358*,J2EEServer=server,J2EEApplication=null
type=webmodule-virtual-server,name=server,category=monitor,server=server,standalone-web-module=*JavaServer_Faces_Custom_Components*

j2eeType=WebModule,name=//server/*jsf-guessNumber.war29359*,J2EEServer=server,J2EEApplication=null
type=webmodule-virtual-server,name=server,category=monitor,server=server,standalone-web-module=*JavaServer_Faces_Guess_Number_Sample_Application*


j2eeType=WebModule,name=//server/*web-basic-auth.war29364*,J2EEServer=server,J2EEApplication=null
type=webmodule-virtual-server,name=*server*,category=monitor,server=server,standalone-web-module=*Welcome_to_BASIC_Security_Zone*

j2eeType=WebModule,name=//server/web-form-auth,J2EEServer=server,J2EEApplication=null
type=webmodule-virtual-server,name=server,category=monitor,server=server,standalone-web-module=*Formauth*

j2eeType=WebModule,name=//server/*webapps-simple*,J2EEServer=server,J2EEApplication=null
type=webmodule-virtual-server,name=*server*,category=monitor,server=server,standalone-web-module=*JSP_and_Servlet_Examples*