The following section lists the steps to run the AMX samples.
Ensure that the JAR file appserv-ext.jar has been added to your classpath. Some examples also require that j2ee.jar be present.
Define a SampleMain.properties file, which provides the parameters required by AppserverConnectionSource to connect to the DAS.
The file SampleMain.properties file should use the following format:
connect.host=localhost connect.port=8686 connect.user=admin connect.password=admin123 connect.truststore=sample-truststore connect.truststorePassword=changeme connect.useTLS=true
If you are running the Enterprise Server enterprise profile, TLS must be used (provided it has not been turned off). The useTLS property must therefore be set to useTLS=true. For information about profiles, see Usage Profiles in Sun GlassFish Enterprise Server v2.1.1 Administration Guide.
Scripts are provided in the com.sun.appserv.management.sample package to run the AMX samples.
Start SampleMain by running the appropriate script for your platform:
run-samples.sh on UNIX or Linux platforms
run-samples.bat on Microsoft Windows platforms
After SampleMain is running, you can interact with it by typing the commands examined above:
Enter Command> start-server serverName
Enter Command> list-attributes
You see output like this:
--- Attributes for X-DomainRoot=amx --- AttributeNames=[...] BulkAccessObjectName=amx:j2eeType=X-BulkAccess,name=na DomainConfigObjectName=amx:j2eeType=X-DomainConfig,name=na MBeanInfoIsInvariant=true J2EEDomainObjectName=amx:j2eeType=J2EEDomain,name=amx AppserverDomainName=amx ObjectName=amx:j2eeType=X-DomainRoot,name=amx [...]
Enter Command> show-hierarchy
You see output like this:
X-DomainRoot=amx X-ConfigDottedNames X-SystemInfo X-QueryMgr X-DeploymentMgr X-UploadDownloadMgr X-BulkAccess X-MonitoringDottedNames X-JMXMonitorMgr X-Sample X-DomainConfig X-WebModuleConfig=admingui X-WebModuleConfig=adminapp X-WebModuleConfig=com_sun_web_ui X-JDBCResourceConfig=jdbc/__default X-JDBCResourceConfig=jdbc/__TimerPool X-J2EEApplicationConfig=MEjbApp [...]
Enter Command> list
You see output like this:
--- Top-level --- ConfigConfig: [server2-config, default-config, server-config, server3-config] ServerConfig: [server3, server, server2] StandaloneServerConfig: [server3, server, server2] ClusteredServerConfig: [] ClusterConfig: [] [...]
Enter Command> list-properties
You see output like this:
Properties for: amx:j2eeType=X-JDBCConnectionPoolConfig,name=DerbyPool Password=pbPublic DatabaseName=jdbc:derby://localhost:9092/sun-appserv-samples User=pbPublic [...]
Enter Command> query
You see output like this:
--- Queried for j2eeType=X-*ResourceConfig --- j2eeType=X-JDBCResourceConfig,name=jdbc/__default j2eeType=X-JDBCResourceConfig,name=jdbc/__TimerPool [...]
And so on for the other commands:
Enter Command> demo-jmx-monitor
Enter Command> set-monitoring monitoringLevel (one of HIGH, LOW or OFF)
Enter Command> stop-server serverName
Enter Command> quit