667481 members! Sign up to stay informed.

Sponsored Links


Resources

Enterprise Java
Research Library

Get Java white papers, product information, case studies and webcasts

News News News Messages: 14 Messages: 14 Messages: 14 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

Kohsuke Kawaguchi: GlassFish v3 just got embeddable

Posted by: Joseph Ottinger on April 29, 2008 DIGG
Kohsuke Kawaguchi reports that he's able to run Glassfish V3 as an embeddable container, much as Jetty has been able to run for years: drop the container into your classpath, and run via code. There's no classloader isolation with this, but the ability to embed quickly and easily is hard to undersell.
...now you have the embeddable GFv3 API, which can be used like this:
GlassFish glassfish = new GlassFish();
// create smallest possible HTTP set up listening on port 8080
glassfish.minimallyConfigure(8080);

GFApplication app = glassfish.deploy(new File("path/to/simple.war"));

...

app.undeploy();
glassfish.stop();
Imagine the possibilities...

Thanks to the extensibility of GFv3, when you embed GFv3 in your JVM, you can plug into any of its extensibility points and tweak the behaviors in ways that you can't do with externally launched GFv3. You could also pick any flavor of GFv3 you want; if you just need the barebone servlet container and get smaller footprint, you can do that. But if you also need EJB functionality or some of our scripting offerings, that's cool with us, too.

...

Oh, did I mention the start up time? One good thing about using a single classloader to load everything is that classloading overhead becomes much smaller. On my system, the server now starts in 300ms or so, complete with a deployment of a webapp. How many seconds does it take for your application server to start?
This is separate from the OSGi deployment model mentioned earlier by Glassfish bloggers (and mentioned here on TSS) but, then again, this capability might serve OSGi deployers well in a pinch.

Threaded replies

·  Kohsuke Kawaguchi: GlassFish v3 just got embeddable by Joseph Ottinger on Tue Apr 29 05:46:42 EDT 2008
  ·  Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable by Jacek Furmankiewicz on Tue Apr 29 08:07:24 EDT 2008
    ·  Re: Adobe AIR, but in pure Java by Dominique De Vito on Tue Apr 29 10:28:20 EDT 2008
      ·  Re: Adobe AIR, but in pure Java by Jacek Furmankiewicz on Tue Apr 29 11:11:00 EDT 2008
    ·  Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable by Max Nelson on Tue Apr 29 17:49:47 EDT 2008
  ·  Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable by michele michele on Tue Apr 29 08:10:12 EDT 2008
    ·  Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable by Jacek Furmankiewicz on Tue Apr 29 08:14:54 EDT 2008
    ·  Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable by Joseph Ottinger on Tue Apr 29 11:39:54 EDT 2008
      ·  Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable by Jan Bartel on Tue Apr 29 21:03:32 EDT 2008
    ·  Quite popular by magnus rydin on Wed Apr 30 04:05:18 EDT 2008
      ·  Re: Quite popular by michele michele on Wed Apr 30 05:16:39 EDT 2008
        ·  Re: Quite popular by Paul Peters on Wed Apr 30 06:33:56 EDT 2008
        ·  Re: Quite popular by Jeff Salter on Wed Apr 30 12:41:54 EDT 2008
  ·  Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable by pawan kumar on Fri May 02 02:26:04 EDT 2008
    ·  Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable by Paul Peters on Mon May 05 04:21:42 EDT 2008
  Message #251450 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable

Posted by: Jacek Furmankiewicz on April 29, 2008 in response to Message #251447
Hm...thinking outside of the box here...throw togethere a Swing app with embedded Glassfish or Jetty, display an embedded JDIC browser as the only control in the main frame and deploy into it a web app written using JSeamless framework:
http://jseamless.org

and what you have is...Adobe AIR, but in pure Java, without the Adobe part.

Cool :-)

  Message #251451 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable

Posted by: michele michele on April 29, 2008 in response to Message #251447
Why should I use Glassfish V3 embedable instead of Jetty?
Jetty is a very light and fast embedable server.
Where is the innovation?

  Message #251452 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable

