Monday Aug 24, 2009

Using Alfresco with Sun software products

Alfresco is a very popular open source Content management system (CMS) and Document management system (DMS). It competes well with commercial offerings. There has been a few instances of requests from technical folks, about the integration points between Alfresco and Sun software, primarily Glassfish application server, Sun Webspace portal server and OpenSSO.

Alfresco and Glassfish
Running Alfresco on Glassfish application server is pretty easy. This is well documented in Amanda's blog and also the Alfresco web site.

Alfresco and OpenSSO
Alfresco is well integrated with OpenSSO and Sun Directory server.

Alfresco and Sun Webspace Portal server
The content and documents managed in Alfresco can be displayed or administered in Sun webspace portal via Portlets. The Alfresco web services API or the CMIS api can be used to accomplish this . There is also a white paper written by our ISV engineering team, let me know if you need it.

On a final note, the Sun webspace server has a built in content management and document management system. If your requirements can be met with what Webspace can offer, then there is no need to use a separate CMS and DMS system ;-)

Wednesday Jun 17, 2009

Glassfish ESB v2.1 released and Sun Open Suite for SWIFT Solution

Glassfish ESB v2.1 has been released !! The key features of this release are:

  1. Support for GlassFish clustering in all components
  2. Intelligent Event Processor (IEP) Service Engine – Available in v 2.1 with Platinum level support. Enables complex event processing (CEP) and event stream processing (ESP) using the Continuous Query Language (CQL)
  3. New Systems Support: NetBeans IDE 6.5, GlassFish Enterprise Server 2.1, OpenSolaris 2008.11, Red Hat Linux AS 5 (32 and 64 bit) and IBM AIX 5L 5.3 (OS: 64 bit; JVM: 32 bit) (runtime support only) and lots more
You can download the software at the OpenESB website or the Sun download website. Congratulations to the Glassfish ESB team on this release.

Sun Open Suite for SWIFT Solution - Alliance Integrator Upgrade Program

About Alliance Integrator : Integrator is a SWIFT-specific integration layer designed to help firms integrate business applications with SWIFT. Licensed as an add-on to Alliance Access, this application integration framework is designed and built for SWIFT users by SWIFT, and is sold, supported, and maintained by SWIFT as well. Integrator has been built using Sun’s Java™ CAPS Financial EAI software, which includes : GlassFish™ Enterprise Service Bus (ESB) re information about Alliance Integrator, please contact SWIFT.

The Sun Open Suite for SWIFT Solution The Sun Open Suite for SWIFT solution demonstrates Sun’s experience in the SWIFT area, and comprises the following products, all of which have been optimised to work together with the SWIFT network and the Alliance product line.

  1. GlassFish™ Enterprise Service Bus (ESB)
  2. Sun Identity management Suite
  3. Sun Solaris
  4. Sun Cluster
  5. Sun SPARC and Intel systems

The Open Suite for SWIFT solution provides companies with a complete SWIFTNet access infrastructure and just one contact for support, lowering project risk and cost.

Sun’s Alliance Integrator Upgrade Program
Sun’s Alliance Integrator Upgrade Program offers a smooth, risk-free way for Integrator customers and partners to complement Integrator’s rich functionalities with the openness of Sun’s GlassFish ESB software.

Contact me or Sun, if you need more information or a demo on how this works. Please download the white paper, which has more details about the Sun Alliance Integrator upgrade program.

Friday Jun 05, 2009

Glassfish leads in open source application server adoption

A report by Ohloh on application server adoption in open source (commissioned by Sun is out) and has exciting news for Glassfish !! There is also a good summary at the Aquarium and John Clingan's blog

Credit: Image linked from

The Exec summary from the report:

Application Server Trends among Open Source Developers
Prepared for: Sun Microsystems
Prepared by: Jason Allen, Scott Collison and Robin Luckey

Abstract: Ohloh performed custom analyses against Ohloh's directory of open source projects, specifically drilling into each project's source code history to yield Java and Application Server metrics. While our open source coverage is comprehensive across the entire open source space, for this report we focused specifically on Java-based projects.

We have made a best-faith effort to have near 100% coverage of all Java-related open source projects. Ohloh is unique in its ability to measure development activity directly from the primary source. Other reports in this vein rely upon data from voluntary survey responses, or upon secondary metrics such as product sales figures.

