Friday Dec 12, 2008

Checkout GlassFish source using Maven

I just found out that you can use maven scm plugin to checkout GlassFish source code.  You don't need to install svn on your system.

mvn scm:checkout -DconnectionUrl=scm:svn: -DcheckoutDirectory=v3

This command will create a subdirectory 'v3' from the directory where you run the command. 

To compile you just need maven and JDK 1.6. 

Thursday Nov 06, 2008

Admin CLI Pluggability - defining options and operands

GlassFish v3 Prelude formally launched today.  It's one of a kind app server based on OSGi modularity and HK2 component systems. With this architecture, developers can easily provide commands making CLI extensible and pluggable.  Sreeni has written an excellent blog on creating a CLI command.  He also provided a sample command to try out.   Believe me... it's that easy to write CLI command.

In this blog, I'll extend a bit more about defining a command's options and operands. Command's options and operands are variables denoted by the Param annotation:


String name;

Parameters can be added to @Param to determine the characteristic of the option or operand.  Here are the valid parameters:

  • primary - indicate that the variable is an operand.  If not defined, then the variable is an option.

  • name - option name. If not defined, then the variable name is the name of the option.

  • optional - indicate if the variable is an optional option or operand.  Default is true.

  • DefaultValue - default value of the option or operand.

  • AcceptableValues - comma separated acceptable values

  • ShortName - short name for te option. It has to be specified wit one character. e.g. "asadmin command-name -<short-name>=<option-value>"

  • Password - indicate if option is a password. If the option is a password, then the password value is declared in a passwordfile with the entrh, AS_ADMIN_<option-name>;=<password-value>. The passwordfile is passed in to asadmin command with --passwordfile option.

@Param variables can be of following types:

 Type  Command line is specified as:

 java.lan.String  --option-name option-value

 java.util.Properties  --option-name key1=value1;key2=value2

 java.util.List  --option-name value1,value2

 java.util.Boolean  --option-name if option is true and --no-option-name if option is false.

I will provide some examples in follow-up blogs.

Friday Sep 05, 2008

Closest Matching Commands are now in GlassFish v3

asadmin's closest matching commands is a popular feature in GlassFish v2 but it wasn't working in v3 for the remote commands.  Since GlassFish v3 is based on modularization, commands are now modularized.  If a module is installed, the commands for that module are available in asadmin.  For example if you have JBI module installed, commands relating to JBI are available in asadmin.  Yes, that means commands in asadmin are extensible and pluggable.  It also means that it's harder for the users to know which commands are available to use.

There is a list-commands command that lists all the commands in asadmin but it's not easy to find the commands that you want if there are 50 or more commands.  With the closest matching commands feature in GlassFish v3, it's easy to search for commands.

To search for "jdbc" commands:

Using regular expression to search for commands that start with "list": 

asadmin will also catch typos: 

This feature is available in GlassFish v3 promoted b23 build

Tuesday Oct 23, 2007

Troubleshooting Application Server Plugin in N1SPS

Sun Java System Application Server Plugin is very useful if you want to manage GlassFish Application Server in the enterprise system.   But when something goes wrong, how do you debug the plugin?  In this entry I will tell you how to troubleshoot Application Server Plugin execution in N1SPS.

There are two types of execution in the plugin:  preflight and deployment.  The preflight  simulates the plan execution. Although preflight always happens before a deployment, you can run a plan that is only a preflight.  The preflight captures failures like if the host is prepared and if required variables are set and if it's valid.  The deployment executes the component's install, uninstall and control procedures. 

Let's take a look at a preflight failure.  The preflight failures are easy to spot (see figure below).   From the message, it says that "appName cannot be null".  appName is a variable name and is required. 

 Click on the "Error Log" tab.  Error Log provides a list of hosts and steps that failed during the preflight and deployment phases of the plan. For each host, you have the option to view more information by clicking "Step Failed".  In the figure below, the "Context" column tells you that it failed in "preflight".

The "Run Results" tab provides you details in stepwise execution. 

From the "Run Results", you can easily spot that the failure is in Preflight.   The failure started in "lock host".  Click on the "lock host" link and "Step Status" is displayed.

Next, click on "View" in "Sub Steps Status".  A popup window is displayed with the Sub Steps Execution Summary.

From the Sub Steps Execution Summary, you can view the exact component execution.  The failure started in the control procedure called "validate".  This control checks for the variable appName and if it's null, raise an error.  

Now, let's take a look at a deployment failure.  In this example, I'm trying to start a standalone instance and I get a plan execution failure with the message:  "Error: unable to start instance."


