Wednesday Feb 11, 2009

TOTD #69: GlassFish High Availability/Clustering using Sun Web Server + Load Balancer Plugin on Windows Vista

TOTD #67 shows how to configure GlassFish High Availability using Apache httpd + mod_jk on Mac OS X. Even though that's a standard and supported configuration, there are several advantages for replacing Apache httpd with Sun Web Server and mod_jk with Load Balancer plugin that comes with GlassFish.

This Tip Of The Day (TOTD) shows how to configure Clustering and Load Balancing using GlassFish v2.1, Sun Web Server, Load Balancer plugin on Windows Vista. This blog is using JDK 6 U7, GlassFish v2.1 (cluster profile), Sun Web Server 7 U4, and Load Balancer plug-in with Sun GlassFish Enterprise Server 2.1 Enterprise Profile (with HADB link).

Lets get started!
  1. Install the required software
    1. Download JDK (if not already installed).
    2. Download and Install GlassFish v2.1. Make sure to configure using "ant -f setup-cluster.xml". This will ensure that the created domain is capable of creating clusters and can perform in-memory session replication for applications deployed on the cluster.
    3. Download and Install Sun Web Server. The process is very simple by unzipping the downloaded bundle, clicking on "setup.exe" and taking all the defaults.
    4. Download GlassFish Enterprise Profile for Load Balancer plugin bits. Start the install by clicking on the downloaded file and select the options as shown below:

    5. Copy the following "loadbalancer.xml" in "https-<host>" (replace <host> with the host name of your machine) directory of Sun Web Server installation directory:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE loadbalancer PUBLIC "-//Sun Microsystems Inc.//DTD Sun Java
      System Application Server 9.1//EN"

       <cluster name="cluster1" policy="round-robin" policy-module="">
        <instance name="instance1" enabled="true"
      disable-timeout-in-minutes="60" listeners="http://localhost:38080" weight="100"/>
        <instance name="instance2" enabled="true"
      disable-timeout-in-minutes="60" listeners="http://localhost:38081" weight="100"/>
        <web-module context-root="/clusterjsp"
      disable-timeout-in-minutes="30" enabled="true" error-url=""/>
        <health-checker interval-in-seconds="7" timeout-in-seconds="5" url="/"/>
       <property name="response-timeout-in-seconds" value="120"/>
       <property name="reload-poll-interval-in-seconds" value="7"/>
       <property name="https-routing" value="false"/>
       <property name="require-monitor-data" value="false"/>
       <property name="active-healthcheck-enabled" value="false"/>
       <property name="number-healthcheck-retries" value="3"/>
       <property name="rewrite-location" value="true"/>

      The parameters to be changed are highlighted in bold and explained below:
      1. Sun Web Server installation directory
      2. HTTP port of instances created in the cluster. The ports specified are the default ones and can be found by clicking on the instance as shown below:

      3. Context root of the application that will be deployed in the cluster. The Domain Administration Server (DAS) can be configured to populate this file whenever any application is deployed to the cluster.
  2. Create the cluster as explained in TOTD #67. The admin console shows the following screenshot after the cluster is created and all instances are created/started:


    and the following for 2 instances:

  3. Deploy "clusterjsp" as explained in TOTD #67. The admin console shows the following screenshot after "clusterjsp" is deployed:

  4. Start Sun Web Server using "startserv.bat" in "https-<host>" directory.
This concludes the installation and configuration steps, now show time!

Accessing "http://localhost/clusterjsp" shows:

The Sun Web Server is running on port 80 and uses "loadbalancer.xml" to serve the request from the configured instances in <loadbalancer> fragment. This particular page is served by "instance1" as indicated in the image. Lets add session data with property name "aaa" and value "111". The value is shown as:

The instance serving the data, "instance1" in this case, and the session data are highlighted.

Now lets stop "instance1" using the admin console and it looks like:

Click on "RELOAD PAGE" and it looks like:

Exactly same session data is served, this time by "instance2".

The sequence above proves that the session data created by the user is preserved even if the instance serving the data goes down. This is possible because of GlassFish High Availability. The session data is served by the "replica partner" where its already copied using in-memory session replication.

The following articles are also useful:
Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all tips is available here.

Technorati: totd glassfish highavailability clustering loadbalancing lbplugin sunwebserver windows vista

Tuesday May 08, 2007

Screencast #WS5: Excel using WSIT! JavaOne 2007 Demo