Posted by: Jacek Furmankiewicz on April 29, 2008 in response to Message #251451
I guess it would be that Glassfish is a full Java EE 5 container, so out of the box you get support for EJB 3.0, sessions beans, messaging beans, etc. Impressive set of functionality to have in an embedded app.

  Message #251460 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Adobe AIR, but in pure Java

Posted by: Dominique De Vito on April 29, 2008 in response to Message #251450
Hm...thinking outside of the box here...throw togethere a Swing app with embedded Glassfish or Jetty, display an embedded JDIC browser as the only control in the main frame and deploy into it a web app written using JSeamless framework:
http://jseamless.org

and what you have is...Adobe AIR, but in pure Java, without the Adobe part.

Cool :-)


I like the idea. In the same way, you might find interesting my post Revisiting XHTML as a base (?) for XUL-like programming, trying to gather a "global" view of this idea. For example, why not using Flying Saucer instead of a JDIC browser !?

Looks like (X)HTML is not dead, just as some web frameworks, like Wicket, are using it as template langage.

  Message #251466 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Adobe AIR, but in pure Java

Posted by: Jacek Furmankiewicz on April 29, 2008 in response to Message #251460
Because FlyingSaucer cannot display Flash. :-)

  Message #251468 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable

Posted by: Joseph Ottinger on April 29, 2008 in response to Message #251451
Why should I use Glassfish V3 embedable instead of Jetty?
Jetty is a very light and fast embedable server.
Where is the innovation?
What the heck are you talking about?

Whoever you are - you're making the same stupid mistake made by every idiot "Java EE programmer" who hates Java EE because EJBs were the wrong solution to a problem, and couldn't figure out that Java EE isn't the same as EJB. Not every problem requires a hammer; not every problem is a nail.

Jetty is a servlet container. It's a good one. Use it if it's all you need.

Glassfish is a Java EE container. It's ALSO a good one. Use it if you need more than Jetty provides - i.e., EJB, JCA, JMS, etc. etc.

While "jetty is as good as glassfish" is a qualitative statement, and can't be verifiable because of it, the comparison relies on an apples-to-fenceposts comparison. Speaking of fenceposts, aren't you supposed to be losing an argument with one?

  Message #251479 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable

Posted by: Max Nelson on April 29, 2008 in response to Message #251450
... or just use AjaxSwing and you don't need GlassFish/Flex ;-)

  Message #251505 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable

Posted by: Jan Bartel on April 29, 2008 in response to Message #251468
Interesting!

Doubly interesting as we're busy porting Jetty as an alternative webtier for Glassfish V3 (we also did this for V2 but that work has fossilized a bit as we've looked more to the future with V3).

Jan
http://www.webtide.com

  Message #251510 Post reply Post reply Post reply Go to top Go to top Go to top

Quite popular

Posted by: magnus rydin on April 30, 2008 in response to Message #251451
Why should I use Glassfish V3 embedable instead of Jetty?
Jetty is a very light and fast embedable server.
Where is the innovation?


Speaking from many years of experience, I can tell you that the interest for running embedded containers is huge.

Still, Glassfish footprint is not amongst the smallest, and I dare say that there is quite some way to go before it can compete with the vendors already in that market segment.

Either way, Its all very interesting and I am excited to see what it will lead to.

  Message #251516 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Quite popular

Posted by: michele michele on April 30, 2008 in response to Message #251510



Speaking from many years of experience, I can tell you that the interest for running embedded containers is huge.

Still, Glassfish footprint is not amongst the smallest, and I dare say that there is quite some way to go before it can compete with the vendors already in that market segment.

Either way, Its all very interesting and I am excited to see what it will lead to.


I agree. It is useful to run a web server embedded, I have already used jetty in this way some year ago: and the winning choice was due to its small memory footprint and its performance.