These and similar strategies are only broad indicators of the true underlying activity. In contrast, Ohloh tracks the individual changes to source code as they are made by developers, and thus observes the act of software development itself. Ohloh data is accurate to the minute, the developer and the individual line of code. There is no closer way to objectively measure how developers are spending their time. Ohloh tracks development metrics for 38,359 open source projects. Of those, 14,450 contain some Java code. We track over 250,000 open source developers, 32,866 have authored Java code and over 16,000 have provided geographic information. These metrics are collected from over 3,500 forges.

Ohloh performed a custom data analysis to determine the adoption of application servers among open source developers. Key findings in this report are:

  • Of Java projects that target Java EE, GlassFish is the leading application server with just over 50% of projects targeting GlassFish (note that projects can target multiple application servers). Project adoption is a indicator of past and present health of an application server among open source developers.
  • Of Java new project starts that target Java EE, GlassFish is the leading application server for new project starts with 73% of all Java EE projects. Project starts is a leading indicator that is a reliable predictor of future market success.

GlassFish has gone from being a market lagging application server among open source developers in 2004 to becoming the market leading application server among open source developers today. GlassFish is well-positioned for future dominance in the market place with a very commanding position among new projects coming on line today. With that said the overall growth of Java development among open source developers is flat.

DELIVERABLES: This summary highlights the findings and includes backing information about what the data means and how it was gathered. Included with this document is a spreadsheet of the raw metrics.

Wednesday May 20, 2009

Sun Glassfish ES 2.1 - Connection refused error

I was recently at a massive deployment of Sun Glassfish Enterprise server's (2.1) in a deployment, where the topology was the Glassfish DAS, Node agents, Sun web servers distributed across Solaris Containers across multiple servers - that is horizontal and vertical scaling.

After installing the DAS and Nodeagents, we created Glassfish server instances for all Nodegents, in an app server cluster. When we tried starting the app server instances, we started getting lots of " Connection refused exceptions" in the server logs and the servers would refuse to start. One of the clue's, of what the problem could be was in Shalini's blog. This led us to think, this was related to some kind of hostname issue. The problem, it seems that when you have a cluster of app server instances, there should be a hostname mapped to an IP address entry in /etc/hosts, for every app server instance participating in a cluster

So, in /etc/hosts, you should have something similar to the following:

127.... localhost
xx.xx.xx.xx servername loghost
xx.xx.xx.xx GlassfishDAS
xx.xx.xx.xx Glassfish1
xx.xx.xx.xx Glassfish2
xx.xx.xx.xx Glassfish3

This problem, may probably not arise, if you there is a DNS server. In our case, we were operating from a Data center, with newly installed servers.

Thursday Apr 23, 2009

Connecting to a MySQL Master/Slave replication with JDBC and Glassfish

MySQL has been having a lot of traction with customers, partners and developers in India. A very popular architecture for using MySQL for large scale deployments is the MySQL Master/Slave replication (Replication enables data from one MySQL database server (called the master) to be replicated to one or more MySQL database servers (slaves)).
Credit: Image is linked from

One of things that change for developers, who are used to developing with other databases like Oracle, MS SQL server is the question on connecting to a MySQL master/Slave setup. There are several good resources which explain how to do this:
1. From MySQL web site: A snippet of the code from that article is reproduced below :
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Properties;

import com.mysql.jdbc.ReplicationDriver;

public class ReplicationDriverDemo {

