Deploying the GBean to Geronimo
You can deploy GBeans using either the Geronimo console portal found at
http://localhost:8080/console or by executing the Geronimo
deployer tool. With the Geronimo server running, you can deploy the TestGBean using the following command:
java -jar <GERONIMO_HOME>bin/deployer.jar deploy
TestGBean.jar plan.xml
Username: system
Password: manager
The output from the deployment step will look similar to the following:
Username: system
Password: *******
Deployed com.example.gbeans/TestGBean/1.1/car
To verify the success of the deployment, run the
deployer tool with the
list-modules command, as follows:
java -jar <GERONIMO_HOME>/bin/deployer.jar list-modules
Username: system
Password: *******
The
list-modules command displays all the currently deployed modules and should show a line detailing the abstract name for the TestGBean deployment, similar to the following:
Found n modules
+ com.example.gbeans/TestGBean/1.1/car
...
Testing the GBean
After deploying the GBean successfully, you can execute the test code shown in
Listing 2 to test the deployment and view information about the GBean using JMX remoting:
After running the test, you should see the following output on the console:
 | |
| Figure 2. Geronimo Admin Console: Although you can run the test code to print out information about the TestGBean in the console, you can also see GBean information through the Geronimo Admin Console management application. |
TestGBean ObjectInstance Class Name: com.example.TestGBean
Attribute Infos:
org.apache.geronimo.gbean.AbstractName abstractName
org.apache.geronimo.kernel.Kernel kernel
org.apache.geronimo.gbean.GBeanInfo GBeanInfo
java.lang.ClassLoader classLoader
java.lang.String message
java.lang.String objectName
Operation Infos:
getMessage()
void doFail()
void doStop()
void doStart()
You can also view information about the GBean using the Geronimo Admin Console found at
http://localhost:8080/console. Log into the console and select the JMX Viewer link to see a list of Mbeans. Expand the "ServiceModule MBeans" node and then expand the "TestGBean" node. You will see a page similar to
Figure 2.
That completes this introduction to the GBean framework architecture. You've seen how to build and deploy a simple GBean.