users@glassfish.java.net

Re: GlassFish JMX for Dummies ?

From: Vijay Ramachandran <Vijay.Ramachandran_at_Sun.COM>
Date: Wed, 03 May 2006 20:09:55 -0700

the sample test mentioned below does this :

1. It builds a portable.war and plan.jar; portable.war contains all
portable artifacts (class files, web.xml); plan.jar contains all
platform specified descriptors (sun-web.xml in this case).

2. Then the target common.run.jsr88 in deployment/config/common.xml is
called which invokes JSR88Deployer (the method being invoked is passed
as param name=command).

JSR88Deployer has methods like deploy, undeploy which invoke jsr88 API
through the dpeloymentManager

Hope this helps

Vijay

Mark Hansen wrote:

> Thanks Vijay. Yes, I have the appserv-test. I looked there quickly,
> but couldn't understand what was going on and how JSR88Deployer was
> getting invoked or what its purpose was. Sounds like it is exactly
> what I need to build the plugin.. I'll take a closer look.
>
> Vijay Ramachandran wrote:
>
>> Hi Mark,
>>
>> Do you have access to glassfish/appserv-tests module ?
>>
>> If so, take a look at the tests under appserv-tests/devtests/deployment
>> - Almost all the deployment dev tests test deployment using asadmin as
>> well as deployment using jsr88. The tests use this util
>> glassfish/appserv-tests/devtests/deployment/util/JSR88Deployer. You can
>> check this out to see how to use jsr88 apis for deployment.
>>
>> For example take a simple test like
>> glassfish/appserv-tests/devtests/deployment/jsr88/war/simple. Basically,
>> jsr88 allows you to package portable stuff (web.xml, ejb-jar.xml etc)
>> separately from the non-portable stuff (sun-*xml) as a separate
>> deployment-plan.jar
>>
>> Hope these sample tests will give you an idea
>>
>> Vijay
>>
>>
>> On Wed, 2006-05-03 at 08:42, Mark Hansen wrote:
>>
>>
>>> Cool. Thanks for the explanation about AMX.
>>>
>>> To clarify ... are you saying that it is not possible to do portable
>>> deployment using JSR-88? My interpretation of your comments is
>>> that, even with JSR-88, it is not possible to write a generic
>>> deploy/undeploy utility that will work for all Java EE 5 app servers
>>> vis JSR-88. Am I understanding this correctly? Would this be
>>> because of platform specific descriptors (e.g., sun-web.xml), or is
>>> there more to it than that?
>>>
>>> Kedar Mhaswade wrote:
>>>
>>>
>>>
>>>> (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
>>>>
>>>>
>>>>
>>>> Mark Hansen wrote:
>>>>
>>>>
>>>>
>>>>> There is a maven 2 plugin for JBoss (maven-plugin-jboss). It uses
>>>>> JMX to let you deploy/undeploy J2EE apps. I'm trying to modify it
>>>>> to create a similar plugin for GlassFish. Unfortunately, I am
>>>>> clueless about JMX. Is it possible to deploy/undeploy Java EE 5
>>>>> apps (WAR, EAR, etc) to GlassFish using JMX? If so, is there a
>>>>> tutorial somewhere that I could use to get started?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Mark
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>