  public static void main(String[] args) throws Exception {
    ReplicationDriver driver = new ReplicationDriver();

    Properties props = new Properties();

    // We want this for failover on the slaves
    props.put("autoReconnect", "true");

    // We want to load balance between the slaves
    props.put("roundRobinLoadBalance", "true");

    props.put("user", "foo");
    props.put("password", "bar");

    // Looks like a normal MySQL JDBC url, with a
    // comma-separated list of hosts, the first 
    // being the 'master', the rest being any number
    // of slaves that the driver will load balance against

    Connection conn =

    // Perform read/write work on the master
    // by setting the read-only flag to "false"

    conn.createStatement().executeUpdate("UPDATE some_table ....");

    // Now, do a query from a slave, the driver automatically picks one
    // from the list


    ResultSet rs = 
      conn.createStatement().executeQuery("SELECT a,b FROM alt_table");


Note: Please refer to the mySQL web site for any updates.
2. If you are using Spring, Hibernate and other popular frameworks, an article at tells you how to do it.

Wednesday Feb 18, 2009

Exciting new releases in Glassfish, Glassfish Web Space Server ..

A little belated, but anyway ;-)
  • Launch of the Glassfish portfolio : The Web stack based on Glassfish, is complete and has been launched. The portfolio consists of :
    1. GlassFish Enterprise Server: The fantastic Java EE compliant app server.
    2. GlassFish ESB: Lightweight and agile ESB platform, I have a comparison on the features between Java CAPS and ESB in one of my posts below.
    3. GlassFish Web Stack : is a complete LAMP/SAMP cross-platform portfolio of Web-tier technologies. Plugnplay, as per the customer needs.
    4. GlassFish Web Space Server: Our Portal service offering, in a new avatar. I love this, have been playing with this, since last Java One. Our customers in India, like the look and feel of this product.
  • Glassfish Enterprise manager - Similar to the MySQL model of advisors, we have released three great add-ons, for SNMP monitoring, Performance Advisor and Performance monitoring. These add-ons, come with the paid Glassfish enterprise server, hence more reasons to get a supported version, if you are using the free Glassfish server. The add-ons are available for download from, for customers with valid contracts. The Glassfish Aquarium has great blogs and articles on this release.
  • Sun web space server - The new portal server based on Liferay and the previous Sun portal server has been launched. The docs are available at and also the portal blog is alive with lots of posts and articles. Compliance to JSR 168, JSR 286, JSR 170, and WSRP 2.0, having an integrated Content management system, lots of web 2.0 gadgets, ease of installation/monitoring/administration, easy fitment with OpenSSO, TCO being highly competitive, the only "real" enterprise class open source portal server, are some of the great features, that I can see resonating with customers in India.

Monday Jan 12, 2009

Free Training on Glassfish, Web Services and more ...

Wow, you get a bunch of fantastic Free web based courses when you download Glassfish and enable Registration from the Glassfish Admin console. More details at . The courses are on Glassfish,Designing Web services, Securing Web services and more. I would say, why are you waiting ??

Wednesday Jul 23, 2008

Glassfish and other Sun products

Found this very useful picture, depicting the Glassfish app server and the various Sun products dependent on it:
Linked from

Monday Jun 30, 2008

Get GlassFish & MySQL Unlimited

A new software bundle from Sun, Get GlassFish & MySQL Unlimited - which means you can deploy unlimited Glassfish enterprise servers and MySQL Enterprise Gold edition servers, on any number of servers for a flat fee per year !!!

Thursday May 01, 2008

A Free (for personal use) virtualization tool from Sun !!!

Check out Sun xVM VirtualBox !! With this, you don't need to buy a tool (xVM virtualbox is free for personal and evaluation) like VMWare workstation. The host operating systems include, Windows, Solaris, Linux and Mac OS X. The Guest OS can be any x86 based OS. Wow !!

Thursday Mar 27, 2008

Provisioning to Red Hat Directory server

In a POC, that we are doing using Sun Identity Manager , one of the requirements was to demonstrate provisioning to Red Hat DS (RHDS). When, we started the RHDS admin console, the screens looked familiar, to someone who has used iPlanet/Sun Directory server. Then I remembered this news item, and everything else fell into place !!! The LDAP resource adapter works like a charm with RHDS. Just remember, RHDS and Sun Directory server are like the two sons, who ran away from their mother :-)

Wednesday Mar 05, 2008

Passed Sun Certified Enterprise Architect for JEE 5 !!

Sun had announced a Beta exam for SCEA for Java EE 5 last year, around Nov/Dec 2007. I had written the exam, submitted the assignment and had totally forgotten about it. I got a pleasant surprise today, when I reached home and saw the package from Sun and that I had passed the Sun Enterprise Architect certification !! I had started thinking about this exam,in 1999, right after I completed the programmers certification ;-)

