dev@glassfish.java.net

AMX Attribute Name Issue

From: Jason Lee <jasondlee_at_sun.com>
Date: Fri, 12 Jun 2009 16:59:11 -0500

I'm trying to port the JMS support in the v2 GlassFish console into
the v3 codebase. When I load the page to create a new JMS Connection
Factory, I get a null pointer exception:

Caused by: java.lang.NullPointerException
        at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:
881)
        at
org
.glassfish
.admin.amx.config.ConfiguredHelper.findXMLName(ConfiguredHelper.java:
223)
        at
org
.glassfish
.admin
.amx.config.AMXConfigImplBase.getNameMapping(AMXConfigImplBase.java:
1217)
        at
org
.glassfish
.admin
.amx
.config.AMXConfigImplBase.getAMXAttributeName(AMXConfigImplBase.java:
1179)
        at
org
.glassfish
.admin
.amx
.config.AMXConfigImplBase.toAMXAttributeNames(AMXConfigImplBase.java:
1260)
        at
org
.glassfish
.admin
.amx.config.AMXConfigImplBase.getDefaultValues(AMXConfigImplBase.java:
1249)

Ultimately, that gets called from this line in the console code:

        Map defaultMap =
AMXRoot
.getInstance
().getResourcesConfig
().getDefaultValues(XTypes.CONNECTOR_CONNECTION_POOL_CONFIG, true);

As best as I can tell, getNameMapping() is getting all of the
attributes on the ConfigBean (hoping I have the terms and class names
right here ;). The call to
JMXUtil.getAttributeNames(info.getAttributes()) returns an array of 44
entries, one of which is "FullType." When "FullType" is passed to
findXMLName(), the xmlName can not be determined/deduced/calculated,
leaving the local variable xmlName set to null, which is then passed
to put() :

        mNameCache.put( anyName, xmlName );

which is where the error occurs (presumably meaning that a null value
is not a valid value in the Map).

It seems that the Object being interrogated is-a
ConnectorConnectionPoolConfig and FullType is coming from
com.sun.appserv.management.base.AMX, a deprecated class, for what it's
worth. I have two questions, then, I guess: How do I fix this, and/
or, am I dealing with the correct XType for v3? I've not been able to
find any documentation on any of this, so I've relied solely on
educated guesses from source code.

Thanks! 8-)

         Jason Lee
Senior Java Developer
GlassFish Administration Console

Sun Microsystems, Inc.
Phone x31197/+1 405-343-1964
Email jasondlee_at_sun.com
Blog http://blogs.sun.com/jasondlee
Blog http://blogs.steeplesoft.com