admin@glassfish.java.net

Re: ApplicationConfig AMX Mbean

From: Lloyd Chambers <lloyd.chambers_at_mac.com>
Date: Thu, 20 Mar 2008 19:07:23 -0700

Anissa et al

Regarding 'Libraries', AMX offers this interface as a mixin interface
for several other AMX interfaces.

public interface Libraries (javadoc stripped)
{
     public String[] getLibraries();
     public void setLibraries( String[] libraries );
}

But the serverbean defines these as a plain 'String'. Currently AMX
passes attributes through unchanged and so a 'String' is not a
'String[]' obviously.

We have several choices:
1. Change AMX to match. This is an incompatible change, but might be
acceptable.

2. AMX can maintain the same interface, and turn a String[] into a
String and vice-versa (this is what it does in V2). But the delimiter
to use might not be the same for every attribute.

There are other cases that use String[] such as the getJVMOptions().
That is why it too is not working; AMX is doing straight pass-thru in
V3, whereas in V2 it handled this by stringifying/de-stringifying.

Lloyd



On Mar 20, 2008, at 6:26 PM, Lloyd L Chambers wrote:
> Anissa,
>
> I deployed the app and it works OK except for "Libraries", which is
> a String[]. Arrays aren't yet mapped to the underlying ConfigBeans
> List<String>; this requires some special handling.
>
> The AvailabilityEnabled and Description attributes work just fine
> thought--but they start out as 'null'.
>
>
> jmxcmd> get *
> ---amx:j2eeType=X-ApplicationConfig,name=hello1---
> AttributeNames={AttributeNames,MBeanInfoIsInvariant,PropertyConfigObjectNameMap,WebServiceEndpointConfigObjectNameMap,ObjectName,Group,MBeanLogLevel,J2EEType,ContextRoot,InterfaceName,Description,Libraries,Enabled,MBeanLoggerName,ContaineeJ2EETypes,DAS,Name,DirectoryDeployed,ObjectType,DomainRootObjectName,NotificationInfo,FullType,AvailabilityEnabled,PropertyNames,ContainerObjectName,Location,EngineConfigObjectNameMap,Properties,ContaineeObjectNameSet}
> AvailabilityEnabled=<null>
> ContaineeJ2EETypes=X-PropertyConfig
> ContaineeObjectNameSet=
> ContainerObjectName=amx:j2eeType=X-DomainConfig,name=na
> ContextRoot=/hello1
> DAS=true
> Description=<null>
> DirectoryDeployed=false
> DomainRootObjectName=amx:j2eeType=X-DomainRoot,name=amx
> Enabled=true
> EngineConfigObjectNameMap={}
> FullType=X-DomainConfig.X-ApplicationConfig
> Group=configuration
> InterfaceName=com.sun.appserv.management.config.ApplicationConfig
> J2EEType=X-ApplicationConfig
> Libraries=<null>
> Location=file:/v3/run/domains/domain1/applications/hello1/
> MBeanInfoIsInvariant=true
> MBeanLogLevel=INFO
> MBeanLoggerName=MBeans
> Name=hello1
> NotificationInfo
> =
> {javax.management.AttributeChangeNotification:jmx.attribute.change,""}
> ObjectName=amx:j2eeType=X-ApplicationConfig,name=hello1
> ObjectType=user
> Properties={}
> PropertyConfigObjectNameMap={}
> PropertyNames={}
> WebServiceEndpointConfigObjectNameMap={}
>
> jmxcmd> set AvailabilityEnabled=false
> ---amx:j2eeType=X-ApplicationConfig,name=hello1---
> AvailabilityEnabled=false
> jmxcmd> set Libraries=""
> ---amx:j2eeType=X-ApplicationConfig,name=hello1---
> <no attributes found>
> jmxcmd> set Libraries=/v3/test
> ---amx:j2eeType=X-ApplicationConfig,name=hello1---
> <no attributes found>
> jmxcmd> get Libraries
> ---amx:j2eeType=X-ApplicationConfig,name=hello1---
> Libraries=<null>
>
> jmxcmd> set Description="Hello world test app"
> ---amx:j2eeType=X-ApplicationConfig,name=hello1---
> Description=Hello world test app
>
>
>
>
> Lloyd
>
> On Mar 20, 2008, at 5:06 PM, Anissa Lam wrote:
>> Hi Lloyd,
>>
>> Attached is the hello1.war.
>> Just do 'asadmin deploy hello1.war'. you can access it by going
>> to http://localhost:8080/hello1/index.jsp
>>
>> You should get the following 2 Beans AFTER server restart.
>> amx:j2eeType=X-DeployedItemRefConfig,name=hello1,X-
>> StandaloneServerConfig=server
>> amx:j2eeType=X-ApplicationConfig,name=hello1
>>
>> Thats true, even though you can run the app, the beans won't show
>> up unless you restart server. Same with undeploy.
>>
>> While you are looking at it, can you see why for the X-
>> DeployedItemRefConfig bean, get/set VirtualServer attribute throws
>> an exception ?
>> I need the VS to help me get the port to construct the URL for
>> launching the app.
>>
>> thanks
>> Anissa
>>
>>
>> Lloyd L Chambers wrote:
>>>
>>> Anissa,
>>>
>>> I'll look into it. What do I have to do to get an <application>,
>>> just deploy an app? (Please send one if you have one handy).
>>>
>>> Lloyd
>>>
>>> On Mar 20, 2008, at 4:30 PM, Anissa Lam wrote:
>>>>
>>>> Hi,
>>>> I don't know exactly what should be in <application> since there
>>>> is no dtd to refer to, but these 3 attributes are in V2's
>>>> <web-module>
>>>> - description
>>>> - libraries
>>>> - availabilityEnabled
>>>>
>>>> All of this shows up as attributes in ApplicationConfig, but when
>>>> you try to get it, you will get
>>>> javax.management.AttributeNotFoundException.
>>>> I think we should fix it so that the attribute won't show up or
>>>> return "" if it is not supported yet. Maybe libraries and
>>>> availabilityEnabled is in this category.
>>>>
>>>> However, i think description should be fixed so that it really
>>>> returns 'description' as whatever the uesr enters during
>>>> deployment.
>>>>
>>>> thanks
>>>> Anissa
>>>>
>>>
>>> ---
>>> Lloyd L Chambers
>>> lloyd.chambers_at_sun.com
>>> Sun Microsystems, Inc
>>>
>>>
>>>
>>
>> <hello1.war>
>
> ---
> Lloyd L Chambers
> lloyd.chambers_at_sun.com
> Sun Microsystems, Inc
>
>
>