Arun Gupta, Miles to go ...

Arun Gupta is a technology enthusiast, a passionate runner, and a community guy who works for Sun Microsystems.
« Previous month (Dec 2008) | Main | Next page of month (Jan 2009) »

http://blogs.sun.com/arungupta/date/20090131 Saturday January 31, 2009

Running Kaiser Permanente San Francisco Half Marathon

I'll be running Kaiser Permanente San Francisco 1/2 marathon tomorrow. This is my first time on this course:



Click on the above map to explore!

The course seems slightly confusing because it crosses itself couple of times. But hopefully it's managed nicely to help the runners. The bib and the chip came in via postal mail which saves an additional trip to San Francisco for material pickup, that is nice!

The starting time of 8am, predicted low of 46o F, 30 days of running this month, and running right next to the ocean - will find out if it's an exciting adventure tomorrow ;)

Anybody else running ?

Technorati: running marathon kaiser

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090130 Friday January 30, 2009

TOTD #67: How to front-end a GlassFish Cluster with Apache + mod_jk on Mac OSX Leopard ?

GlassFish provides support for High Availability by creating a cluster of server instances and session state replication. This enhances the scalability and availability of your application and is a critical piece of decision making critieria when selecting an Application Server. Clustering in GlassFish Version 2 provides comprehensive introduction to clustering, high availability and load balancing in GlassFish.

GlassFish provides out-of-the-box support for load-balancing HTTP(S), JMS, and RMI/IIOP traffic and front-ended by Sun Java System Web Server, Apache Web Server, and Microsoft IIS (more details here) using the Load Balancer plug-in. This plug-in however is not available for Mac OS X and a popular technique used on that platform for front-ending is to use Apache httpd + mod_jk. This is exactly what this TOTD (Tip Of The Day) is going to describe.

This TOTD is going to explain how to front-end a 3-instance GlassFish cluster with Apache httpd and mod_jk on Mac OS X.

This blog is using information from the following blogs:

And thanks to Vivek and Shreedhar for helping me understand the guts of GlassFish High Availability.