Part 1 and 3 are pretty easy, and any person who has been involved with Java EE for 3-4 years, can easily crack it. Lots of Java/JEE design pattern questions, Enterprise architecture stuff like non-functional requirements/security. Don't crack your head by reading on API and other kinds of low level stuff, which you encounter in Sun programmer or developer exams. The assignment, takes some time. You need to deliver UML based artifacts for a sample scenario. I had to give a Sequence diagram, Class diagram, deployment diagram, package diagram and a write-up on the design/architecture choices used. I strongly recommend, doing the part 3 essay exam right after you complete part 2 assignment. Part 3 is almost, completely based on the assignment. Good luck !!

Wednesday Jan 16, 2008

Sun acquires MySQL !!

Yippee !! Please read the hot news at the Sun website, the MySQL website and Jonathan's blog.

Tuesday Jun 06, 2006

Porting ISV apps to Sun application server - some general guidelines

Our group gets involved in porting ISV applications to the Sun platform (OS/JDK/JES stack). I would like to share some experiences that I have had while portings apps to the Sun app server:

1. Getting web.xml to work on Sun app server is the key first step. Sun app server does not take too kindly to mistakes in web.xml. Hence make sure you run the web.xml through a xml validator like netbeans or xmlspy. The prime requirement is to get them validated against Some of things that you are bound to catch are things like duplicate entries, missing entries and entries in the wrong location. If we are porting to Servlet 2.3 spec, then there are other gotchas like url-pattern not allowing things like "\*.do" anymore.

2. Porting to sun-web.xml is another big step. This involves configuring database connection pool, ejb mappings etc.

3. Since our app server (8.1 or 8.2) comes out of the box with JDK 1.5.x (though it also supports 1.4.2_06 and above), errors may come up when the source code gets compiled with JDK 1.5.

4. Another important thing is to get your ant build.xml ready, to do a compile/deploy thing multiple times. The best thing (thats what I do) is to copy one of the sample build.xml file that comes with the app server samples directory.

5. If EJB's are being used, then a recompile is a must and creating the sun-ejb-jar.xml is the first step. If there are cmp mapping's, use a tool like netbeans or Sun Java Studio enterprise to do the mappings against a database schema

6. Check the WEB-INF/lib directory of the ISV app, they usually pack a lot of jar files (some required and some unwanted).

7. Another biggie is the xml parsers. Sun app servers ship with the latest xml parsers and you may encounter parser library clashes. Either rewrite the code or set the older xml library in the app server JDK prefix classpath or set the classloader delegate property to false in sun-web.xml (see for more details).

8. Another thing to watch out for is the web services that an ISV app may use. Sun app server bundles JWSDP, and if the ISV apps uses Apache Axis, the above library workarounds mentioned in xml parsers may work.
9. After we get this far, another thing that usually stumps the ISV is the way our App server is architected and how it runs. To put it simply, we have DAS (domain admin server) which is like the mother ship and has the admin console running on it (usually https and 4849 in app server 8.1) and has a app server server instance running on http/8080,https/8181). To create a new server instance, the first step is to create a node agent (run asadmin create-node-agent) and then start it (asadmin start-node-agent). The second step is to create a server instance with this node agent. This way, you have a server instance to play around with and not start and stop the DAS evertime. To restart this new server instance, you either stop/start the node agent or start/stop the server instance.

10. In case, you app server goes into a zombie state, do a "grep -i appserv", kill them and do a asadmin start-domain.

11. One more major major thing, is that the Sun app server 8.x has the Security manager turned ON by default. Hence, if the ISV app does things writing files/network calls etc, we will get a permission issue in the app server server.log file. You will either need to give a explicit permission to the ISV app in server.policy (the preferred way) or to test it quickly disable the security manager (by deleting proerty in JVM option - THIS IS NOT A GOOD THING IN PRODUCTION). I believe, this is not the case in Glassfish (Sun app server 9.x) and boy, I am happy !!

Ideally the Sun app server migration tool , should be sufficient. But hey, a tool can only go so far, and you will need to go down and get your hands a little dirty :-) This is not a comprehensive list of porting do's and dont's nor does it replace official Sun documentation ;-)

Monday May 15, 2006

A quick guide to setup load balancing and high availability cluster with Sun application server 8.1

