Saturday Sep 06, 2008
Saturday Sep 06, 2008
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
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
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:
| Operation System | Minimum RAM | JVM Version | N1SPS Version | Application Server Version |
| Solaris 10 Sparc | 1 GB | Java SE 5, 6 | 6.0 | Sun Java System Application Server 9.1 (Package based Distribution) |
| Solaris 10 Sparc | 1 GB | Java SE 5, 6 | 5.2 | Sun Java System Application Server 9.1 (Package based Distribution) |
| Solaris 10 Sparc | 1 GB | Java SE 5, 6 | 6.0 | Sun Java System Application Server 8.2 (Packaged based Distribution) |
| Solaris 10 Sparc | 1 GB | Java SE 5, 6 | 6.0 | Sun Java System Application Server 8.1 (Packaged based Distribution) |
| Solaris 10 Sparc | 1 GB | Java SE 5, 6 | 5.2 | Sun Java System Application Server 8.1 (Packaged based Distribution) |
| Solaris 10 x86 | 1 GB | Java SE 5, 6 | 6.0 | Sun Java System Application Server 9.1 (Packaged based Distribution) |
| Red Hat Linux 4.0 | 1 GB | Java SE 5, 6 | 6.0 | 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
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
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. | ![]() |
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.
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:
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:
http://blogs.sun.com/saju/entry/n1_service_provisioning_system
http://blogs.sun.com/Prashanth/entry/n1sps_application_server_plugin_6
http://blogs.sun.com/Prashanth/entry/provisioning_glassfish_v2_with_n1sps
http://blogs.sun.com/Prashanth/entry/provisioning_glassfish_v2_with_n1sps1
http://blogs.sun.com/Prashanth/entry/provisioning_glassfish_v2_with_n1sps2
http://blogs.sun.com/Prashanth/entry/provisioning_glassfish_v2_with_n1sps3
http://blogs.sun.com/msreddy/entry/support_for_asadmin_command_in
Friday Jun 01, 2007
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:
asant is located in your <GlassFish-install-dir>/bin or <GlassFish-build-dir>/public/glassfish/bin. It's in the same directory as asadmin.
Friday May 11, 2007
Here we are.... Jane (me on the left) and Anissa, the Admin CLI and GUI Team in JavaOne 2007:
Wednesday May 02, 2007
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:
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.
Thursday Apr 05, 2007
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.
i.e.
>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.
Download GlassFish V2 and give this feature a try.
Friday Dec 01, 2006
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...
returns:
CLI001 Invalid Command, create-domian.
Closest matched command(s):
create-domain
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):
create-jdbc-connection-pool
create-jdbc-resource
delete-jdbc-connection-pool
delete-jdbc-resource
list-jdbc-connection-pools
list-jdbc-resources
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):
create-connector-resource
create-custom-resource
create-javamail-resource
create-jdbc-resource
create-jms-resource
create-jndi-resource
create-persistence-resource
delete-connector-resource
delete-custom-resource
delete-javamail-resource
delete-jdbc-resource
delete-jms-resource
delete-jndi-resource
delete-persistence-resource
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):
create-connector-resource
create-custom-resource
create-javamail-resource
create-jdbc-resource
create-jms-resource
create-jndi-resource
create-persistence-resource
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.
Friday May 19, 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
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 http://java.sun.com/j2ee/1.4/download.html.
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:
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:
You can alter these values by using the following options in start-database command:
To learn more about Derby database, visit this site: