users@glassfish.java.net

Re: How do I embed Glassfish v3?

From: <glassfish_at_javadesktop.org>
Date: Wed, 28 Jan 2009 14:28:27 PST

So far, it works!!

I have a super simple Main.java app that includes the one .jar file linked by bnevins and uses the code snippet linked by jc129909. This does exactly what I wanted: I can embed a light-weight, fast-startup server that can host content from a regular directory including both static resources (html, images, etc) as well as .jsp files.

Fantastic!!! Thanks so much guys. This embeddable mode is a big deal for me.

One minor gripe (I think this is a defect): server.stop() doesn't seem to work. If I write a super-trivial Main.java with just the following code snippet wrapped in a "main" method, the server will never properly shut down, because the server threads are still running

                EmbeddedInfo info = new EmbeddedInfo();
                info.setServerName("server");
                info.setHttpPort(8080);
                Server server = new Server(info);
                server.start();
                server.stop();
[Message sent by forum member 'massimoh' (massimoh)]

http://forums.java.net/jive/thread.jspa?messageID=328795