I must be getting old, as I have installed/configured three different types of high availability setups for the Sun application server over the years. The first one was way back, when it was iPlanet app server 6.x, when you needed to do web tier HA setup, app server HA setup and FINALLY setup a directory server multimaster replication (yes you read that right) to complete the HA setup. Next was the Sun One app server 7.x HA setup with the HADB, SSH, RSH, RCP and what not. Now finally, we have the Sun Java system app server 8.x setup, which to tell you frankly, was a breeze when compared to all others. You kids have it very easy ;-)

This blog attempts to give a quick overview of how to setup load balancing and high availability using the Sun application server 8.1. You can use either the Sun JES 2005Q4 software bits or the file based installer of the Sun application server 8.1 Update x.

Architecture of our Sun Java System Application server

High availability/Load balancer setup

This architecture can be changed, to suit different criteria like machine availability, number of HADB nodes etc. For example, you can also do a quick setup with all the above components on a single server also.

Install DAS/Load balancer Plugin on server WS (where the Sun web server has been installed)

Run the Sun JES 2005Q4 installation program (or the file based Application server installer).

The following screen shot is from a stand alone Application server installer. If you use the Sun JES installer, select Application server and doubleclick the app server node and select ONLY the load balancer plugin,DAS and admin tool, If required ( Pointbase and sample apps) and please deselect any other JES components.

  • Select the web server instance directory like for example: /<JES base directory>/opt/SUNWwbsvr/https-<servername>

  • Click install and complete installation.

  • Start app server by invoking <as-homedirectory>/opt/SUNWappserver/bin/asadmin start-domain –user admin domain1

  • Verify, if you can access the app server admin console, by going to

Installation on AS1 and AS2 servers

On AS1 and AS2, make the following changes to /etc/system to BOTH servers and reboot the system. These changes are required for the High availability stuff to work.

For a server with 1 GB RAM, we can have the following settings:

set shmsys:shminfo_shmmax=0x40000000

set shmsys:shminfo_shmseg=20

set semsys:seminfo_semmni=16

set semsys:seminfo_semmns=128

set semsys:seminfo_semmnu=1000

Look at for more information on /etc/system settings for other kinds of servers.

Please follow these steps on both servers AS1 and AS2. Use the Sun app server 8.1 (or Sun JES 2005Q4 bits and start the install).

Enter the WS server name, port number, password etc (where we installed the DAS) in the next screen. This is how the node agent on AS1 will communicate with the DAS on WS server. Entering the correct DAS host name (WS), port number, admin/master passwords is very important.

Give some meaningful name for the Node agent name.

Complete the installation.

Start node agents on both AS1 and AS2

<App server base directory>/bin/asadmin start-node-agent --user admin

Note: The above commands assume that the DAS is running on default application server ports, if you have changed them please use the –port/--secure/--host options with all the asadmin commands. Please refer to the asadmin help. Please also note, that in the command line options above are two dashes --

Create a cluster on WS server

Open the app server admin console on WS server, https://WS:4849 and create a cluster and enter appropriate data for AS1 and AS2. A sample screen shot is given below, the instance names can be any meaningful names.


The above steps can also be created on the WS server, from command line, as follows:

asadmin create-cluster --user admin testcluster1

asadmin create-instance --user admin --nodeagent mde-iec1-cluster1 --cluster testcluster1 instance1

asadmin create-instance --user admin --nodeagent mdeiec-cluster2 --cluster testcluster1 instance2

asadmin start-cluster --user admin testcluster1

Note: The above commands assume that the DAS is running on default application server ports, if you have changed them please use the –port/--secure/--host options with all the asadmin commands. Please refer to the asadmin help. Please also note, that in the command line options above are two dashes --

Once, the cluster testcluster1 is created, start the application server instances using the “start instances” option in the same app server admin console screen on WS server.

Deploy a sample application to the cluster

The clusterjsp that ships with the Sun app server, is the best high availability application that can be used with the Sun application server.

asadmin deploy --user admin --target testcluster1 --availabilityenabled=true <appserverbase>/samples/ee-samples/highavailability/apps/clusterjsp/clusterjsp.ear

Check if clusterjsp has been properly deployed, by accessing http://as1:port/clusterjsp and http://as2:port/clusterjsp. It is important to set the –availabilityenabled=true property to get this application to work with our high availability cluster.

