Miles to go …

April 15, 2008

jMaki Webtop on GlassFish – Ajax World Keynote Video

Filed under: web2.0 — arungupta @ 12:02 am

jMaki Webtop is a light-weight Mashup Framework based on jMaki widgets. The webtop was demonstrated at Ajax World East 2008 keynote. The key features are:

  • Simple & easy to use (runs in browser)
  • Extensible (add your own widgets & gadgets)
  • Manageable (create users)
  • Persistent (Google Gears on the client, Database on the server)
  • Shared (read-only views can be shared with other users)

A 30-minute video of the Ajax World keynote session is available here and shows webtop in action :) The keynote deployed the webtop as a WAR file on GlassFish. A live PHP version of webtop is available at jmaki.com/webtop.

You can download the entire source code from the subversion repository and run it yourself.

Technorati: conf ajaxworld newyork glassfish jmaki

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 14, 2008

GlassFish @ Silicon Valley Web Developer JUG – Tomorrow (Apr 15, 2008)

Filed under: General — arungupta @ 9:54 am


Project GlassFish: On a mission to please Developers is the topic of talk at Silicon Valley Web Developer JUG tomorrow (Apr 15, 2008).

Hear all about GlassFish v2, it’s exciting set of features such as Metro, High Availability, Clustering, Grizzly, Scripting, SIP container, Tools integration (such as NetBeans and Eclipse) and many others that together deliver a compact and high-fidelity Java EE Application server. You’ll also learn about GlassFish v3 and how, through modularization and embedability, it enables support for non-Java EE containers such as Rails, Phobos and others.

Read more details about agenda and food here. The food is served @ 6:30 and is consumed quickly ;)

Register here to be part of give-away drawing (advanced registration required) otherwise just show up @ 6:30pm!

Technorati: conf glassfish v3 svjug webjug

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

Rails and Java EE integration – Native Rails on GlassFish v3

Filed under: web2.0 — arungupta @ 12:02 am

The last part of this tri-series blog (Part 1, Part 2) will show how a Rails application can be deployed on GlassFish – without the need of Goldspike, Warbler or any other gem or plugin. Yes, that’s a native Rails app deployment on GlassFish v3.

GlassFish v3 is next version of GlassFish v2 and the focus is modularization, enablement of non-Java EE containers and modularity – download b09.

Rails powered by GlassFish provides all the details on why GlassFish provides an industry-grade and functionally-rich Application Server.

Now detailed steps:

  1. Using JRuby 1.1 (installed with Rails), create a Rails app “railsee3″ as:

    ~/testbed/jruby-1.1/samples/rails >../../bin/jruby -S rails railsee3
          create 
          create  app/controllers
          create  app/helpers
          create  app/models
          . . .
          create  log/production.log
          create  log/development.log
          create  log/test.log
  2. Add Servlet descriptors
    1. Create a new directory “WEB-INF”, and a new file “web.xml” in that directory using the following contents:

      <!DOCTYPE web-app PUBLIC
        “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN”
        “http://java.sun.com/dtd/web-app_2_3.dtd”>
      <web-app>
              <servlet>
                      <servlet-name>HelloServlet</servlet-name>
                      <servlet-class>server.HelloServlet</servlet-class>
              </servlet>
              <servlet-mapping>
                      <servlet-name>HelloServlet</servlet-name>
                      <url-pattern>/hello</url-pattern>
              </servlet-mapping>
      </web-app>
    2. Create a new file “sun-web.xml” in “WEB-INF” using the following contents:
      <?xml version=”1.0″ encoding=”UTF-8″?>
      <!DOCTYPE sun-web-app PUBLIC “-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN” “http://www.sun.com/software
      /appserver/dtds/sun-web-app_2_5-0.dtd”>
      <sun-web-app error-url=”">
        <context-root>/servlet</context-root>
        <class-loader delegate=”true”/>
      </sun-web-app>
    3. Create a new directory “WEB-INF/lib”.
  3. Create and Copy Servlet
    1. Create a Java library with Servlet code as explained in bullet #5 here.
    2. Copy “HelloServlet.jar” from “dist” directory of NetBeans project to “WEB-INF/lib” directory.
  4. Configure JRuby-on-Rails in GlassFish – Edit “config/asenv.conf” in GlassFish directory and specify JRUBY_HOME as the last line:
    JRUBY_HOME=”/Users/arungupta/testbed/jruby-1.1″

  5. Deploy the Rails application as:

  6. ~/testbed/jruby-1.1/samples/rails >~/testbed/glassfish/v3/p2b9/glassfish/bin/asadmin deploy –force=true railsee3
    railsee3 deployed successfully
    Command deploy executed successfully.
  7. The bundled Servlet is now accessible at “http://localhost:8080/servlet/hello”. The default browser output looks like:

    And passing a parameter to the URL as “http://localhost:8080/railsee3/hello?name=Arun” shows the output as:

With this, your Java EE Servlet is now bundled with your Rails application deployed on GlassFish v3.

