users@glassfish.java.net

Re: start glassfish programatically

From: Florent Blondeau <fblondeau_at_pingwy.com>
Date: Tue, 18 Dec 2007 09:35:26 +0100

Hi,

Just an idea for you, I haven't tested or thought about it deeply :
asadmin is an executable... So you can call it from a Java app via Ant
(with Groovy it'd much easier... ;-) ), for instance
by creating :
    <target name="start-domain" description="starts application server
domain" depends="check">
        <echo message="Starting ${application.name} domain for
${glassfish.home}"/>
        <exec executable="${asadmin}" failonerror="true"
dir="${glassfish.home}">
            <arg line=" start-domain"/>
            <arg line=" --echo=${echo}"/>
            <arg line=" ${application.name}"/>
        </exec>
    </target>
This example comes from the so good Antonio Goncalves'Web site and its
petstore application
go to http://www.antoniogoncalves.org/xwiki/bin/view/Book/JavaEE5Install
then download the sources.
There is a file admin.xml at the root of the archive which describes the
targets created for ant that could
help you to start, stop, etc the domain.

That is a first idea for you, hope that helps

Florent

glassfish_at_javadesktop.org a écrit :
> Hi all!
> Is there a way to start glassfish programatically with java?
> In other words, i want to do the same as
> asadmin start-domain somedomain, but in java.
>
> Thanks,-
> [Message sent by forum member 'amdario' (amdario)]
>
> http://forums.java.net/jive/thread.jspa?messageID=250452
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>


-- 
Pingwy
27, rue des arènes
49100 Angers