Setting up Load balancing on WS server

In this step, we will configure load balancing on the web server WS, such that requests for applications to WS, will be load balanced across AS1 and AS2. We have installed the load balancer plugin on WS, in one of the previous steps.

Previously, we would modify the loadbalancer.xml directly on the web server instance directory, but now this process has been automated.

Issue the following commands on WS:

asadmin create-http-lb-config -u admin testcluster1_lb1

Create a load balancer reference to the Cluster, testcluster1, we have created before.

asadmin create-http-lb-ref -u admin --config testcluster1_lb1 testcluster1

asadmin enable-http-lb-server -u admin testcluster1

The next step, is to make the clusterjsp to be load balancer enabled.

asadmin enable-http-lb-application -u admin --name clusterjsp testcluster1

The next step, is to set the healthchecker properties for the load balancer (it uses the default health checker properties, change them if you like)

asadmin create-http-health-checker -u admin testcluster1

asadmin export-http-lb-config -u admin --config testcluster1_lb1 loadbalancer.xml

This complete the creation of the loadbalancer.xml file. The above steps could have been manually added to the loadbalancer.xml file, but there would have been scope for errors to creep in. If you open loadbalancer.xml , you will see that only requests to URI clusterjsp will be loadbalanced/forwarded to the app servers. If you want all requests to the web server to be forwarded, please change the context root to be /.

Copy the loadbalancer.xml file to the web server config directory:

cp loadbalancer.xml /<mybase>/opt/SUNWwbsvr/https-<myinstance>/config/

Login to the web server admin console on WS, manage the web server instance and click apply changes. This will apply the changes and restart the web server instance.

Restart the application server instances in the cluster testcluster1 from the app server admin console https://WS:4849

Note: The above commands assume that the DAS is running on default application server ports, if you have changed them please use the –port/--secure/--host options with all the asadmin commands. Please refer to the asadmin help. Please also note, that in the command line options above are two dashes --

Testing Load balancing

Open a browser and go to http://WS/clusterjsp , note down the executed server from and executed server IP address fields. Click Refresh, and the notice that the requests are being executed from the same same app server. This demonstrates “sticky load balancing”.

Close the browser and open a new browser window, and go to http://WS/clusterjsp , note down the executed server from and executed server IP address fields. The request will have been executed from the second app server instance. This demonstrates “load balancing”.

Setting up the High Availability database for session failover

Note: The system clocks/dates on servers AS1 and AS2 must be similar. Please use something like rdate or set the time/date manually, else HTTP session synchronization will go for a toss.

Start a new terminal window on both AS1 and AS2, and start the HA manageability agents on both AS1 and AS2:

cd <Appserver-base-in-AS1andAS2>/hadb/4/bin

#./ma-initd start

(Note: You may need to add the execute permission to ma-initd before it can be executed)

We should get a message like “Listening for client connections on port 1862”

The above procedure can also be automated, such that ma-initd will start automatically at boot time, by creating a symbolic link for ma-initd at /etc/init.d

On the machine where DAS is installed, WS in our case, please issue the following command:

./asadmin configure-ha-cluster --port 4849 --user admin --devicesize 256 --hosts AS1,AS2 testcluster1

The high availability database will be created, and a message “Command configure-ha-cluster executed successfully” should be seen.

Note: I got tripped a couple of times when running with a server with multiple interface cards. The docs says setting the ma.server.mainternal.interfaces property in ma.cfg to a IP address will work, but I was not successful. Please let me know, if this worked.

Testing high availability with the the clusterjsp sample application

Open the app server admin console, https://WS:4849.

Open a separate browser instance, and access the clusterjsp sample, http://WS/clusterjsp

Add a a few session variables and data. Please note down the server from where the clusterjsp app was fetched. If for example, it was fetched from AS2, then using the app server admin console, shut down AS1. Reload the page, the page should still get reloaded and the session data should remain INTACT. This demonstrates HTTP session failover.

Restart AS1, and repeat the above test by shutting down AS2.

Happy clustering !!!!


Ramblings of a Sun engineer based in Bangalore, India. Strictly my own views and not my employer's.


« April 2014