Web Services Interoperability Technology (WSIT, aka Project Tango) enables first-class interoperability between Sun's Web services stack and Microsoft .NET 3.0 framework. First-class means truly out-of-the-box which does not require any configuration of parameters on either side. To demonstrate that, in JavaOne 2007, we are showing how an Excel 2007 spreadsheet on Windows Vista can invoke a secure and reliable WSIT endpoint hosted on GlassFish V2.

If you are attending JavaOne, session TS-4865 (Wed 4:10pm and repeat on Fri 1:30pm) and booth #966 in the Pavilion shows this sample in detail. But if you are not able to attend, then you can enjoy the screen cast.

Enjoy it here!

Here are the key points highlighted in this demo:

  1. Proven real-world interoperability with .NET 3.0. It's not just confined to "Hello World" or some arcane test case.
  2. Technologies transparent to applications
    1. No new APIs (use existing JAX-WS or EJBs)
    2. Excellent support in NetBeans IDE.
  3. Integrated with GlassFish V2, an open source, production-quality and Java EE 5 compatible application server.

Leave a comment on the blog if you have a similar scenario in your organization and would like to know more details.

Technorati: wsit webservices glassfish javaone screencast wcf

Wednesday May 02, 2007

Thunderbird 2 on Vista

Thunderbird 2 was released couple of weeks ago and I decided to upgrade my Thunderbird 1.5 on Vista Ultimate today.

Very seamless experience, I downloaded, installed and now running without any glitch! All address book and filters automatically imported.

Read the entire list of features but my favorite ones are:

  • Message History Navigation - Like browser, it now maintains a history of messages (both forward and backward) viewed.
  • Improved Search - Find as you type pane makes search more effective.
  • Automated Update - Automatically checks to see if an update is available, download and install.
  • Stay Informed - Provide more informative and relevant message alerts containing sender, subject and message text for newly arrived messages.

If you are using Firefox then you are already familiar with most of the above features but it's nice to see a consistent set of features in products coming out of Mozilla Foundation. And probably these features are available as add-ons for Thunderbird 1.5 but I never looked around. Feel free to drop a comment on this blog if you know of an interesting add-on.

Technorati: Firefox Thunderbird Mozilla Vista

Wednesday Apr 25, 2007

How to invoke a WSIT endpoint from a WCF client ?