The "Error Log" tab tells you that the failure came from Plan execution which is deployment.  The "Step Failed" link doesn't give too much information about where the failure is propagated.  So let's take a look at the "Run Results" tab to get a detailed step wise summary.


 In the "Run Results" tab, you can see that the failure is in Deployment execution.  The failure is in control procedure called "start". 

In the "Step Name" column, click on the link of the "control server: 'start'":

 To get more details, click on the link, "View" under Sub Steps Status column.  A popup window is displayed with the detailed component execution.

Looking at this table can be overwhelming since you may not know the exact step where the failure started.  Since Sun Java System Application Server Plugin uses the CLI tool, "asadmin" to execute the command, you want to look for the "native procedure sh".  But there are few native procedures.  The key is to look for the highest  nested level  where the native procedure failed.  In this case, the highest nested level is "7" (the 11th steps).  Click on the "Failed" link in the Status column.   A popup window with two boxes: stderr and stdout is displayed:

 The stdout box displays the exact output message from "asadmin" and stderr box displays the standard error message.  From the stdout box, you can see that the standalone instance is not able to start because the Node Agent is not running.

 Troubleshooting failures in Sun Java System Application Server Plugin is not difficult.  You just have to know where to look for the failures.  Once you get the hang of where to look for the failures, it's a straight forward process.

For additional resources, please refer to Application Server N1SPS Plugin - Blogs and Resources.

Thursday Oct 11, 2007

Mission Complete - N1SPS 6.0 Application Server Plugin Launched!

What an incredible mission!  This is the best Application Server Plugin ever released for N1SPS.  There were so many efforts pitching in to work on this plugin and I can proudly say that this is the best Sun Java System Application Server Plugin for N1SPS.  It's completely rewritten from scratch and we have unit-tests to cover all cases and ensure the quality of the plugin.

This mission started around March of this year.  We know the importance of a provisioning system when you work with enterprise software like GlassFish V2.   There were also requirements coming from the customer about improving the plugin.  So we ramped up our resources and worked hard to get this plugin released with N1SPS 6.0.  There were many late nights working on the plugin and we can now all pat on our backs to say that the mission is complete for this release.

Below is a table of the supported platforms and a short summary of the features: 

Supported Platforms

 Operation System
Minimum RAM
 JVM Version
N1SPS Version
Application Server Version
 Solaris 10 Sparc
 1 GB
Java SE 5, 6
 6.0Sun Java System Application Server 9.1 (Package based Distribution)
 Solaris 10 Sparc

 1 GB

Java SE 5, 6


Sun Java System Application Server 9.1 (Package based Distribution)
 Solaris 10 Sparc
 1 GB
Java SE 5, 6
Sun Java System Application Server 8.2 (Packaged based Distribution)
 Solaris 10 Sparc
 1 GB
Java SE 5, 6
Sun Java System Application Server 8.1 (Packaged based Distribution)
 Solaris 10 Sparc
 1 GB
Java SE 5, 6
Sun Java System Application Server 8.1 (Packaged based Distribution)
 Solaris 10 x86
 1 GB
Java SE 5, 6
Sun Java System Application Server 9.1 (Packaged based Distribution)
 Red Hat Linux 4.0
1 GB
Java SE 5, 6

Sun Java System Application Server 9.1 (Packaged based Distribution)



Installation of Sun Java System Application Server - using the plugin, you can install Sun Java System Application Server versions 9.1, 8.2EE and 8.1EE on different machines from one console without even logging on to the machines.  In addition, you can even install on multiple machines in parallel with just one mouse click.  This can really save you time and money. :-) 

Domain Management - domain management is easier using N1SPS Application Server Plugin. You don't need to login to the machine to create, delete, start and stop the domain.  Finding the domain administration port is straight forward since the domain configuration is saved in the N1SPS Master Server variable setting.

Node Agent Management - similarly, node agent management is easier using N1SPS since you don't need to login to the machine to create, delete, start and stop the node-agent.  Since N1SPS operates on "targetable host", you don't need to remember the domain user name, password and port number when creating the node agent.

Instance Management - allows you to create, delete, start and stop standalone or cluster instances.  Since instance configuration is saved in the N1SPS Master Server variable setting, it's easier to find out the instance port numbers. 

Cluster Management - allows you to create, delete, start and stop a cluster in a domain.  You can start multiple clusters with one mouse click.  You can even view the instances in the cluster.

Application Deployment
- allows you to deploy enterprise application to multiple targets like domains, clusters and instances.  Since N1SPS allows you to create an application component, the N1SPS Master Server automatically creates a version control of the application.  Say that you have an application checked-in to the N1SPS Master Server and decide to make changes, you can reload the component with the modified application and N1SPS Master Server will automatically do the version control for you.  You can easily roll-back to the older version if you wish.   See Sreeni's blog about application deployment here.

