users@glassfish.java.net

re: Glassfish deployment with JMX [was GlassFish JMX for Dummies]

From: Lloyd L Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Thu, 04 May 2006 08:46:01 -0700

[Thank you kedar for the nice explanation]

Please see the sample code for Samples.deploy():

https://glassfish.dev.java.net/nonav/javaee5/amx/samples/javadoc/
index.html

https://glassfish.dev.java.net/nonav/javaee5/amx/samples/javadoc/
index.html


------
From: Kedar Mhaswade <Kedar.Mhaswade_at_Sun.COM>
Date: May 3, 2006 8:11:02 AM PDT
To: users_at_glassfish.dev.java.net
Cc: Lloyd L Chambers <Lloyd.Chambers_at_Sun.COM>
Subject: Re: GlassFish JMX for Dummies ?


(Posting rather long response, but subject matter mandates it).

Accessing/Invoking "MBeans" is way to administer systems that
have an implementation of instrumentation and agent
level of standard JMX: http://java.sun.com/jmx.

There is a standard way to connect to these MBeans so as
to manage them programmatically. This is much like standard
ways to invoke the Java EE server side entities using HTTP,
RMI/IIOP etc. An example of such a "standard" JMX Connector
is JConsole that's distributed with Java SE 5.0+ distribution.

MBeans are just like Java Beans although there are flavors
that make more flexible and powerful management possible using
rather complex structures. GlassFish uses such complex MBeans
called "Dynamic MBeans". The "standard" way to invoke these
MBeans is rather non object oriented. Thus, if an MBean had a
"management" method like "start(int timeout)", you'll need to
invoke it as

anMBeanRegistrar.invoke(mbeanId, "start", params, signature);

(names are chosen for sake of brevity).

What I am getting at is the concept of "proxied" Objects
so that you could write client programs just like any other
program. Unfortunately, pure JMX does not provide these proxies
over the MBeans that might be arbitrarily complex.

Hence, GlassFish goes one step further than other JMX enabled
systems like JBoss in that it uses a programmatic Java "API"
for you to able to do what other admin tools like "asadmin"
or "admin GUI" do. Deployment is just a part of it. You'd need
to for example "programmatically" create certain JVM options that
would be required by the GlassFish runtime. This comprehensive
API is called "AMX".

All this and more is documented at:

https://glassfish.dev.java.net/nonav/javaee5/amx/index.html

There are quite a few examples there, for example:

https://glassfish.dev.java.net/nonav/javaee5/amx/samples/javadoc/
index.html

*Note*
This is the only official "programmatic" API to manage
GlassFish. Other ways suggested are just hacks.

The specific case of "deployment" is an interesting one because
Java EE "spec" tells users how to deploy apps to a server compliant
with JSR 88. So, in theory, you could be a JSR 88 client and do
*only* deployment that is Java EE standard compliant. But unfortunately,
you don't need to *only* deploy. A lot of configuration comes
along with it and you would need a more sophisticated way to do it.
That's what AMX tries to do.

While using AMX, on the client side all you need is a simple file
named "appserv-ext.jar" and not the entire GlassFish installation.

Regards,
Kedar