You've developed a reliable, secure transactional and interoperable Web service using Web Services Interoperability Technology (WSIT, aka Project Tango) plug-in in NetBeans 5.5.1 and deployed on GlassFish v2. NetBeans IDE provide a very seamless experience to build such a Web service. The primary goal of WSIT is to provide first-class interoperability with Windows Communication Foundation (WCF), the Web services component of .NET 3.0 framework. Once the Web service is deployed, you'd like to invoke this Web service by writing a client using Visual Studio. It's not straight forward to do so today and this entry highlights the steps required to do that.

  1. If not already done, create a reliable WSIT endpoint and deploy on GlassFish v2 following the screencast #ws3.
  2. For creating a WCF client, install the following software
    1. If not using Vista, then install .NET 3.0 Framework runtime.
    2. Microsoft Visual Studio 2005 Professional Edition (available via MSDN) - There are additional requirements for Express editions (free lightweight versions of Visual Studio)
    3. Microsoft Visual Studio 2005 Professional Edition SP1
    4. Microsoft Visual Studio 2005 Professional Edition SP1 Update
    5. Visual Studio 2005 Extensions for .NET 3.0 Framework (WCF & WPF), Nov 2006 CTP - For Express editions, Windows Vista SDK is required as well for WCF scenarios.
  3. Start Visual Studio
  4. Create a new Visual C#, Windows, Console Application. Program.cs is shown in the main Visual Studio window.
  5. In Solution Explorer, right-click on the project name and select "Add Service Reference ...". This is the big difference. If you select "Add Web Reference ...", then this creates a proxy and app.config for .NET 2.0 framework. But WSIT is about interoperability with .NET 3.0 framework.
  6. Specify the location of the WSIT endpoint, in our case (http://localhost:8080/WebApplication1/NewWebServiceService?wsdl).
  7. In the Main function of Program.cs, add the logic to invoke the generated proxy. The code looks like:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using ConsoleApplication1.localhost;
    namespace ConsoleApplication1
        class Program
            static void Main(string[] args)
                NewWebServiceClient client = new NewWebServiceClient();
  8. Build the solution by selecting "Build", "Build Solution" (default shortcut Ctrl+Shift+B).
  9. Run ConsoleApplication1\\bin\\Debug\\ConsoleApplication1.exe. This will make a request to WSIT endpoint and get a response back.

The generated app.config file looks like:

<?xml version="1.0" encoding="utf-8" ?>
        <binding name="NewWebServicePortBinding">
          <reliableSession acknowledgementInterval="00:00:00.2000000" flowControlEnabled="true"
              inactivityTimeout="00:10:00" maxPendingChannels="4" maxRetryCount="8"
              maxTransferWindowSize="8" ordered="true" />
          <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" 
              messageVersion="Soap11WSAddressing10" writeEncoding="utf-8">
              <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
                  maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <httpTransport manualAddressing="false" maxBufferPoolSize="524288"
              maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
              bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
              keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
              realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
              useDefaultWebProxy="true" />
      <endpoint address="http://localhost:8080/WebApplication1/NewWebServiceService"
          binding="customBinding" bindingConfiguration="NewWebServicePortBinding"
          contract="ConsoleApplication1.localhost.NewWebService" name="NewWebServicePort" />

Here are the SOAP messages that get exchanged over the wire:

<?xml version="1.0" ?>
<s:Envelope xmlns:s=""
    <a:Action s:mustUnderstand="1"></a:Action>
    <a:To s:mustUnderstand="1">http://localhost:8080/WebApplication1/NewWebServiceService</a:To>
    <CreateSequence xmlns="">
<?xml version="1.0" ?>
<S:Envelope xmlns:S="">
  <To xmlns=""></To>
    <Action xmlns=""></Action>
    <MessageID xmlns="">uuid:b51f92ee-9ab9-4a90-a61e-d5dd3a77a0f9</MessageID>
    <RelatesTo xmlns="">urn:uuid:3429a390-96df-4f26-bd8c-fc85bd8f1858</RelatesTo>
    <ns2:CreateSequenceResponse xmlns:ns6="" xmlns:ns5="" xmlns:ns4="" xmlns:ns3="" xmlns:ns2="">
<?xml version="1.0" ?>
<s:Envelope xmlns:s="" xmlns:r="" xmlns:a="">
    <r:Sequence s:mustUnderstand="1">
    <a:Action s:mustUnderstand="1">sayHello</a:Action>
    <a:To s:mustUnderstand="1">http://localhost:8080/WebApplication1/NewWebServiceService</a:To>
    <sayHello xmlns="http://test/" xmlns:i="">
      <name xmlns="">Duke</name>
<?xml version="1.0" ?>
<S:Envelope xmlns:S="">
    <To xmlns=""></To>
    <Action xmlns="">http://test/NewWebService/sayHelloResponse</Action>
    <MessageID xmlns="">uuid:9091661c-c817-4411-b8aa-7f4f937162da</MessageID>
    <RelatesTo xmlns="">urn:uuid:d9c8b864-f236-40ad-a4c0-72c42565855f</RelatesTo>
    <ns2:Sequence xmlns:ns4="" xmlns:ns3="" xmlns:ns2="">
    <ns2:AckRequested xmlns:ns4="" xmlns:ns3="" xmlns:ns2="">
    <ns2:SequenceAcknowledgement xmlns:ns4="" xmlns:ns3="" xmlns:ns2="">
    <ns2:AcknowledgementRange Upper="1" Lower="1"></ns2:AcknowledgementRange>
    <ns2:sayHelloResponse xmlns:ns2="http://test/">
      <return>Hello Duke</return>

The same programming model will work for creating a WCF client if you add security or transactions support on the WSIT endpoint.

Technorati: wsit glassfish webservices vista wcf visualstudio

Monday Apr 23, 2007

Resolved Vista Upgrade Error 80070103

Follow up from here.

After getting bounced around between Microsoft Tech Support and MSDN Tech Support (seem to be separate entities) and collecting almost 5 different toll-free numbers for them, I finally resolved the error with help from a very talented and patient MSDN Tech Support professional.

Basically, the machine had two partitions - one using Windows XP and other Linux. And somehow the Linux partition was coming out as the primary active partition. So every time I was trying to install Vista, whether from within XP or boot from DVD, it was trying to look for an empty space on this partition. And of course it was not able to find any space because this file system is not NTFS. Now when I look at the error message again, it makes sense. But can't the installation process find out that there are multiple partitions, one of them using NTFS, and then provide that information ?

With tech support help, I resolved the issue by deleting and formatting both the partitions. Another way to resolve this was to set Windows XP as the active partition following these instructions.

I almost lost faith in Microsoft Tech Support but this one talented individual helped me restore it.

Technorati: windows Vista XP microsoft

Friday Apr 20, 2007

XP -> Vista Upgrade: Error 80070103

I've been trying to upgrade an Ultra 20/4 GB RAM with Windows XP + SP2 machine to Windows Vista Ultimate and it's just a plain ugly experience. I've installed Vista on two other machines and it was a much better but this one is the other extreme.

I insert the Vista media in the drive and it pops up a window with an option "Install now". I click on install and then it shows the following error message:

It's hard to understand this error message because the primary drive has 91 GB of free disk space and installed using NTFS. Is the error message trying to convey something else ?

Searched on pointed me to this. But this article is only talking about this error code when installing updates, not updating the whole operating system. Anyway, I installed all the latest updates recommended by Windows Update Center. I also disabled my antivirus software as recommended in "What to know before installing Windows" (even though it's a weird requirement) but this error will not go away.

Tried searching if temp directory is somehow assigned smaller space but didn't find anything on that topic. Not sure if that's even possible.

I posted a question to Vista installation newsgroup. The responses there point to a mismatch (1, 2, 3) between default display drivers provided by Microsoft and nVidia. So I uninstalled the default display driver and installed nVidia's display driver. But still the same error message/number. BTW, the machine has Quadro FX 1400 card.

Then called up nVidia Tech Support. It took them few minutes to figure out that I'm "overwriting" my Window XP with Vista even though I began the call with "I'm upgrading my XP to Vista". Anyway, after the person on tech support understood my issue, I was told to format my Windows XP and then tried installing Vista from scratch! Another quote is "This is definitely a Microsoft problem because Vista is not even getting installed" even though I mentioned that all the links are referring about nVidia driver mismatch. Additionally, main website links to Can your computer run Windows Vista ? which test and reports whether a system can run Windows Vista or not. Interestingly, my laptop (which already has Vista) failed this test at Minimum, Recommended and Optimal level. And the machine on which I'm trying to install Vista passes this test at Minimum level but still giving this weird error.

Finally I called up Microsoft Tech Support and they transferred me to MSDN tech support which close at 5:30pm PT on weekdays.

As a result, I'm stuck this weekend waiting for MSDN tech support to open up Monday morning and then will follow up.

Is Windows Vista really ready for prime time for any serious application ?

UPDATE: Submitted a bug here.

Technorati: windows Vista XP nVidia

Friday Apr 13, 2007

How to enable Aero in Vista ?

If you have a Windows Vista Capable PC and would like to experience Windows Aero (translucent windows, windows flip, windows flip 3d and smooth window performance) on Vista Ultimate, then:

  • Go to Control Panel
  • Select Personalization
  • Select Window Color and Appearance
  • Choose Windows Aero in Color scheme.

Read more about the 4 tiers of user interface in Vista.

If you have Vista Premium Ready PC and you install Vista, then Aero will be automatically configured on your machine. Here are the requirements for such a configuration:

  • a 1 GHz 32-bit (x86) or 64-bit (x64) processor
  • 1 gigabyte of system memory
  • a DirectX 9 compatible graphics processor, with a Windows Display Driver Model (WDDM) driver, and a minimum of 64 MB of Video RAM
  • 40 GB hard drive with 15 GB free space
  • DVD-ROM Drive
  • audio output and Internet access

Technorati: aero glass vista

Tuesday Apr 10, 2007

Vista on an External Display

Last week, I had to give a presentation and my Tecra M5 Vista laptop would not project on the screen. After playing around with the obvious suspects (Fn keys, Toshiba Presentation Button, changing the resolution) the reason was narrowed down to not having the correct display Driver. After I installed nVidia Display Driver, Vista could project on the screen and I gave a preso yesterday using the same laptop.

There was no need to restart Vista.

Technorati: toshiba tecram5 windows vista

Monday Apr 02, 2007

Laptop upgrade to Vista Ultimate

Follow up from previous entry.

I'm doing this on Toshiba Tecra M5 S433.

The document on how to Upgrade to Windows Vista for Toshiba Tecra M5 gave two options of "manual upgrade" and "manual clean installation". I decided to go the clean installation route mainly because it's simpler and cleaner. Here are the 4 steps listed in the document:

  1. Update the computer's BIOS
  2. Download the Toshiba RAID driver (if required)
  3. Install Windows Vista
  4. Download and install Toshiba software components for Windows Vista

The first step was straight forward so I updated the BIOS to Version 3.20. 2nd step was not required. Then I used the Vista DVD to install the media. And voila, it worked! The last step was kind painful as the document lists 23 software components that need to be downloaded and installed. I talked to the technical support and they said everybody needs to individually download each piece individually and then install them. Why can't Toshiba create a package with all the components that can be downloaded and installed easily ?

Anyway, to save some effort for others, I've provided the list of all the software components after searching for a download link for each of the component:

  1. Alps Pointing Device Driver (driver_touchpad_25333A.exe)
  2. Bluetooth Monitor (util_bluetooth_monitor_25351C.exe)
  3. Bluetooth Stack (driver_bluetooth_25503A.exe)
  4. PCIe Mini Card Driver (driver_wifi_intel_25485B.exe)
  5. Intel Calistoga GM Display Driver (?)
  6. nVidia Display Driver (driver_display_nvidia_25409E.exe)
  7. SigmaTel Audio HD Driver (driver_audio_sigmatel_25410B.exe)
  8. Toshiba Fingerprint Utility (util_fingerprint_25535A.exe)
  9. Toshiba Software Modem (driver_modem_25342E.exe)
  10. CD/DVD Drive Acoustic Silencer (util_drive_silencer_25330E.exe)
  11. Config Free (util_config_free_25573A.exe)
  12. TOSHIBA Assist (util_assist_25533A.exe)
  13. TOSHIBA Disc Creator (util_disc_creator_25489B.exe)
  14. TOSHIBA Extended Tiles for Windows Mobility Center (util_extended_tiles_25331C.exe)
  15. Toshiba HDD Protection (util_hdd_protection_25580A.exe)
  16. TOSHIBA IE Favorites Links
  17. TOSHIBA SD Memory Boot Utility (util_sd_memory_boot_25469C.exe)
  18. TOSHIBA SD Memory Utilities (util_sd_memory_25479B.exe)
  19. TOSHIBA Security Assist (util_security_assist_25329B.exe)
  20. Toshiba Software Upgrades (util_software_upgrades_25157C.exe)
  21. TOSHIBA Value Added Package (util_tvap_25459E.exe)
  22. User's Guide - Unattended Installation
  23. Wireless Key Logon (util_wireless_key_logon_25356D.exe)

This was quite a time consuming process since I had to search for exact match of my laptop's model (Tecra M5 S433) and then copy/paste the link etc. Anyway of the entire list, so far I've installed #9 since that allows me to login to my laptop using biometrics and I love that functionality. May be I'll install others later but I'm good for now.

As I mentioned earlier, this entry is indeed from my laptop with Vista Ultimate now. One good thing with Vista installation is that it preserved all my personal data (which is huge directory space) so there was no need for backing up the laptop. Instead it moved Windows, Program Files and Documents and Settings directories to windows.old. This makes using old data really easy.

So overall, not a bad experience but I spent significant part of my Sunday doing this installation. Hopefully this will save some time for you.

Technorati: toshiba tecram5 windows vista

Sunday Apr 01, 2007

Upgrading Toshiba TecraM5 from XP to Vista

I decided to upgrade my Toshiba Tecra M5 laptop with Windows Vista, finally!

The laptop has the logo "Designed for Windows XP, Windows Vista Capable". A laptop equipped with Windows Vista Capable  meets minimum requirements of 512 MB RAM which does not necessarily mean you'll be able to run all your Windows Vista applications. Rather Vista will deliver sub-XP performance. So I'm not sure how this logo needs to be interpreted.

Anyway, I downloaded Vista and started installing and got the error "Windows cannot be installed on this computer with the current system BIOS version. Contact your computer manufacturer for a BIOS update, install the update, and then start Windows installation again. OEM Name: TOSHIBA; OEM Model: TECRA M5; BIOS Version: v1.60 ; BIOS Date: 20060803000000.000000+000".

Even though the laptop is advertised Vista capable but still need a BIOS update. Why ? where all the BIOS updates can be downloaded was down most of this morning and so no updates could be downloaded. Toshiba Tech Support told me that new drivers are uploaded to the website but I don't understand why the complete website has to be down for that.

I found out about Windows Vista Upgrade Advisor from the recorded message at the Tech Support. So I downloaded that and got the same error "Windows Vista Upgrade Advisor encountered an error while scanning your system. If the problem persist, you can uninstall and reinstall the latest version." I'm using the latest version available on their website so this error message makes no sense.

Finally, is now live and I found instructions on how to Upgrade to Windows Vista for Toshiba Tecra M5. This is exactly what I've been looking for and fortunately this document was posted on 3/28 (3 days ago). I'm going to follow the instructions here and provide an update later today.

I'm hoping my next blog will be from my upgraded Vista laptop but so far the experience has not been very pleasant. Fingers crossed!

Technorati: toshiba tecram5 windows vista


profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.

Java EE 7 Samples

Stay Connected


« July 2016