Skip navigation


2 posts from office, read some news updates on Aquarium, remembering when I was in High School, I used to do programming in Pascal Programming Language. Simple application for PC run on x86 machine is just a single file or a bit of files only, do all process needed; such as computing, data or I/0 access and network interfacing.

In todays Distributed Computing model,  application is not just a single or several files in same places and work on stand alone machine anymore, by machine limitation to process heavy load of computation, to distribute computing power in networked machine is a must, separating data access and processing module, and even graphical view is sometime also needed.  In complex application model, where it need to be deployed on Server architecture machine with high processing and I/0 capability, separating data and application itself is a need, there are database machine to store, retrieve and managing data, application machine where logic and data processing happen, called 'business logic' container. To increase performance, computing process also distributed.

There are paradigm to separate above entity as server-side architectural design, in order to achieve scalability, availability, manageability, performance stability and interoperability, such as in Java arena, we already knew about Java EE (Enterprise Edition), standard server-side development framework and design for heavy transactional application was introduced. Application separeted into Multi-tier, Database Entity Back End/EIS Tier, Business Logic Container/ Business Tier and View/Web Tier where user interaction maintained.

This archetural approach make ‘life easier’, in development and production of complex server-side application, managing data source, application modules, user view, session and all components in one place is not an easy tasks. Updating one part will affect to another part, it is also dangerous when updating module then affecting critical data changes. Another pain part is, to put data and processing module un-encapsulated module, all in one place components  will make risk of unwanted data access of outsider into system, it make system un-secure. But dividing software component into modules also need complicated technical understanding of framework itself, implementing the rules, surely resource utilization to make development on this model come true.

Day by day, simplicity in development and maintenance is increased, I found Java EE make server-side software development easier and simpler, most commons functionality already provided by Java EE container (Application Server) as a standard compliant Java EE implementation, develop application become fun, server-side development is not a nighmare anymore.  On other way, run simple application on full-supported Java EE compliant container is a bit wasting processing resources.  For example, to run simple application on GlassFish Application Server, first you have to install it, configure the server and domain, make datasource connection with external database, set JMS, Web Services, EJB or JNDI if needed and finally put your application (.WAR, .EAR) in this. It is also take time to boot up the server with available implemented modules.  Since GlassFish ver. 3.0, Java EE container is available in embedded manner, GlassFish Embedded was introduced. Although it mentioned that it is proposed for testing purposes, but all Java EE compliant implementation component are supported.

It is not you put your application into Server, but you embed the GlassFish Server into your application, as simple as you put a library, single JAR file to your application. It is just work, with all advantages of Java EE implementation on GlassFish Application Server. Application, Server, Database in JAR files with simple design, less maintenance and less resource utilization.  Here I tried to make light server-side application with minimum development effort and resources, yes just 3 files.

  • 1 file of your application WAR or EAR file.
  • 1 file of GlassFish  Embedded (Application Server + Java DB included) + 1 configuration file (optional).
  • 1 folder of Database. here embedded reliable Java DB  in GlassFish is used to access.

That is it!

Embedding GlassFish, starting server and deploying application just as simple as code below:


GlassFishProperties gfProperties = new GlassFishProperties();


gfProperties.setPort("http-listener", serverPort);


GlassFishRuntime gfRuntime = GlassFishRuntime.bootstrap();


GlassFish glassfish = gfRuntime.newGlassFish(gfProperties);




glassfish.getDeployer().deploy(new File(appName));



serverPort is port address used by GlassFish, appName is application name path to deploy. Separating configurable values into configuration file is better if you need to deploy several applications.

Stopping server and shutting down just as below:







To start embedded Java DB (known as Apache Derby) is just 2 lines of code. This code will be implemented in your WAR or EAR application.




Connection dbConn = DriverManager.getConnection("jdbc:derby:" + dbName + ";create=true");



Disconnecting and stopping database just another two lines of codes.







To make server more configurable, need to put 1 configuration file to register list of deployed application, its location, port address used, database paths and any parameter needed. Enough, no nightmare anymore, here how server-side Java EE programming and deployment is as easy as doing this in Pascal, is it?


Long Life GlassFish! Blog

Posted by fachim Nov 18, 2007
It has been more than 1 year, I was absent in GlassFish. Finishing my study, joining a job and came back to Indonesia, met my families, make me less in touch with, especially GlassFish project.

It's great, I read Arun's blog that we have been into third version of GlassFish. Still I have to read, learn and getting up any new features and improvement on this. Hey, congrat for this!

Thanks to Amy in GlassFish, Chris Adamson and Jennifer Palm whom provide me all those facilities, such as resources, documents, codes, and blog to share and discuss any ideas regarding this.

Long Life GlassFish!