Installation of Load Balancer Plugin - no need to log in to separate machine to manage load balancer plugin.  In Application Server 8.1 and 8.2, you need to manually copy the loadbalancer.xml file to the WebServer instance location.  N1SPS Application Server Plugin will do that for you in one click.  Checkout Prashanth's blog on Installation of Load Balancer Plugin here.

Installation of HADB Server and Client - installating HADB Server and Client is simple with N1SPS Application Server Plugin.  No need to login to multiple machines to install HADB.  You can even start and stop HADB from N1SPS Master Server.  Checkout Prashanth's blog on Installation of HADB here.

Resource Configuration - allows you to create and delete resources using N1SPS Application Server Plugin.  With the asadmin component (described in Sreenivas's blog here), you can practically do every Application Server management  from this component.  

Download N1SPS and Application Server Plugin and try it out at no cost to you.  It's FREE! 

For additional N1SPS blogs and resources, please see Sreeni's blog

Wednesday Oct 10, 2007

Using N1SPS to do audit trailing of GlassFish V2 administration

One of the benefit of using N1SPS with Application Server Plugin to administer GlassFish V2 is all actions and changes made by administrators are recorded.  This feature is also known as audit trail.  Lets take a look at how this feature works.

In N1SPS left hand frame, you'll see a section called, "View Activity Log":

  Click on "Run History" and on the right panel, you'll see all the activities recorded


 click here to enlarge the image.

The 2nd column of the Run History screen is the Plan name.  The Plan name is descriptive and it tells the user the action of the plan.  Plan name is suffixed with an unique ID generated by the Master Server.  The 5th column is the target host and it tells the user where the action is taken place.  The 6th column tells the user which user executed the plan.  The 7th column tells the user the status of the execution.  The 8th and 9th columns display the start and end time.

Let's take a look at the first plan.  The plan name is "DomainAdminServer-inst-create-<unique ID>".  The name of the plan tells me that it's an install Domain creation.  If it's a markOnly install, then the plan name is "DomainAdminServer-markOnly-create-<unique ID>".  The Domain is created on "z19-AppServer-1" where "z19" is the physical host name and "AppServer-1" is the Application Server install ID.  I logged in as admin to create this domain.   The Domain creation is successful and it was created on 10/10/2007 at around 4:31-4:33pm. 

If you click on the link of the plan name, you'll be able to see more details of the plan including the domain name and port numbers.  In addition, you can even view the error logs and run results to view the preflight and deployment execution.  This is useful for debugging failed executions.

Download N1SPS and Application Server plugin  and give this feature a try.  I think this is a really good feature that supplements GlassFish V2 administration.

Please see Sreeni's blog for other references and blogs on N1SPS. 

Friday Oct 05, 2007

Using N1SPS in GlassFish V2 Enterprise Environment

Now that GlassFish V2 has launched, you are able to setup an enterprise environment website where you can create cluster of instances on multiple hosts.  Websites such as shopping carts, auctions, financial institution, health care and others rely on an enterprise setup to support scalability, load-balancing, fail over protection and high availability.   Surely, you don't want your site to crash and there are no backups or sessions persistence.  And of course, you want your site to be load-balanced so that if there are thousands of requests, customers are not waiting at your site to load.  Furthermore, if you want to setup a production and development systems, you want to be able to replicate the enterprise environment on a separate domain running on separate machines. 

A typical enterprise setup looks somewhat like this (click to enlarge image):


Where the color boxes represent domains and the outlined boxes represent the machines.  Missing from the diagram is the node-agents.  Each machine that has a server instance will require installation of a node-agent.
Adding load-balancer and HADB to the diagram:

where WebServer is installed on separate machine to load balance clustered instances and High Availability Database (HADB) is installed on another machine to provide high availability. 

In a data center, you may have hundred of machines and the machines may spread across many geographic locations.   As you can imagine, managing this enterprise setup can be very challenging and complex. 

GlassFish V2's administration console provides a very good web console to manage and administer domain.  However, if you have multiple domains, you'll need to login to multiple administration consoles.  Likewise, using GlassFish V2 CLI, you'll need to know the user name, password, host name and port number for each domain.

This is where N1 Service Provisioning System (N1SPS)  comes to the rescue. 

N1SPS is the solution to enterprise environment complexity by offering  deployment of multi-tier applications across heterogeneous platforms from one console.

And, you can get N1SPS for FREE!


So how do you use N1SPS with GlassFish V2?

First let me give a brief overview of how N1SPS works.  N1SPS is distributed software platform that includes the following special-purpose applications you install on the servers in your network. These applications interact to allow you to deploy software to the servers in your network.

  • Master Server โ€“ A central server that provides an interface for managing application deployments.
  • Remove Agent โ€“ A management application that performs operations on a host. Every server that you want to be controlled by the N1SPS must have the Remote Agent application.
  • Local Distributor โ€“ Optional servers that act as a proxy for the Master Server to optimize network communications across data centers and through firewalls.

There is a Sun Java System Application Server Plugin (available soon for FREE as well) that gets imported to N1SPS Master Server which allows you to do the following:

  • Installation of Sun Java System Application Server
  • Domain Management 
  • Node Agent Management 
  • Instance Management 
  • Cluster Management 
  • Application Deployment 
  • Installation of Load Balancer Plugin 
  • Installation of HADB Server and Client 
  • Resource Configuration

The plugin supports GlassFish V2 productized distribution, Sun Java System Application Server 9.1 as well as  Sun Java System Application Server 8.2 (which is part of Java Enterprise System 5) and 8.1 (which is part of Java Enterprise System 4).   Download Sun Java System Application Server 9.1 with HADB here.

You will need to install a Remote Agent for each machine that will have Application Server, WebServer and HADB installed. 

Here's an overview of how the setup looks like:


With this setup, you'll be able to administrator an enterprise system with multiple domains/node-agents/clusters/server instances with software load-balancer and HADB installed on multiple machines from one administration console and CLI.

Here's more blogs on N1SPS and Sun Java System Application Server Plugin:

Thursday May 31, 2007

Ant support in GlassFish

During JavaOne I was told that people were asking if GlassFish has ant tasks support.  

The answer is YES, GlassFish provides an ant utility called "asant".  "asant" is a wrapper script that calls ant.  ant 1.6.5 is included in GlassFish V2.  Using "asant" will allow you to use the built-in ant tasks to administer/configure/deploy application to GlassFish Application Server. 

Following are the supported built-in ant tasks:

Following tasks are new in GlassFish V2:

asant is located in your <GlassFish-install-dir>/bin or <GlassFish-build-dir>/public/glassfish/bin.  It's in the same directory as asadmin.

Thursday May 10, 2007

Who's behind Admin CLI and GUI?

Here we are.... Jane (me on the left) and Anissa, the Admin CLI and GUI Team in JavaOne 2007:


Tuesday May 01, 2007

Blog about GlassFish for a chance to Win a 52-Inch LCD HD TV

Not only is GlassFish V2 the first OpenSource AppServer with clustering and loadbalancing support, it also includes the following:

Since I work on the Command Line Interface module of GlassFish, I would also like to add that GlassFish has the best CLI support.  Yes, you can say I'm biased, but let me give you my reasons:

  • User Friendly (asadmin is CLIP compliant so commands/options are simple, intuitive and resemble  Unix commands)
  • Environment Variable Support for Option Values (set AS_ADMIN_<option_name>=<option_value> in the OS environment and you don't need to specify it on the command line.   This feature does not support password option)
  • Comprehensive manpage built-in (asadmin <command> --help or asadmin help <command> will display Unix like manpage of the command)
  • Password  Security (passwords are not visible on commad line)
  • Finding Closest Matching Commands (see previous blog

I'd love to have a new TV but I am not qualified to participate in this contest :-(  so I encourage you all to blog about GlassFish for a chance to win a 52-inch LCD HD TV.  

BTW:  This contest is open to outside of US.  See contest disclosures for list of countries.


Fish for a Flat Screen TV
Blog about GlassFish for a chance to win a 52" LCD HD TV. ยป More

Wednesday Apr 04, 2007

New and Improved CLI Monitoring in GlassFish V2

Before GlassFish V2, the only way to monitor attributes in CLI is using the "dotted-name" get command.
asadmin get --monitor (-m) dotted name...

The output looks like this for jvm uptime:

>asadmin get -m server.jvm.update-time
server.jvm.uptime-count = 1115738
(in millisec)

If user would like to monitor multiple attributes,  they would have to provide the "dotted-names" as operands:  "asadmin get --monitor <dotted-name1> <dotted-name2>...

This is rather cumbersome since user will need to find out the dotted-names for the attributes plus the output is difficult to read for multiple attributes.  In addition,  the output cannot be saved to a file for further analysis.

In GlassFish V2, there is a new command called monitor.
The output of the monitor command models Unix's vmstat.

The syntax of the monitor command is as follow:

monitor --type monitor_type --user admin_user [--terse=false] [--echo=false] [--interactive=true] [--host localhost] [--port 4848|4849] [--secure | -s] [--passwordfile file_name] [--interval 30] [--filter filter] [--filename filename] instance_name

To monitor jvm in server instance:

>asadmin monitor --type jvm --interval=5 server

The filename option allows user to save the monitoring attributes to a file in comma separated format.

The type option can have the following values:  httplistener, keepalive, filecache, connectionqueue, jdbcpool, jvm, threadpool, servlet, connecton, connectorpool, endpoint, entitybean, messagedriven, statefulsession, statelesssession, httpservice, webmodule.

The filter option is used to filter out multiple elements.  For example if --type is httplistener and there are two httplisteners in server instance (admin-server), the --filter option is used to specify the httplistener you'd like to monitor.

>asadmin  monitor --type httplistener --filter http-listener-1 --interval=5 server

The heading may look a bit crypted, but when you type the "h" key a legend is displayed:


To exit from the monitor command, press the "q" key.

<<>>Hope this new feature can help user monitor GlassFish and ensure that your application is running efficiently.>

Download GlassFish V2 and give this feature a try.

<script type="text/javascript" src=""> </script> <script type="text/javascript"> _uacct = "UA-1759290-1"; urchinTracker(); </script>

Thursday Nov 30, 2006

Finding CLI commands in GlassFish is now easier and better

Have you ever stumbled upon what commands to use in asadmin?
Have you ever mistyped a command and the following message is displayed?

Use "help" command for a list of valid commands.
CLI001 Invalid Command, list-component.

And when you execute "asadmin help",  the manpage scrolls down the screen with 200 commands.
Finding the right command is not easy, especially searching through the 200 commands listed in the manpage. 

For those who fall in the above scenario, I have good news to bring to you.
Starting in GlassFish V2 build 26, asadmin will search for the closest matched commands if the command cannot be found.

Let me give you some  examples.
Say that you mistyped "create-domain":

asadmin create-domian  options...


CLI001 Invalid Command, create-domian.
Closest matched command(s):

Use "help" command for a list of valid commands.

asadmin is able to figure out the command that you're trying to execute is "create-domain", not "create-domian".  

Now, say that you want find the commands associated "jdbc".

On the command prompt, type:

asadmin jdbc

returns all the commands with "jdbc":

CLI001 Invalid Command, jdbc.
Closest matched command(s):

Use "help" command for a list of valid commands.

You can even use regular expression to search for the commands.

asadmin "resource$"

returns all the commands that ends with "resource":

CLI001 Invalid Command, resource$.
Closest matched command(s):

Use "help" command for a list of valid commands.

You can narrow down the search by adding more regular expressions:

 asadmin "\^create.\*resource$"

returns all the commands that begins with "create"and ends with "resource":

CLI001 Invalid Command, \^create.\*resource$.
Closest matched command(s):

Use "help" command for a list of valid commands.

This feature also applies to the "help" command.  When a manpage cannot be found for a command, a list of closest matched commands is displayed.

If you find this feature interesting and want to give it a try, download the latest GlassFish V2. 

Click here... 

<script type="text/javascript" src=""> </script> <script type="text/javascript"> _uacct = "UA-1759290-1"; urchinTracker(); </script>

Friday May 19, 2006

Sessions at JavaOne 2006

I attended many sessions at JavaOne this year.  The two sessions that I utterly enjoyed are "Effective Java Reloaded" and "Java Puzzler". The media used in the overflow room for the "Effective Java Reloaded" was intermittently broken  so the last 30 minutes was pretty much wasted.  "Java Puzzler" was great!  I have to admit I got 2 out of the 10 puzzler correct.  It was a fun and interactive session.

I also attended one BOF presented by my colleague, Shreehdar Ganapathy.  This BOF was added at the very last minute.  Shreedhar presented the Clustering Framework, Shoal.  This framework will be used in the next EE version of Sun AppServer and it'll be open sourced.

Friday Jan 27, 2006

New CLI commands in SJSAS PE 8.2

Today, Sun announce the release of  new J2EE 1.4 SDK which includes App Server Platform Edition 8.2 (SJSAS PE 8.2)

You can download this from

One the cool highlight of this release is the bundling of  Java based, Derby database.

To support the Derby database, two new CLI commands are added and they are:

  • start-database
  • stop-database

These two commands are executed using the CLI utility "asadmin".  This utility is located in the bin directory.

By default the database starts with the following values:

  • port = 1527
  • host =
  • derby database system directory = ".", the current project directory

You can alter these values by using the following options in start-database command:

  • --dbport
  • --dbhost
  • --dbhome

To learn more about Derby database, visit this site:




« December 2016

No bookmarks in folder