dev@glassfish.java.net

Re: AMX Attribute Name Issue

From: Lloyd Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Fri, 12 Jun 2009 15:06:39 -0700

Jason,

That older AMX code is all going away as soon as Anissa finishes the
conversion to the new AMX.v3 code; it is definitely not an issue with
the AMX.v3 code.

Is there a way I can reproduce this simply, say with CLI? I'm not
seeing the page in the GUI. Maybe an XML snippet would be all I need
to see this problem.

Lloyd

On Jun 12, 2009, at 2:59 PM, Jason Lee wrote:

> 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
>

Lloyd Chambers
lloyd.chambers_at_sun.com
GlassFish Team