Without further ado, lets get started. The steps are slightly involving so strap your seatbelts!
  1. First, lets create a 3-instance cluster following the screencast at GlassFish Clustering in under 10 minutes. Use the cluster name as "cluster1" and instance names as "instance1", "instance2", "instance3". The admin console will look like:



    Deploy "clusterjsp" and make sure it works using port hopping as explained in the screencast. Click on each instance to identify their associated HTTP port.
  2. Define "jvmRoute" and "enableJK" properties on the newly created cluster as:

    ~/samples/v2/clustering/glassfish/bin >./asadmin create-jvm-options --target cluster1 "-DjvmRoute=\${AJP_INSTANCE_NAME}"
    Command create-jvm-options executed successfully.
    ~/samples/v2/clustering/glassfish/bin >./asadmin create-jvm-options --target cluster1 "-Dcom.sun.enterprise.web.connector.enableJK=\${AJP_PORT}"
    Command create-jvm-options executed successfully.

    These properties are required to enable "stickiness" for "mod_jk". More details about how these properties are used internally is explained here.
  3. Configure the above system properties for each instance in the cluster as shown:

    ~/samples/v2/clustering/glassfish/bin >./asadmin create-system-properties --target instance1 AJP_INSTANCE_NAME=instance1
    Command create-system-properties executed successfully.
    ~/samples/v2/clustering/glassfish/bin >./asadmin create-system-properties --target instance1 AJP_PORT=9090
    Command create-system-properties executed successfully.
    ~/samples/v2/clustering/glassfish/bin >./asadmin create-system-properties --target instance2 AJP_INSTANCE_NAME=instance2
    Command create-system-properties executed successfully.
    ~/samples/v2/clustering/glassfish/bin >./asadmin create-system-properties --target instance2 AJP_PORT=9091
    Command create-system-properties executed successfully.
    ~/samples/v2/clustering/glassfish/bin >./asadmin create-system-properties --target instance3 AJP_INSTANCE_NAME=instance3
    Command create-system-properties executed successfully.
    ~/samples/v2/clustering/glassfish/bin >./asadmin create-system-properties --target instance3 AJP_PORT=9092
    Command create-system-properties executed successfully.

    Note the value of "AJP_PORT" property for each instance, this will be used for configuring "mod_jk" later. You may have to restart the cluster in order for these properties to be synchronized for each instance. This can be easily done using the admin console as explained in the screencast above.
  4. Install httpd: Mac OS X Leopard 10.5.6 comes bundled with Apache httpd 2.2, so that's cool! Otherwise it can be downloaded from httpd.apache.org. However in the pre-installed version there are some intricacies with directory names that are explained below.
  5. Lets install and configure "mod_jk" in "httpd".
    1. The mod_jk binaries for Mac OSX are supposedly available at www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/macosx/. But installing the available module in httpd gives the following error:

      httpd: Syntax error on line 116 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_jk-1.2.25-httpd-2.2.4.so into server: dlopen(/usr/libexec/apache2/mod_jk-1.2.25-httpd-2.2.4.so, 10): no suitable image found.  Did find:\n\t/usr/libexec/apache2/mod_jk-1.2.25-httpd-2.2.4.so: mach-o, but wrong architecture
    2. The alternative is to build "mod_jk". Fortunately it turned out to be a straight forward process because of this blog.
      1. Download latest Connectors source code (version 1.2.27). The file "BUILD.txt" (included in the source bundle) provide clear instructions to build and described below as well.
      2. Configure the build environment as shown:

        ~/workspaces/tomcat-connectors-1.2.27-src/native >./configure --with-apxs=/usr/sbin/apxs

        It shows the output as:

        . . .
        checking for target platform... unix
        no apache given
        no netscape given
        configure: creating ./config.status
        config.status: creating Makefile
        config.status: creating apache-1.3/Makefile
        config.status: creating apache-1.3/Makefile.apxs
        config.status: creating apache-2.0/Makefile
        config.status: creating apache-2.0/Makefile.apxs
        config.status: creating common/Makefile
        config.status: creating common/list.mk
        config.status: creating common/jk_types.h
        config.status: creating jni/Makefile
        config.status: creating common/portable.h
        config.status: executing depfiles commands
      3. Edit Edit "native/apache-2.0/Makefile.apxs" and add "-arch x86_64" as described here. Please note that this string needs to be specified twice.
      4. Invoke "make" and "mod_jk.so" is generated in "native/apache-2.0" directory.
    3. Copy the generated "mod_jk.so" as:

      ~/workspaces/tomcat-connectors-1.2.27-src/native/apache-2.0 >sudo cp mod_jk.so /usr/libexec/apache2/
    4. Load the "mod_jk" module in httpd by editing "/etc/apache2/httpd.conf". Please note another similar file exists in "/etc/httpd/httpd.conf" but ignore that one. Add the following as the last "LoadModule" line:

      LoadModule jk_module     libexec/apache2/mod_jk-1.2.25-httpd-2.2.4.so
    5. Configure "mod_jk" by adding the following lines immediately below the previously "LoadModule" line:

      JkWorkersFile /etc/apache2/worker.properties
      # Where to put jk logs
      JkLogFile /var/log/httpd/mod_jk.log
      # Set the jk log level [debug/error/info]
      JkLogLevel debug
      # Select the log format
      JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
      # JkRequestLogFormat set the request format
      JkRequestLogFormat "%w %V %T"
      # Send all jsp requests to GlassFish
      JkMount /*.jsp loadbalancer

      The key lines in this configuration are the first and the last one. The first line informs "mod_jk" about the location of "worker.properties" file (explained later). The last line instructs to redirect only JSP requests. This will allow the static content such as images, text files, and media to be served from "httpd" itself.

      Also create the log directory specified in the configuration as:

      sudo mkdir /var/log/httpd
    6. Create a new file "/etc/apache2/worker.properties". Again, this is not in "/etc/httpd" directory. Use the following contents:

      # Define 1 real worker using ajp13
      worker.list=loadbalancer
      # Set properties for instance1
      worker.instance1.type=ajp13
      worker.instance1.host=localhost
      worker.instance1.port=9090
      worker.instance1.lbfactor=50
      worker.instance1.cachesize=10
      worker.instance1.cache_timeout=600
      worker.instance1.socket_keepalive=1
      worker.instance1.socket_timeout=300
      # Set properties for instance2
      worker.instance2.type=ajp13
      worker.instance2.host=localhost
      worker.instance2.port=9091
      worker.instance2.lbfactor=50
      worker.instance2.cachesize=10
      worker.instance2.cache_timeout=600
      worker.instance2.socket_keepalive=1
      worker.instance2.socket_timeout=300
      # Set properties for instance3
      worker.instance3.type=ajp13
      worker.instance3.host=localhost
      worker.instance3.port=9092
      worker.instance3.lbfactor=50
      worker.instance3.cachesize=10
      worker.instance3.cache_timeout=600
      worker.instance3.socket_keepalive=1
      worker.instance3.socket_timeout=300

      worker.loadbalancer.type=lb
      worker.loadbalancer.balance_workers=instance1,instance2,instance3

      Read more about worker.properties format. Essentially this file is used to load-balance a 3-instance cluster and specify configuration values for each instance. Note that the value of "worker.instanceX.port" for instance X is exactly same as specified during instance configuration earlier.
  6. Copy "tomcat-ajp.jar" from the "lib" directory of the latest Tomcat 5.5.xcommons-logging.jar (version 1.1.1), and commons-modeler.jar (version 2.0.1) to GLASSFISH_HOME/lib. This is done as:

    ~/samples/v2/clustering/glassfish/lib >cp ~/tools/apache-tomcat-5.5.27/server/lib/tomcat-ajp.jar .
    ~/samples/v2/clustering/glassfish/lib >cp ~/Downloads/commons-logging-1.1.1/commons-logging-1.1.1.jar .
    ~/samples/v2/clustering/glassfish/lib >cp ~/tools/commons-modeler-2.0.1/commons-modeler-2.0.1.jar .

    You may have to restart cluster in order for these JARs to be loaded by each instance.
  7. An "httpd" instance is already running on port# 80 in my particular instance of Mac OS X. Instead of mangling with that, I decided to change the listening port for the new instance that will be spawn for out front-end. This can be easily done by editing "/etc/apache2/httpd.conf" and looking for lines similar to:

    #Listen 12.34.56.78:80
    Listen 80

    And change "Listen 80" to "Listen 81".
That completes the configuration, phew!

Lets start "httpd" as:

sudo httpd

The "httpd" logs are available in "/private/var/log/apache2". The following message indicates a successful start of the web server:

. . .
[Thu Jan 29 11:14:16 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Thu Jan 29 11:14:16 2009] [warn] No JkShmFile defined in httpd.conf. Using default /usr/logs/jk-run
time-status
[Thu Jan 29 11:14:16 2009] [warn] No JkShmFile defined in httpd.conf. Using default /usr/logs/jk-run
time-status
[Thu Jan 29 11:14:16 2009] [notice] Digest: generating secret for digest authentication ...
[Thu Jan 29 11:14:16 2009] [notice] Digest: done
[Thu Jan 29 11:14:16 2009] [warn] pid file /private/var/run/httpd.pid overwritten -- Unclean shutdow
n of previous Apache run?
[Thu Jan 29 11:14:16 2009] [notice] Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7l DAV/2 mod_jk/1.
2.27 configured -- resuming normal operations

OK, now show time!

If everything has been configured properly as described above then "http://localhost:81/clusterjsp/HaJsp.jsp" looks like:



Enter session attribute as "aaa" and value of the attribute as "111". After you click on "ADD SESSION DATA" button, the updated page looks like:



The highlighted part shows that the request is served from "instance1" and recently added session data. Lets stop "instance1" and see if the promise of high availability is fulfilled :)

Click on "Instances" tab, select "instance1" and click "Stop". The admin console looks like:



Notice "instance1" is shown as stopped. Clicking on "Reload Page" on "http://localhost:81/clusterjsp/HaJsp.jsp" shows:




Aha!

Even though "instance1" is not runing the session data is still available. And that is possible because of the seamless session failover from primary ("instance1") to the replica partner ("instance2"). The highlighted part indicates that the request is now indeed served by "instance2".

Here are some other useful links to consider:
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 loadbalancer mod_jk apache httpd mac leopard

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090129 Thursday January 29, 2009

"Sparks of passion" in the "world of Open Source" - Archana N contributes to GlassFish Documentation


Interested in contributing to open source ? Archana N has a recommendation for you:

Flame the sparks of passion in you,
Experience the world of Open Source anew.
Discover your potentials as they unfold,
Venture to contribute in the technologies untold.

Archana N is an ex-Sun Campus Ambassador from Amrita Vishwa Vidyapeetham, India. Recently she contributed on how to secure the existing EJB converter example from the Java EE tutorial using mutual authentication. She continue to work on developing RESTful web services using Project Jersey as her next contribution for GlassFish documentation.

The GlassFish Documentation team published her interview to recognize the efforts, read it here.

Thank you Archana for your contribution to GlassFish, keep the passion alive!

If you are interested in learning/talking about GlassFish at your university, spotlight.dev.java.net/start provides a comprehensive set of slides (with speaker notes), demos, screencasts, training materials and other resources to get you started!

Technorati: glassfish students campusambassador spotlight

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090128 Wednesday January 28, 2009

Free GlassFish Webinar for Students at OSUM


Are you a student and would like to learn why GlassFish is meant for you ?



Create/join a student community at osum.sun.com and attend the GlassFish Webinar. This webinar will introduce GlassFish application server, show multiple demos that can be used to impress your colleagues/professors, and answer your questions around GlassFish.

The coordinates are:

Feb 3, 2009, 8:30am PT
Webinar Invite

This webinar will be conducted using Elluminate Live! You will be able to listen to live audio via your computer speakers or ear phones and be able to ask questions using chat/text.

Learn more about OSUM (pronounced "awesome") here. Create your OSUM today and join over 900 student clubs from over 80 countries!

If you are interested in talking about GlassFish, spotlight.dev.java.net/start provides a comprehensive set of slides (with speaker notes), demos, screencasts, training materials and other resources to get you started!

Technorati: glassfish webinar osum students spotlight

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090127 Tuesday January 27, 2009

GlassFish in CEUI and Campus Party

As reported earlier, Alan Vargas, the Sun Campus Ambassador at CEUI (Centro Universitario de Ixltahuaca) presented on GlassFish. The message of "GlassFish v2 - Fast, Easy, and Reliable" and "GlassFish v3 - Modular, Embeddable, and Extensible" was clearly delivered in the talk.

Alan has published several useful blogs on GlassFish (in Spanish and English) recently:

The slides from his talk are available here. Here are some pictures from the talk:


The complete album is available here. Thanks to Alan Vargas for delivering a GlassFish talk!

Ronaldo Pass talked about GlassFish at the recently concluded Campus Party Brazil 2009. This is claimed to be biggest party of the Internet world in Brazil :) An attendance of over 6655, sort of, vouch for that! More details on Campus Party in the wikipedia entry.


There is a Campus Party community at OSUM, join here. Enjoy the images posted by the community on Flickr and videos @ YouTube.

Thanks to Ronaldo Pass for spreading the GlassFish wealth!

Please drop a comment on this blog if you have talked about GlassFish in your school/university/training. If you'd like to talk about it then spotlight.dev.java.net/start provides a comprehensive list of material (slides, demos, etc.) to get you started!

Technorati: glassfish students spotlight brazil mexico

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090126 Monday January 26, 2009

Developing GlassFish- and MySQL-Backed Applications with Netbeans and JRuby-on-Rails - Free Webinar on Jan 27

Would you like to know how JRuby, NetBeans, GlassFish, and MySQL can power your Rails applications ?



This informative technical webinar explains the fundamentals of JRuby and how the NetBeans IDE makes developing/debugging/deploying Rails applications on GlassFish quick, fun and cost-effective.

The webinar starts 10am PT on Jan 27th, 2009 and can be accessed from a browser.

Register here.

Don't miss out, it's going to start in less than 12 hours!

Technorati: jruby rubyonrails glassfish netbeans mysql webinar

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090123 Friday January 23, 2009

GlassFish @ University of Ixtlahuaca, Mexico - Coming Up on Jan 26!


Learn about GlassFish at Centro Universitario de Ixtlahuaca OSUM!

Date: Jan 26, 2009
Time: 10am-12pm PT
Language: Spanish
Sign up here!

Read more about OSUMs here.

Please drop a comment on this blog if you have talked about GlassFish in your school/university/training. If you'd like to talk about it then spotlight.dev.java.net/start provides a comprehensive list of material (slides, demos, etc.) to get you started!

Technorati: glassfish students spotlight

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

Singapore Tech Days 2009 - Wrapup

A picture is worth thousand words! Now that Picasa 3.0 is available on Mac, here is a collage of pictures from the recently concluded Sun Tech Days in Singapore.





The complete photo album is available at:




And if you are interested in knowing all the action, read here!

Technorati: conf suntechdays singapore

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090121 Wednesday January 21, 2009

Singapore Tech Days 2009 - Talent Show, Cloud Camp, GlassFish Demo

Follow up from Day 1.

Matt Thompson talked about cloud computing. Even though the term "cloud computing" is becoming more prominent now, it very well echoes Sun's 25 years old mantra - "The Network is the Computer". Even though there are some prominent players but the field is very much emerging. Matt touched upon different interpretations of a cloud - Platform, Infrastructure or Software as a Service (PaaS, Iaas, SaaS). A set of developer tools that allows you to manage your cloud is equally important for it to be successful. He then gave a preview of some of the open source developer tools (Kenai and Zembly) available from Sun Microsystems to assist in that direction.

After the keynote, some participants showed their "strange and unusual" talent to add a bit of levity to the otherwise intense technical conference. Even though there were 6 participants but it was less "strange and unusal" than the previous ones I've attended (Sao Paolo 2008, Hyderabad 2008, Beijing 2007). Here is a video of the show and judget it yourself:



A video of the GlassFish demo shown during Day 1 is now available:


The cloud camp in the evening had approx 50 attendees with an interesting discussion around the definition of cloud, security concerns, portability of applications across clouds, major players in the game, and much more. Free pizza and beer is always a good way to keep audience engaged until late in the night ;-) Sign up for a cloud camp near your city!

Here are some pictures from Day 2:


University Day today!

And finally the complete photo album in Singapore so far:




Follow the latest updates on twitter.com/arungupta.

Technorati: conf suntechdays singapore glassfish cloudcamp

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

Running by the Singapore River


Had a great 44 minutes run by the Singapore River in downtown Singapore.



There were underpasses for all the streets so that made it really comfortable. The hotel desk even had a running band with 2K, 6K, and 10K routes - really neat! I anyway deviated and ran along the river which was fun.

21 days of running so far this year - 100% in 2009 :)

Check out pictures of the Singapore trip so far:



Technorati: conf singapore river running

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090120 Tuesday January 20, 2009

Fish pedicure by Doctor Fish

Doctor Fish (aka "Garra rufa", Kangal fish, Nibble fish) is a freshwater fish fish that originates from Turkey, Syria, Iraq, and Iran. They consume the dead and affected areas of your skin and also help in curing skin diseases and disorders. Now attending Singapore Tech Days 2009, some of us got "fish pedicure" done outside the Singapore Night Safari park.

Here are couple of pictures:


And then a video of us getting fish therapy:


Don't worry, its not creepy! Instead it's more ticklish and I can still feel that sensation, even 12 hours later :)

And here is another one:



Thanks Maria for the video!

In these economic times, if you are suffering by the expensive, commercial, and properietary vendor offerings of Application Server - let GlassFish and other open source offerings from Sun cure you :)

Here is the complete photo album in Singapore so far:




Follow the latest updates on twitter.com/arungupta.

Technorati: conf suntechdays singapore fish drfish glassfish

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

Sun Tech Days 2009, Singapore - Welcome Reception

Follow up from Part 1.

Attended "What Developers should care about MySQL ?" by Colin and "Groovy and Grails" by Chuk-munn Lee.

I enjoyed both the talks for different reasons. Colin's talk explained the pluggable storage engine architecture that is unique to MySQL (pronounced my-ess-kew-ell, not my-sequel). It was interesting to know that the different storage engines can be picked a la carte based upon the requirements. The performance comparison for INSERTs was 5x between MyISAM, InnoDB and Archive storage engines. But then InnoDB provide transactions and other goodies. Multiple performance tuning tips such as using negative unsigned int instead of BIGINT and partitioning databases if the number of records grow more than 1 billion were good! Keep an eye on his blog for slides.

Chuk's talk introduced Groovy, Grails, showed several samples of NetBeans and Grails integration. A Grails application can be deployed as a WAR file on GlassFish. Alternatively you can download the Grails module from GlassFish v3 Update Center and use the standard "run-app" command to run your Grails application using the embedded GlassFish v3 instead of Jetty. This is explained nicely in the screencast below:


Here are couple of pictures from rest of the day:




The welcome reception gave a good chance to engage with the audience. There was a community-driven musical performance and I made a video recording of the event. But because of the slow Internet connection, it's taking forever to load this particular video (may be it's Picasa 3 on Mac ;-)



If you have not signed up for Cloud Camp event happening in Singapore at 6pm today, register here!

Here is the complete photo album so far:




Follow the latest updates on twitter.com/arungupta.

Technorati: conf suntechdays singapore glassfish mysql netbeans

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

Sun Tech Days 2009, Singapore - Day 1

The Sun Tech Days Singapore started earlier this morning - over 1100 developers, an outstanding audience!!!

The kick off had a good local flare when the Gods of Longevity, Fortune, and Prosperity (Fu Lu Shou) showed up to start the event ;-) The build up to their appearance was really exciting as evident from the video below:


This particular event will also be recorded in Singapore Book of Records for the largest numbers of Sun developers playing a rattle together :) Here are some pictures from the event:


A Toshiba laptop and an iPod was raffled to the audience and the lucky winners are:


And found another loyal reader of my blog:



Gosh, he even took my autograph ;-)

The steps to reproduce the different GlassFish demos shown during the key note are explained below.
  1. GlassFish v3 OSGi-compliance and quick startup time

    Download GlassFish v3 Prelude from here, unzip, and start the server as

    glassfish/bin/asadmin start-domain --verbose

    to see a message something like:

    INFO: GlassFish v3 Prelude startup time : Felix(1732ms) startup services(1091ms) total(2823ms)

    The GlassFish v3 container starts up fairly quickly, 2.8 secs in this case, without starting any application-specific container. The container is using OSGi R4 APIs and Apache Felix as the runtime. This allows any standard OSGi bundle to be easily deployed in GlassFish v3. The underlying OSGi runtime can be easily replaced with Knopflerfish or Equinox because standard R4 APIs are used. As you notice, Felix start up time is explicitly shown in the startup message.

    The quick start up is possible because containers, such as Web container that serves web applications, is started only when the first Web application is deployed. No web application, no web container - simple! The same is true as other types of applications are deployed, for example a Rails application. The containers are started and stopped on demand giving a higher utilization of resources.
  2. Auto-deploy of Servlets and preserving servlet session state across multiple re-deploys using NetBeans and Eclipse. This feature is really useful as it tremendously reduces your development time. Focus on what you are good at i.e. adding business logic and let NetBeans and GlassFish together take care of your deployment worries. And why should you loose your session state just because the application is re-deployed!
  3. Modularity and Extensibility of GlassFish v3 by running/debugging a Rails application. GlassFish certainly supports traditional Java EE applications. But starting with GlassFish v3 the newer Web frameworks like Rails can also be deployed natively. The screencast #26 shows how to develop, run and debug a Rails application natively deployed on GlassFish. And this capability of deploying a Rails application is added as an OSGi module and also demonstrates the extensibility of GlassFish.

    It provides future protection as well because any other Web framework can be easily deployed as a standard OSGi module.
  4. Extensibility of GlassFish v3 by dropping a JAR in the "/modules" directory. The admin console is a one-stop interface for the administration of your GlassFish instance such as deploying WAR/EAR, creating JDBC/JMS resource, and creating clusters. Starting with GlassFish v3, even the admin console is extensible. There are clearly defined extension points that allows you to write a "admin console module" and extend the capability of your admin console. The demo showed dropping a JAR in the standard "modules" directory and admin cosole recognizing the module. A sample project that shows all the integration points to GlassFish v3 Admin Console is available here.
Other demos showcased JavaFX, Open Solaris and jMaki Webtop technology. I particularly enjoyed the JavaFX demo by our "resident mad scientist" - Simon Ritter :) It was an interesting use of technology to create something fun. Enjoy the demo below:



Also met Colin Charles, Community Relations Manager for MySQL at Sun Microsystems. It was certainly great to know that similar thought process is applied for promoting both GlassFish and MySQL - state the facts, offer an alternative, and let the customers decide. Both MySQL and GlassFish are open source offerings with complete enterprise support available from Sun Microsystems. And together with OpenSolaris, NetBeans and many other open source offerings they make a killer platform for developing/deploying any kind of web applications.

And if you have not signed up for Cloud Camp event happening in Singapore tomorrow at 6pm, register here!

Here is the complete photo album so far:




Follow the latest updates on twitter.com/arungupta.

Technorati: conf suntechdays singapore glassfish mysql javafx netbeans

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090119 Monday January 19, 2009

EJBs in a WAR - Simplified packaging defined by EJB 3.1, Available in GlassFish v3


The EJB 3.1 specification says:

An enterprise bean class with a component-defining annotation defines an enterprise bean component when packaged within the WEB-INF/classes directory or in a .jar file within WEB-INF/lib.

In simple English it means, an EJB can be a POJO annotated with EJB annotations (such as @javax.ejb.Stateless) and bundled within WEB-INF/classes inside a WAR.

This feature is available in GlassFish v3 for some time now.

Imagine the ramifications, you now have Container Managed Persistence, Transacations, Security, and all other standard benefits of EJB - only this time in a WAR file.

The default configuration of GlassFish v3 Prelude does not include an EJB container. Lets first install it!

The EJB container in GlassFish v3 Prelude can be installed in couple of ways:

  • Using Update Center as described here.
  • Or using the "pkg" command which is described below
The "pkg" command shipped with GlassFish is platform-independent and runs on all the supported platforms. You can use the standard "pkg-get" command with OpenSolaris but that requires more options to be specified. For simplicity, we'll use the "pkg" command bundled with GlassFish as shown below:

arun@opensolaris:~/glassfishv3-prelude/bin$ ./pkg

The software needed for this command (pkg) is not installed.

When this tool interacts with package repositories, some system information
such as your system's IP address and operating system type and version
is sent to the repository server. For more information please see:

http://wiki.updatecenter.java.net/Wiki.jsp?page=UsageMetricsUC2

Once installation is complete you may re-run this command.

Would you like to install this software now (y/n): y

Install image: /export/home/arun/glassfishv3-prelude/bin/..
Installing pkg packages.
Installing: [pkg:/pkg@1.0.7,0-15.1269:20081008T211255Z,
pkg:/python2.4-minimal@2.4.4.0,0-15.1269:20081008T211307Z]
Initialization complete.

Software successfully installed. You may now re-run this command (pkg).

Install the EJB container as:

arun@opensolaris:~/glassfishv3-prelude/bin$ ./pkg install glassfish-ejb
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    1/1       11/11     0.45/0.45
PHASE                                        ACTIONS
Install Phase                                  24/24

And verify as ...

arun@opensolaris:~/glassfishv3-prelude/bin$ ./pkg list
NAME (AUTHORITY)                              VERSION         STATE      UFIX
felix                                         1.2.2-0         installed  ----
glassfish-amx                                 3.0-28.3        installed  ----
glassfish-api                                 3.0-28.3        installed  ----
glassfish-common                              3.0-28.3        installed  ----
glassfish-ejb                                 3.0-28.3        installed  ----
glassfish-grizzly                             1.8.6.2-0       installed  ----
glassfish-gui                                 3.0-28.3        installed  ----
glassfish-hk2                                 3.0-28.3        installed  ----
glassfish-jca                                 3.0-28.3        installed  ----
glassfish-jdbc                                3.0-28.3        installed  ----
glassfish-jdbc-gui                            3.0-28.3        installed  ----
glassfish-jdbc-management                     3.0-28.3        installed  ----
glassfish-jpa                                 3.0-28.3        installed  ----
glassfish-jsf                                 1.2.10-1        installed  u---
glassfish-jta                                 3.0-28.3        installed  ----
glassfish-management                          3.0-28.3        installed  ----
glassfish-nucleus                             3.0-28.3        installed  ----
glassfish-registration                        3.0-28.3        installed  ----
glassfish-scripting                           3.0-28.3        installed  ----
glassfish-web                                 3.0-28.3        installed  ----
glassfish-web-gui                             3.0-28.3        installed  ----
glassfish-web-management                      3.0-28.3        installed  ----
javadb                                        10.2.2.1-0      installed  ----
pkg                                           1.0.7-15.1269   installed  ----
pkg-java                                      1.0.7-15.1269   installed  ----
python2.4-minimal                             2.4.4.0-15.1269 installed  ----

As shown above, "glassfish-ejb" module with version "3.0.28.3" is now installed.

Now your GlassFish v3 Prelude is ready to serve EJBs!

Next, lets create a simple web application and package EJB there. Using the NetBeans IDE, create a template Web application. Lets say the project is named "ReallySimpleEJB".

  1. Create a POJO, choose the class name as "HelloEJB" and package as "server" as shown


  2. Declare a public method "sayHello" and add @javax.ejb.Stateless annotation to mark it a stateless EJB as shown

  3. Create a new Servlet by selecting the option as shown



    and specify the name as "EJBClient" in "client" package



    and click on "Finish".
  4. In the generated Servlet, declare a dependency on the EJB using @javax.ejb.EJB as shown

  5. Invoke the EJB by uncommenting the code in "processRequest" method and add "ejbClient.sayHell("Duke")" invocation as shown:



If the application is pre-deployed then saving this file will auto-deploy it as shown in screencast #27. Otherwise right-click on the project and select "Deploy".

And finally invoking the servlet at "http://localhost:8080/ReallySimpleEJB/EJBClient" shows the following output:



EJBs in a WAR - simple and easy to use :)

Download GlassFish v3 Prelude and get started!

Technorati: glassfish v3 ejb netbeans war ear

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20090118 Sunday January 18, 2009

OSUM - Open Source University Meetup - awesome venue for students!




If your university is not participating in the Sun Campus Ambassador program, you can always create an Open Source University Meetup (OSUM, pronounced "awesome") community. Sun Microsystems offers you the complete range of Open Source software - OpenSolaris, OpenOffice, NetBeans, GlassFish, MySQL, and many others.

OSUM provides an opportunity to create a student club and:

    * LEARN about Open Source Technologies and how they are opening up new career opportunities for students
    * ACCESS free online web courses, webinars, tutorials and other resources to prepare for career enhancing certifications
    * SHARE your technical knowledge with other students around the world virtually and on campus
    * COLLABORATE with a global community of students via forum, campus events, webinars, etc.
    * CONNECT and make friends with students around the world who are committed to Open Source just like you!

Create your OSUM today and join over 900 student clubs from over 80 countries!

If you are interested in talking about GlassFish, spotlight.dev.java.net/start provides a comprehensive set of slides (with speaker notes), demos, screencasts, training materials and other resources to get you started!

Technorati: glassfish students spotlight osum campusambassador

del.icio.us | furl | simpy | slashdot | technorati | digg |
|
« Previous month (Dec 2008) | Main | Next page of month (Jan 2009) »

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.