Now, lets add Controller and View to Rails application and invoke this servlet from there to show complete integration with Rails.

  1. Create a new Controller and View as

    ~/testbed/jruby-1.1/samples/rails/railsee3 >../../../bin/jruby script/generate controller home index
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
          exists  app/controllers/
          exists  app/helpers/
          create  app/views/home
          exists  test/functional/
          create  app/controllers/home_controller.rb
          create  test/functional/home_controller_test.rb
          create  app/helpers/home_helper.rb
          create  app/views/home/index.html.erb
  2. Change the generated controller in “app/controllers/home_controller.rb” to:
    class HomeController < ApplicationController

    include Java

      def index
            url = java.net.URL.new(“http://localhost:8080/servlet/hello”);
            conn = url.open_connection;
       &
    nbsp;    reader = java.io.BufferedReader.new(java.io.InputStreamReader.new(conn.get_input_stream));
            @servlet_output = “”;
            input_line = reader.read_line;
            while input_line != nil
                    @servlet_output << input_line;
                    input_line = reader.read_line;
            end
            reader.close;
      end
    end

  3. Change the generated view in “app/views/home/index.rhtml.erb” to:
    <h1>Home#index</h1>
    <p>Find me in app/views/home/index.html.erb</p>

    <%= @servlet_output %>

  4. Re-deploy the Rails application as shown in bullet # 5 above and “http://localhost:8080/railsee3/home/index” shows the output as shown:

So this blog explained how a Rails application can be deployed on GlassFish v3 without the need of any gems like Warbler or plugin like Goldspike – total native deployment!

In summary, the tri-part blog showed the deployment models for a Rails application on GlassFish. Each model showed how a Java EE 5 Servlet can be co-bundled with Rails application and invoked from Rails view:

Technorati: rubyonrails netbeans glassfish v3 javaee5 servlets jruby ruby warbler

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 11, 2008

Getting Started with Grails on GlassFish

Filed under: web2.0 — arungupta @ 12:02 am

This blog has published good amount of content on how Ruby-on-Rails applications can be deployed on GlassFish. Grails is another popular MVC-based framework that leverages the Groovy language. Basically, Grails : Groovy :: Rails : Ruby.

Starting today, I plan to start publishing content on Grails and talk about how GlassFish v3 is turning out to be a home for several scripting languages – Ruby/JRuby/Rails, JavaScript/Phobos, Groovy/Grails and more to be added.

This blog shows how to get started with Grails and deploy a simple application on GlassFish v3. Lets go!

  1. Download Grails 1.0.2 (docs, release notes, other builds) and unzip.

    ~/testbed/grails-1.0.2 >export GRAILS_HOME=`pwd`
    ~/testbed/grails-1.0.2 >export PATH=$GRAILS_HOME/bin:$PATH

    On MacOS 10.5, I had to manually set the executable permissions using “chmod +x grails” and then saw the following:

    ~/testbed/grails-1.0.2 >grails

    Welcome to Grails 1.0.2 – http://grails.org/
    Licensed under Apache Standard License 2.0
    Grails home is set to: /Users/arungupta/testbed/grails-1.0.2

    No script name specified. Use ‘grails help’ for more info

  2. Create & Deploy a Grails HelloWorld:
    1. Create a Grails app “helloworld” as:

      ~/testbed/grails-1.0.2/samples >grails create-app helloworld

      Welcome to Grails 1.0.2 – http://grails.org/
      Licensed under Apache Standard License 2.0
      Grails home is set to: /Users/arungupta/testbed/grails-1.0.2

      Base Directory: /Users/arungupta/testbed/grails-1.0.2/samples
      Note: No plugin scripts found
      Running script /Users/arungupta/testbed/grails-1.0.2/scripts/CreateApp.groovy
      Environment set to development
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/src
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/src/java
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/src/groovy
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/controllers
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/services
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/domain
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/taglib
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/utils
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/views
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/views/layouts
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/i18n
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/conf
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/test
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/test/unit
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/test/integration
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/scripts
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/web-app
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/web-app/js
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/web-app/css
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/web-app/images
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/web-app/META-INF
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/lib
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/conf/spring
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/conf/hibernate
      [propertyfile] Creating new property file: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/application.properties
           [copy] Copying 2 files to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld
           [copy] Copying 2 files to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/web-app/WEB-INF
           [copy] Copying 5 files to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/web-app/WEB-INF/tld
           [copy] Copying 87 files to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/web-app
           [copy] Copying 17 files to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app
           [copy] Copying 1 file to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld
           [copy] Copying 1 file to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld
           [copy] Copying 1 file to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld
      [propertyfile] Updating property file: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/application.properties
      Created Grails Application at /Users/arungupta/testbed/grails-1.0.2/samples/helloworld

      The top-level directory structure is:

      total 56
      drwxr-xr-x  14 arungupta  arungupta   476 Apr 10 10:44 .
      drwxr-xr-x   3 arungupta  arungupta   102 Apr 10 10:44 ..
      -rw-r–r–   1 arungupta  arungupta  5911 Apr 10 10:44 .classpath
      -rw-r–r–   1 arungupta  arungupta   553 Apr 10 10:44 .project
      -rw-r–r–   1 arungupta  arungupta   115 Apr 10 10:44 application.properties
      -rw-r–r–   1 arungupta&nb
      sp; arungupta  1464 Apr 10 10:44 build.xml
      drwxr-xr-x  10 arungupta  arungupta   340 Apr 10 10:44 grails-app
      -rw-r–r–   1 arungupta  arungupta  1805 Apr 10 10:44 helloworld.launch
      -rw-r–r–   1 arungupta  arungupta  2287 Apr 10 10:44 helloworld.tmproj
      drwxr-xr-x   2 arungupta  arungupta    68 Apr 10 10:44 lib
      drwxr-xr-x   2 arungupta  arungupta    68 Apr 10 10:44 scripts
      drwxr-xr-x   4 arungupta  arungupta   136 Apr 10 10:44 src
      drwxr-xr-x   4 arungupta  arungupta   136 Apr 10 10:44 test
      drwxr-xr-x   8 arungupta  arungupta   272 Apr 10 10:44 web-app

      This directory is created using Convention over Configuation and the purpose of each directory is explained here.

    2. The app can be started as:
      ~/testbed/grails-1.0.2/samples/helloworld >grails run-app

      Welcome to Grails 1.0.2 – http://grails.org/
      Licensed under Apache Standard License 2.0
      Grails home is set to: /Users/arungupta/testbed/grails-1.0.2

      Base Directory: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld
      Note: No plugin scripts found
      Running script /Users/arungupta/testbed/grails-1.0.2/scripts/RunApp.groovy
      Environment set to development
          [mkdir] Created dir: /Users/arungupta/.grails/1.0.2/projects/helloworld/classes
        [groovyc] Compiling 6 source files to /Users/arungupta/.grails/1.0.2/projects/helloworld/classes
          [mkdir] Created dir: /Users/arungupta/.grails/1.0.2/projects/helloworld/resources/grails-app/i18n
      [native2ascii] Converting 10 files from /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/i18n to /Users/arungupta/.grails/1.0.2/projects/helloworld/resources/grails-app/i18n
           [copy] Copying 1 file to /Users/arungupta/.grails/1.0.2/projects/helloworld/classes
           [copy] Copying 1 file to /Users/arungupta/.grails/1.0.2/projects/helloworld/resources
           [copy] Copying 1 file to /Users/arungupta/.grails/1.0.2/projects/helloworld
      Running Grails application..
      2008-04-10 10:47:51.501::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
      2008-04-10 10:47:51.603::INFO:  jetty-6.1.4
      2008-04-10 10:47:51.755::INFO:  No Transaction manager found – if your webapp requires one, please configure one.
      2008-04-10 10:47:52.503:/helloworld:INFO:  Set web app root system property: ‘helloworld’ = [/Users/arungupta/testbed/grails-1.0.2/samples/helloworld/web-app/]
      2008-04-10 10:47:52.503:/helloworld:INFO:  Initializing Log4J from [file:/Users/arungupta/.grails/1.0.2/projects/helloworld/resources/log4j.properties]
      2008-04-10 10:47:52.582:/helloworld:INFO:  Initializing Spring root WebApplicationContext
      [0] spring.GrailsWebApplicationContext Refreshing org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@dccb42: display name [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@dccb42]; startup date [Thu Apr 10 10:47:53 PDT 2008]; parent: org.springframework.web.context.support.XmlWebApplicationContext@188af2
      [0] spring.GrailsWebApplicationContext Bean factory for application context [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@dccb42]: org.springframework.beans.factory.support.DefaultListableBeanFactory@413ebc
      2008-04-10 10:47:55.602:/helloworld:INFO:  Initializing Spring FrameworkServlet ‘grails’
      2008-04-10 10:47:55.652::INFO:  Started SelectChannelConnector@0.0.0.0:8080
      Server running. Browse to http://localhost:8080/helloworld
      2008-04-10 10:48:15.133:/helloworld:INFO:  GSP servlet initialized

      The output in the browser looks like:


      Jetty is used as the development environment server but soon GlassFish v3 can be used, stay tuned on that!

      Anyway, the WAR format is used for deployment. Lets see how this app can be easily deployed as a WAR file on GlassFish v3.

  3. Download GlassFish v3 Preview 2 b08 and unzip.
  4. Create and Deploy WAR
    1. GlassFish certainly supports WAR-based deployment of Grails apps but direct deployment (aka native or directory-based deployment) of Grails applications will be supported soon as well. Anyway, for now, create a WAR file of the application as:

      ~/testbed/grails-1.0.2/samples/helloworld >grails war

      Welcome to Grails 1.0.2 – http://grails.org/
      Licensed under Apache Standard License 2.0
      Grails home is set to: /Users/arungupta/testbed/grails-1.0.2

      Base Directory: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld
      Note: No plugin scripts found
      Running script /Users/arungupta/testbed/grails-1.0.2/scripts/War.groovy
      Environment set to production
         [delete] Deleting: /Users/arungupta/.grails/1.0.2/projects/helloworld/resources/web.xml
         [delete] Deleting directory /Users/arungupta/.grails/1.0.2/projects/helloworld/classes
         [delete] Deleting directory /Users/arungupta/.grails/1.0.2/projects/helloworld/resources
          [mkdir] Created dir: /Users/arungupta/.grails/1.0.2/projects/helloworld/classes
        [groovyc] Compiling 6 source files to /Users/arungupta/.grails/1.0.2/projects/helloworld/classes
          [mkdir] Created dir: /Users/arungupta/.grails/1.0.2/projects/helloworld/resources/grails-app/i18n
      [native2ascii] Converting 10 files from /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/i18n to /Users/arungupta/.grails/1.0.2/projects/helloworld/resources/grails-app/i18n
           [copy] Copying 1 file to /Users/arungupta/.grails/1.0.2/projects/helloworld/classes
           [copy] Copying 1 file to /Users/arungupta/.grails/1.0.2/projects/helloworld/resources
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging
           [copy] Copying 93 files to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging
           [copy] Copied 19 empty directories to 1 empty directory under /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging
           [copy] Copying 12 files to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging/WEB-INF/grails-app
           [copy] Copying 26 files to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging/WEB-INF/classes
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging/WEB-INF/spring
           [copy] Copying 1 file t
      o /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging/WEB-INF/classes
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging/WEB-INF/templates/scaffolding
           [copy] Copying 6 files to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging/WEB-INF/templates/scaffolding
           [copy] Copying 49 files to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging/WEB-INF/lib
           [copy] Copying 1 file to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging/WEB-INF
         [delete] Deleting: /Users/arungupta/.grails/1.0.2/projects/helloworld/resources/web.xml
           [copy] Warning: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/plugins not found.
      [propertyfile] Updating property file: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging/WEB-INF/classes/application.properties
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging/WEB-INF/plugins
           [copy] Warning: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/plugins not found.
            [jar] Building jar: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/helloworld-0.1.war
         [delete] Deleting directory /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/staging
      Done creating WAR /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/helloworld-0.1.war

      The create WAR file is 18,012,069 bytes.

    2. Start the GlassFish container as:
      ~/testbed/glassfish/v3/p2-b08/glassfish >bin/startserv –verbose
      Apr 10, 2008 11:03:28 AM com.sun.enterprise.admin.launcher.GFLauncherLogger info
      INFO: JVM invocation command line:
      /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java
      -cp
      /Users/arungupta/testbed/glassfish/v3/p2-b08/glassfish/modules/glassfish-10.0-SNAPSHOT.jar
      . . .
      INFO: Listening on port 8080
      Apr 10, 2008 11:03:29 AM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
      WARNING: HTTP listener on port: 8181 is secured, but SSL configuration is not found!
      Apr 10, 2008 11:03:29 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
      INFO: Listening on port 8181
      Apr 10, 2008 11:03:29 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
      INFO: Listening on port 4848
      Apr 10, 2008 11:03:29 AM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot
      INFO: Admin Console Adapter: context root: /admin
      Apr 10, 2008 11:03:29 AM com.sun.enterprise.v3.server.AppServerStartup run
      INFO: com.sun.enterprise.v3.services.impl.GrizzlyService@b24c9a startup done in 681 ms
      Apr 10, 2008 11:03:29 AM com.sun.enterprise.v3.services.impl.ApplicationLoaderService postConstruct
      INFO: loader service postConstruct started at 1207850609785
      Apr 10, 2008 11:03:29 AM com.sun.enterprise.v3.server.AppServerStartup run
      INFO: Application Loader startup done in 717 ms
      Apr 10, 2008 11:03:29 AM com.sun.enterprise.v3.server.AppServerStartup run
      INFO: Glassfish v3 started in 717 ms
      Apr 10, 2008 11:03:29 AM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter ready
      INFO: AdminConsoleAdapter is ready …
    3. Deploy the WAR file as:
      ~/testbed/grails-1.0.2/samples/helloworld >~/testbed/glassfish/v3/p2-b08/glassfish/bin/asadmin deploy helloworld-0.1.war
      helloworld-0.1 deployed successfully
      properties=(name=helloworld-0.1)
      Command deploy executed successfully.

      The output in the browser now looks like:

  5. Add Controller and Re-deploy
    1. Create a new controller as:

      C~/testbed/grails-1.0.2/samples/helloworld >grails create-controller hello

      Welcome to Grails 1.0.2 – http://grails.org/
      Licensed under Apache Standard License 2.0
      Grails home is set to: /Users/arungupta/testbed/grails-1.0.2

      Base Directory: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld
      Note: No plugin scripts found
      Running script /Users/arungupta/testbed/grails-1.0.2/scripts/CreateController.groovy
      Environment set to development
           [copy] Copying 1 file to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/controllers
      Created Controller for Hello
          [mkdir] Created dir: /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/grails-app/views/hello
           [copy] Copying 1 file to /Users/arungupta/testbed/grails-1.0.2/samples/helloworld/test/integration
      Created ControllerTests for Hello

      and change the controller as shown:

      ~/testbed/grails-1.0.2/samples/helloworld >vi grails-app/controllers/HelloController.groovy

      class HelloController {

             def world = {
                      render “Hello World!”
              }
          //def index = { }
      }

    2. Re-create & re-deploy the WAR as described in bullet # 4. And now “http://localhost:8080/helloworld-0.1″ shows the output as shown:

      and clicking on “HelloController” shows the output as:

      The same view is also available at “http://localhost:8080/helloworld-0.1/hello/world” as shown below:

So we deployed a simple Grails application as a WAR on GlassFish v3. Here are some tasks that we are working on:

  • Deploy Grails app on GlassFish v3 using “grails” command (in development environment)
  • Deploy Grails app directly on GlassFish v3 without creating a WAR (in production environment)
  • Seamless integration with NetBeans to provide direct development/deployment to GlassFish

And there is much more, stay tuned!

If you have questions, ask them at href="http://forums.java.net/jive/forum.jspa?forumID=56&start=0">GlassFish forum or Users Alias.

Technorati: groovy grails glassfish v3 scripting netbeans

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 10, 2008

Kenya sings for India – Pangea Day, May 10, 2008

Filed under: General — arungupta @ 12:19 pm


Learn more about Pangea Day – 4 hours, 24 films and a new way to see the world!

Technorati: kenya india youtube nationalanthem janaganamana pangeaday

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 8, 2008

JRuby 1.1 released – ready for production!

Filed under: web2.0 — arungupta @ 11:30 pm

JRuby 1.1 is released and ready for production use today. You can unleash the potential in 3 simple steps – download, unzip & get started. Here is a quote from the announcement:

more and more reports of applications exceeding Ruby 1.8.6 performance; we are even beating Ruby 1.9 in some microbenchmarks

This is validated by 1 (Oct 2007), 2 (Nov 2007), 3 (Feb 2008), 4 (Feb 2008) and many other hidden/unknown reports. You can easily configure JRuby 1.1 as the platform of your choice in NetBeans 6.1 as described in TOTD #27.

Now, match this blazing performance of JRuby with GlassFish v3 gem (only 2.4 Mb) which provides a superior solution for developing and deploying Rails application. The main reasons for using GlassFish instead of WEBrick/Mongrel/LightTPD are:

  • Identical development and deployment environments
  • Handles multiple requests by maintaining JRuby runtimes and database connection pools
  • Ability to redploy an application without restarting container
  • In-built Clustering, Load Balancing, and High Availability support
  • Allows to leverage investment in a Java EE infrastructure and cohosting Ruby-on-Rails and Java EE applications

All the above mentioned reasons, and much more, are explained in detail in Rails powered by the GlassFish Application Server.

The gem installation is extremely simple as shown below:

~/testbed/jruby-1.1 >bin/jruby -S gem install glassfish
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Updating metadata for 93 gems from http://gems.rubyforge.org
…………………………………………………………………………………
complete
Successfully installed glassfish-0.1.2-universal-java
1 gem installed

After the gem is installed, get started by developing a simple scaffold application or Mephisto.

If you are attending JavaOne 2008, then LAB 8400 will show how to develop and deploy Rails applications using NetBeans and deploy them on GlassFish. LAB 4520 will teach you more about the modular and pluggable GlassFish v3 architecture.

GlassFish JRuby wiki or JRuby wiki gives you all the latest information about JRuby-on-Rails and GlassFish.

Technorati: jruby ruby rubyonrails netbeans glassfish v3 gem

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 7, 2008

Rails and Java EE integration – Warbler instead of Goldspike

Filed under: web2.0 — arungupta @ 12:02 am

Part 1 of this tri-series blog explained how a Java EE Servlet and Rails application can be packaged together as WAR file using Goldspike plugin and deployed on GlassFish v2 UR1. There are few issues with Goldspike as explained here. A better and recommended option is to use Warbler for packaging which provides a minimal, flexible and Ruby-like way to create WAR. Warbler really cleans up the packagingof WAR, for example excluding .svn directories, tests and migrations – really nice. For now, it uses RailsServlet for dispatching but even that is pluggable.

This blog, Part 2, will explain how to generate a WAR file using Warbler. Rails powered by GlassFish provides all the details on why GlassFish provides an industry-grade and functionally-rich Application Server.

Now detailed steps:

  1. In an existing JRuby 1.1 installation (enabled with Rails), install Warbler gem:

    ~/testbed/jruby-1.1 >bin/jruby -S gem install warbler
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Updating metadata for 35 gems from http://gems.rubyforge.org
    ……………………………..
    complete
    Successfully installed warbler-0.9.4
    1 gem installed
    Installing ri documentation for warbler-0.9.4…
    Installing RDoc documentation for warbler-0.9.4…
  2. Create a Rails app “railsee2″ as:
    ~/testbed/jruby-1.1/samples/rails >../../bin/jruby -S rails railsee2
          create 
          create  app/controllers
          create  app/helpers
          create  app/models
          . . .
          create  log/production.log
          create  log/development.log
          create  log/test.log

    In order to keep it simple, this application will not be using any database so uncomment the following line from “config/environment.rb”(by removing “#” from beginning of the line):

    config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
  3. Create a new file “web.xml” in “config” directory and use the following contents:
    <!DOCTYPE web-app PUBLIC
      “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN”
      “http://java.sun.com/dtd/web-app_2_3.dtd”>
    <web-app>
            <servlet>
                    <servlet-name>HelloServlet</servlet-name>
                    <servlet-class>server.HelloServlet</servlet-class>
            </servlet>
            <servlet-mapping>
                    <servlet-name>HelloServlet</servlet-name>
                    <url-pattern>/hello</url-pattern>
            </servlet-mapping>
    </web-app>

    This “web.xml” is used by Warbler when packaging the WAR file.

  4. Create and Copy Servlet
    1. Create a Java library with Servlet code as explained in bullet #4 here.
    2. Copy “HelloServlet.jar” from “dist” directory of NetBeans project to “lib” directory of Rails application.
  5. Create and deploy the WAR
    1. Create a WAR file as:

      ~/testbed/jruby-1.1/samples/rails/railsee2 >~/testbed/jruby-1.1/bin/jruby -S warble
      JRuby limited openssl loaded. gem install jruby-openssl for full support.
      http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
      jar cf railsee2.war -C tmp/war .
    2. Deploy the WAR to GlassFish v2 UR1 as:
      ~/testbed/jruby-1.1/samples/rails/railsee2 >~/testbed/glassfish/v2ur1/glassfish/bin/asadmin deploy railsee2.war
      Command deploy executed successfully.
  6. The bundled Servlet is now accessible at “http://localhost:8080/railsee2/hello”. The default browser output looks like:

    And passing a parameter to the URL as “http://localhost:8080/railsee2/hello?name=Arun” shows the output as:

With this, your Java EE Servlet is now bundled with your Rails application deployed on GlassFish v2 UR1.

Now, lets add Controller and View to Rails application and invoke this servlet from there to show complete integration with Rails.

  1. Create a new Controller and View as

    ~/testbed/jruby-1.1/samples/rails/railsee2 >../../../bin/jruby script/generate controller home index
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
          exists  app/controllers/
          exists  app/helpers/
          create  app/views/home
          exists  test/functional/
          create  app/controller
    s/home_controller.rb
          create  test/functional/home_controller_test.rb
          create  app/helpers/home_helper.rb
          create  app/views/home/index.html.erb
  2. Change the generated controller in “app/controllers/home_controller.rb” to:
    class HomeController < ApplicationController

    include Java

      def index
            url = java.net.URL.new(“http://localhost:8080/railsee2/hello”);
            conn = url.open_connection;
            reader = java.io.BufferedReader.new(java.io.InputStreamReader.new(conn.get_input_stream));
            @servlet_output = “”;
            input_line = reader.read_line;
            while input_line != nil
                    @servlet_output << input_line;
                    input_line = reader.read_line;
            end
            reader.close;
      end
    end

  3. Change the generated view in “app/views/home/index.rhtml.erb” to:
    <h1>Home#index</h1>
    <p>Find me in app/views/home/index.html.erb</p>

    <%= @servlet_output %>

  4. Re-create the WAR as describd in bullet # 5 above. And now “http://localhost:8080/railsee2/home/index” shows the output as shown:

This blog explained how a Java EE 5 Servlet and Rails application can be packaged Warbler and deployed on GlassFish. Warbler docs provide detail about usage, configuration, web.xml and other details.

The next blog in this tri-series blog will explain how such an application can be deployed on GlassFish v3. And the cool thing there is that you don’t need Goldspike, Warbler or any other additional plugins – total native deployment, stay tuned!

Technorati: rubyonrails netbeans glassfish v3 javaee5 servlets jruby ruby warbler

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 5, 2008

GlassFish Metro Web Services Training Course

Filed under: webservices — arungupta @ 2:26 pm

Interested in understanding the nitty gritty details of how Metro in GlassFish provides Secure, Reliable, Transactional and .NET 3.0 interoperable Web services ? You can certainly read all about it in Metro Users Guide, post questions to Metro Forum, subscribe to Metro Blogs or The Aquarium.

But now there is a new 5 hours Web-based course, WTMB-SAS-1500, from Sun Training. The course content is organized in 5 different modules:
  • WMT-SAS-1543:Adding Quality of Service and .NET Interoperability to Web Services
  • WMT-SAS-2544: Creating Reliable and Secure Interoperable Web Services
  • WMT-SAS-2545: Creating Transactional Web Services
  • WMT-SAS-2546: Working With the Web Services Policy
  • WMT-SAS-2547: Brokered Trust

Each module explains What/Why/How of each technology and then shows a complete demo using NetBeans on how to use that feature. The course can be taken within 365 days after the purchase. Read more details here.

Here are some other related courses:

Technorati: sun training course metro webservices glassfish netbeans

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 4, 2008

Rails and Java EE integration – Servlet co-bundled and invoked from Rails

Filed under: web2.0 — arungupta @ 12:02 am

One of the several advantages of deploying Rails applications on GlassFish is – co-hosting Rails and Java EE applications in the same container. The screencast #web9 shows how Rails applications can be easily deployed on GlassFish.

This blog takes the JRuby-on-Rails (jRoR) and Java EE integration to the next level. It show how a Java EE Servlet can be co-bundled within a jRoR application. And then it shows how such a servlet can be easily invoked from a Rails view. It uses WAR-based mode for deploying jRoR applications on GlassFish.

Here are the detailed steps:

  1. In an existing JRuby 1.1 RC3 installation (enabled with Rails), install the required gems:

    ~/testbed/jruby-1.1RC3 >bin/jruby -S gem install activerecord-jdbc-adapter   
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Successfully installed activerecord-jdbc-adapter-0.8
    1 gem installed
    Installing ri documentation for activerecord-jdbc-adapter-0.8…
    Installing RDoc documentation for activerecord-jdbc-adapter-0.8…
  2. Create a Rails app as:
    ~/testbed/jruby-1.1RC3/samples/rails >../../bin/jruby -S rails railsee1
          create 
          create  app/controllers
          create  app/helpers
          create  app/models
          create  app/views/layouts
          create  config/environments
          create  config/initializers
          create  db
          create  doc
          create  lib
          create  lib/tasks
          create  log
          create  public/images
          create  public/javascripts
          create  public/stylesheets
          create  script/performance
          create  script/process
          create  test/fixtures
          create  test/functional
          create  test/integration
          create  test/mocks/development
          create  test/mocks/test
          create  test/unit
          create  vendor
          create  vendor/plugins
          create  tmp/sessions
          create  tmp/sockets
          create  tmp/cache
          create  tmp/pids
          create  Rakefile
          create  README
          create  app/controllers/application.rb
          create  app/helpers/application_helper.rb
          create  test/test_helper.rb
          create  config/database.yml
          create  config/routes.rb
          create  public/.htaccess
          create  config/initializers/inflections.rb
          create  config/initializers/mime_types.rb
          create  config/boot.rb
          create  config/environment.rb
          create  config/environments/production.rb
          create  config/environments/development.rb
          create  config/environments/test.rb
          create  script/about
          create  script/console
          create  script/destroy
          create  script/generate
          create  script/performance/benchmarker
          create  script/performance/profiler
          create  script/performance/request
          create  script/process/reaper
          create  script/process/spawner
          create  script/process/inspector
          create  script/runner
          create  script/server
          create  script/plugin
          create  public/dispatch.rb
          create  public/dispatch.cgi
          create  public/dispatch.fcgi
          create  public/404.html
          create  public/422.html
          create  public/500.html
          create  public/index.html
          create  public/favicon.ico
          create  public/robots.txt
          create  public/images/rails.png
          create  public/javascripts/prototype.js
          create  public/javascripts/effects.js
          create  public/javascripts/dragdrop.js
          create  public/javascripts/controls.js
          create  public/javascripts/application.js
          create  doc/README_FOR_APP
          create  log/server.log
          create  log/production.log
          create  log/development.log
          create  log/test.log

    In order to keep it simple, this application will not be using any database so uncomment the following line from “config/environment.rb” (remove “#” at  beginning of the line):

    config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
  3. Install Goldspike plugin in the application as:
    ~/testbed/jruby-1.1RC3/samples/rails/railsee1 >../../../bin/jruby script/plugin install svn://rubyforge.org/var/svn/jruby-extra
    s/trunk/rails-integration/plugins/goldspike

    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/test
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/test/war_config_test_config.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/test/test_java_library.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/test/test_maven_library.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/test/test_create_war.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/Rakefile
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/init.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/tasks
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/tasks/war.rake
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/lib
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/lib/util.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/lib/war_config.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/lib/run.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/lib/java_library.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/lib/packer.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/lib/create_war.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/install.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/generators
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/generators/goldspike
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/generators/goldspike/goldspike_generator.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/generators/goldspike/templates
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/generators/goldspike/templates/web.xml.erb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/generators/goldspike/templates/war.rb
    A    /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1/vendor/plugins/goldspike/README
    Exported revision 960.
          exists  config
          create  config/war.rb
          create  WEB-INF
          create  WEB-INF/web.xml.erb

    Optionally Warbler may be used for packaging and Goldspike for dispatching.

  4. Create a Java library with Servlet code
    1. Using NetBeans IDE, create a project of type “Java Class Library” and specify the name “HelloServlet”.
    2. Right-click on the project, select “New” and “Servlet…”. Enter the class name as “HelloServlet” and package as “server” as shown below:

    3. Right-click on the project, select Properties and in “Libraries”, “Compile Tab Libraries” add “javaee.jar” from GlassFish v2 UR1 “lib” directory.
    4. Change the “try” block in “processRequest” method to following:
      String name = request.getParameter(“name”);
      if (name == null || name.equals(“”))
          name = “Duke”;
                 
      out.println(“<h1>Servlet HelloServlet at ” + request.getContextPath () + ” says Hello ” + name + “!</h1>”);
    5. Right-click on the project and select “Clean and Build”.
  5. Configure Rails app for Servlet
    1. In your Rails application directory, add the following fragments to “WEB-INF/web.xml.erb”:

      <servlet>
                      <servlet-name>hello</servlet-name>
                      <servlet-class>server.HelloServlet</servlet-class>
      </servlet>


      <servlet-mapping>
                      <servlet-name>hello</servlet-name>
                      <url-pattern>/hello</url-pattern>
      </servlet-mapping>
    2. Create “WEB-INF/lib” directory and copy “HelloServlet.jar” from the “dist” directory of NetBeans project here.
  6. Create & Deploy the WAR
    1. Create a WAR file as:

      <
      /tbody>

      ~/testbed/jruby-1.1RC3/samples/rails/railsee1 >../../../bin/jruby -S rake war:standalone:create
      (in /Users/arungupta/testbed/jruby-1.1RC3/samples/rails/railsee1)
      info: Assembling web application
      info: Packing needed Java libraries …
      info:   adding Java library jruby-complete-1.1RC3
      info:   adding Java library goldspike-1.6
      info:   adding Java library activation-1.1
      info:   adding Java library commons-pool-1.3
      info:   adding Java library bcprov-jdk14-124
      info: Packing needed Ruby gems …
      info:   adding Ruby gem rails version 2.0.2
      info:   adding Ruby gem rake version 0.8.1
      info:   adding Ruby gem activesupport version 2.0.2
      info:   adding Ruby gem activerecord version 2.0.2
      info:   adding Ruby gem actionpack version 2.0.2
      info:   adding Ruby gem actionmailer version 2.0.2
      info:   adding Ruby gem activeresource version 2.0.2
      info:   adding Ruby gem activerecord-jdbc-adapter version 0.8
      info: Packing needed files …
      info: Creating web archive
    2. Deploy the WAR to GlassFish v2 UR1 as:
      ~/testbed/jruby-1.1RC3/samples/rails/railsee1 >~/testbed/glassfish/v2ur1/glassfish/bin/asadmin deploy railsee1.war
      Command deploy executed successfully.
  7. The bundled Servlet is now accessible at “http://localhost:8080/railsee1/hello”. The default browser output looks like:

    And passing a parameter to the URL as “http://localhost:8080/railsee1/hello?name=Arun” shows the output as:

  8. With this, your Java EE Servlet is now bundled with your Rails application deployed on GlassFish v2 UR1.

    Now, lets add Controller and View to Rails application and invoke this servlet from there to show complete integration with Rails.

  1. Create a new Controller and View as

    ~/testbed/jruby-1.1RC3/samples/rails/railsee1 >../../../bin/jruby script/generate controller home index
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
          exists  app/controllers/
          exists  app/helpers/
          create  app/views/home
          exists  test/functional/
          create  app/controllers/home_controller.rb
          create  test/functional/home_controller_test.rb
          create  app/helpers/home_helper.rb
          create  app/views/home/index.html.erb
  2. Change the generated controller in “app/controllers/home_controller.rb” to:
    class HomeController < ApplicationController

    include Java

      def index
            url = java.net.URL.new(“http://localhost:8080/railsee1/hello”);
            conn = url.open_connection;
            reader = java.io.BufferedReader.new(java.io.InputStreamReader.new(conn.get_input_stream));
            @servlet_output = “”;
            input_line = reader.read_line;
            while input_line != nil
                    @servlet_output << input_line;
                    input_line = reader.read_line;
            end
            reader.close;
      end
    end

  3. Change the generated view in “app/views/home/index.rhtml.erb” to:
    <h1>Home#index</h1>
    <p>Find me in app/views/home/index.html.erb</p>

    <%= @servlet_output %>

  4. Re-create & re-deploy the WAR as describd in bullet # 6 above. And now “http://localhost:8080/railsee1/home/index” shows the output as shown:

This shows how a Java EE 5 Servlet can be easily invoked from a Rails application deployed on GlassFish. JRuby-on-Rails and GlassFish allows you to leverage business knowledge that exists in Java EE applications very easily and still providing Rails agility.

Technorati: rubyonrails netbeans glassfish javaee5 servlets jruby ruby goldspike

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

April 3, 2008

Poetry on Sun Campus Ambassador

Filed under: General — arungupta @ 1:26 pm

Agraj is a bright Sun Campus Ambassador from Delhi University (my alma mater too :) . Here is a poem dedicate to him and written by one of the professors:

Under the SUN-MICROSYS SunRay
Has bloomed a Lovely Rose,
Over Joyful in Java & Solaris
He is SUN CAMPUS AMBASSADOR Agraj.
Only one request I want to make
to the SUN’s shining flower,
To remain in serene silence
During my lecture hour

                Quoted by Dr. P.K Hazra

Read the original post here.

Technorati: poetry campusambassador delhi

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
« Newer PostsOlder Posts »

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Powered by WordPress