you get the problem: Glassfish is an AS, with a huge memory footprint and its performances are not so beautiful (I used an old version....I don't know if recently it became faster).

I heared that the V3 will be shipped with and without EJB... a glassfish embedded without EJB is similar to jetty, but a glassfish embedded with EJB could be too heavy.

  Message #251520 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Quite popular

Posted by: Paul Peters on April 30, 2008 in response to Message #251516
"The focus of the release is modularization, enablement of non Java EE containers, and embedability."

Maybe check http://wiki.glassfish.java.net/Wiki.jsp?page=PlanForGlassFishV3 , http://wiki.glassfish.java.net/Wiki.jsp?page=V3embedded
and https://hk2.dev.java.net/ about the modular and component based model GFv3 is based upon.
JEE5 (or maybe it's JEE6) is also component based, and additionally JSE7 will also implement a modular system, so once GFv3 will enter the beta phase around November 2008 you should be able to use it both as a monolithic app server and scattered around as "micro" servers.

hth
Paul

  Message #251533 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Quite popular

Posted by: Jeff Salter on April 30, 2008 in response to Message #251516
People are talking about huge memory footprint of Glassfish, since it's a full application server.

However, Glassfish is lazy - i.e. it uses lazy loading of containers, and only loads what the app needs at run time. So if you're running just a JSP/Servlet web app, only the web/servlet container part is loaded, and it's memory footprint should be roughly equivelent to Tomcat (doubt it would be as small as Jetty).

Then, if your app is using EJB, JMS, or JPA, Glassfish will load those containers/libraries, as needed.

And that gives it an advantage over plain old Tomcat or Jetty.

Add to that the fact that Glassfish is highly regarded as being very fast, easy to work with, and is fully JEE 5 compliant (it's the reference implementation), and you have a very compelling solution.

  Message #251705 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable

Posted by: pawan kumar on May 02, 2008 in response to Message #251447
Look a little like incomplete task.

Some questions:
1. Is this a replacement for JMX or it uses JMX internally?
2. Are you going to give me my datasources and my bound objects?
3. Is it going to launch a new server or connect to an existing server?
4. Why not provide an ANT task?
5. You want to deploy your programs using another program rather than a build tool that is meant for that?!?!

As of now, nothing but Marketing crap. Add an ANT task around it, and then tell me it is usable.

  Message #251873 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Kohsuke Kawaguchi: GlassFish v3 just got embeddable

Posted by: Paul Peters on May 05, 2008 in response to Message #251705
Pawan,

Can you please explain what you mean ? How can a java program since jdk 1.5 not be using JMX internally ? Or are you referring to the OSGi buzz ?

New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com

Dependency Injection in Java EE 6 - Part 1

Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (November 2, Article)

SAML: It's Not just for Web services

SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options. (September 28, Article)

Programming is Also Teaching Your Team

Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team. (September 22, Article)

Can Java EE Deliver The Asynchronous Web?

Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies. (July 14, Article)

JSF Flex

JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags. (June 29, Article)

The Rules of SOA - A Road to a Successful SOA Implementation

In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project. (June 23, Tech Talk)

Ari Zilka Talks About Terracotta 3.1

Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now. (June 15, Tech Talk)

Enterprise Application Integration, and Spring

In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements. (June 15, Tech Talk)

Google Web Toolkit: An Introduction

In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls. (June 4, Tech Talk)

Just Enough Early Architecture to Guide Development

Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable. (May 28, Tech Talk)

Productive Programmer: On the Lam from the Furniture Police

This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work. (May 26, Tech Talk)

Auto-Scaling Your Existing Web Application

Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers. (May 21, Tech Talk)

Automating Hibernate Mapping and Queries For Java Web Development

Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application. (May 19, Article)

Auto-Scaling Your Existing Web Application

In this session Nati Shalom demonstrates how to take a standard Java EE web application and scale it out or down dynamically without changes to the application code. Seeing as most web applications are over-provisioned to meet infrequent peak loads, this is a dramatic change because it enables growing your application as needed, when needed, without paying for unutilized resources. (May 19, Tech Talk)

Free Book PDF Download: Mastering EJB Third Edition

Mastering EJB was one of the original and most influential EJB books in the industry. Mastering EJB III now returns with two new expert co-authors, updated for EJB 2.1 and 30% new chapters including security, integration, best practices, open source, and more.
(Book PDF Download)

Application Server Matrix

The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
Java Solutions
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map