dev@glassfish.java.net

Embeeded Glassfish

From: Márcio Geovani Jasinski <marciogj_at_gmail.com>
Date: Wed, 16 Mar 2011 23:44:01 -0300

Hi,

I have a question regarding Embeeded Glassfish version.
Is there any reason to embeeded version stop a container during
glassfish.stop() method and don't startup it again after a start?

The code I'm testing is below:


GlassFish glassfish = GlassFishRuntime.bootstrap().newGlassFish();
glassfish.start();
Deployer deployer = glassfish.getService(Deployer.class);
String deployedApp = deployer.deploy(new File("sample-ear.ear").toURI(),
"--contextroot=hello", "--force=true"); //Works fine
deployer.undeploy(deployedApp);
glassfish.stop();

glassfish.start();
Deployer deployer = glassfish.getService(Deployer.class);
String deployedApp = deployer.deploy(new File("sample-ear.ear").toURI(),
"--contextroot=hello", "--force=true"); //Doesn't work
(javax.ejb.EJBException: Attempt to invoke when container is in STOPPED)
deployer.undeploy(deployedApp);
glassfish.stop();


As you can see, I'm calling start, deploy, stop and everything works fine.
My sample-ear.ear file is nothing more than a Timer which prints something
every second...

After stop my application, I would like to restart the server (simulate a
glassfish restart) and at this point deploy cannot complete.
Looks like container was stopped during glassfish.stop() but didn't start
again after glassfish.start().

Is it designed to behave like that or is it a bug on embeeded version?

Cheers,
-- 
Márcio Geovani Jasinski
Blumenau, Santa Catarina
Fone: +55 47 9653 4899