<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>Vivek Pandey&apos;s Blog</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/" />
<modified>2008-06-25T03:13:33Z</modified>
<tagline></tagline>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249</id>
<generator url="http://www.movabletype.org/" version="3.01D">Movable Type</generator>
<copyright>Copyright (c) 2008, vivekp</copyright>
<entry>
<title>Quick update to GlassFish gem: GlassFish gem 0.3.1 Released</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/06/quick_update_to.html" />
<modified>2008-06-25T03:13:33Z</modified>
<issued>2008-06-25T03:13:13Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.10021</id>
<created>2008-06-25T03:13:13Z</created>
<summary type="text/plain"> As it happens sometimes, right after GlassFish 0.3.0 release we found a critical regression that happened due to the fact that Rails grizzly adapter was re-written and this regression was introduced in that process. It is fixed and updated...</summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>Community: Glassfish</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[<body>
<p>
    As it happens sometimes, right after GlassFish 0.3.0 release we found a critical
    <a href="https://glassfish.dev.java.net/issues/show_bug.cgi?id=4228">regression</a> that happened due to the fact that
    Rails grizzly adapter was re-written and this regression was introduced in that process.
</p>

<p>
    It is fixed and updated GlassFish gem 0.3.1 is <a href="http://rubyforge.org/frs/shownotes.php?group_id=5450&release_id=23301">released</a> on <a href="http://rubyforge.org/projects/glassfishgem/">RubyForge</a>.
    As always try it out and send your comments to <a href="http://forums.java.net/jive/forum.jspa?forumID=138">forum</a> or <a href="mailto:webtier@glassfish.dev.java.net">alias</a> and report issues at the <a href="https://glassfish.dev.java.net/servlets/ProjectIssues
">issue tracker</a>.

</p>
</body>]]>

</content>
</entry>
<entry>
<title>Glassfish JRuby gem 0.3.0 released</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/06/glassfish_jruby.html" />
<modified>2008-06-24T04:18:23Z</modified>
<issued>2008-06-24T04:14:59Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.10012</id>
<created>2008-06-24T04:14:59Z</created>
<summary type="text/plain">I just released GlassFish gem 0.3.0. This is a bug fix release with few enhancements.

The issues fixed in this release are these and these

There is one enhancement that I would like to mention here is that the Rails logger is wired to GlassFish gem logger so when you run your Rails application using jruby -S glassfish_rails yourappdir it will not only pring GlassFish v3 gem logs but also Rails log. </summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>Community: Glassfish</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[<body>
<p>
I just <a href="http://rubyforge.org/forum/forum.php?forum_id=25428">released</a> GlassFish gem 0.3.0. This is a bug
fix release with few enhancements.
</p>
<p>
The issues fixed in this release are <a href="http://rubyforge.org/tracker/?atid=21080&group_id=5450&func=browse">these</a> and
    <a href="https://glassfish.dev.java.net/issues/buglist.cgi?component=glassfish&subcomponent=jruby&issue_status=RESOLVED&resolution=FIXED&email1=vivekp&emailtype1=exact&emailassigned_to1=1&email2=&emailtype2=exact&emailreporter2=1&issueidtype=include&issue_id=&changedin=&votes=&chfield=resolution&chfieldfrom=2008-05-01&chfieldto=Now&chfieldvalue=FIXED&short_desc=&short_desc_type=fulltext&long_desc=&long_desc_type=fulltext&issue_file_loc=&issue_file_loc_type=fulltext&status_whiteboard=&status_whiteboard_type=fulltext&keywords=&keywords_type=anytokens&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&newqueryname=&order=Reuse+same+sort+as+last+time&Submit+query=Submit+query">these</a>
</p>

<p>
There is one enhancement that I would like to mention here is that the Rails logger is wired to GlassFish gem logger so when
you run your Rails application using <br/><code>jruby -S glassfish_rails yourappdir</code> it will not only print GlassFish v3
    gem logs but also Rails log.
</p>

<p>
    Here is the log printed when a sample Rails application cookbook is deployed:
</p>
<pre>
<code>
$jruby -S glassfish_rails cookbook/
Jun 23, 2008 7:02:47 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on HK2 platform
Jun 23, 2008 7:02:47 PM com.sun.enterprise.glassfish.bootstrap.ExtensibleClassLoader
INFO: Added file:/tools/jdk5/lib/tools.jar to shared classpath
Jun 23, 2008 7:02:47 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3000
Jun 23, 2008 7:02:47 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
WARNING: pewebcontainer.all_ssl_protocols_disabled
Jun 23, 2008 7:02:47 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
WARNING: pewebcontainer.all_ssl_ciphers_disabled
Jun 23, 2008 7:02:47 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3131
Jun 23, 2008 7:02:47 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3838
Jun 23, 2008 7:02:47 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot
INFO: Admin Console Adapter: context root: /admin
Jun 23, 2008 7:02:48 PM com.sun.grizzly.jruby.RailsAdapter startRubyRuntimePool
INFO: Starting Rails instances
Jun 23, 2008 7:02:52 PM
SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Jun 23, 2008 7:02:53 PM com.sun.grizzly.jruby.RubyObjectPool$1 run
INFO: JRuby and Rails instance instantiation took : 4988ms
Jun 23, 2008 7:02:53 PM org.glassfish.scripting.rails.RailsDeployer load
INFO: Loading application cookbook at /
Jun 23, 2008 7:02:53 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Glassfish v3 started in 5966 ms
</code>
</pre>
<p>
    Accessing the application http://localhost:3000/recipes shows me the following Rails log that you would be printed at
    log/development.log
</p>
<pre>
<code>
Processing RecipesController#index (for 127.0.0.1 at 2008-06-23 19:02:57) [GET]

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Session ID: BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
SGFzaHsABjoKQHVzZWR7AA==--1fcc8bed80c5349246099b22244d1f5831fe8285

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Parameters: {"controller"=>"recipes", "action"=>"index"}

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO: WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library is not suited for production.
    Please install the C-based MySQL library instead (gem install mysql).

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   SQL (0.000000)   SET NAMES 'utf8'

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   SQL (0.001000)   SET SQL_AUTO_IS_NULL=0

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Recipe Load (0.010000)   SELECT * FROM `recipes`

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO: Rendering template within layouts/application

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO: Rendering recipes/index

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Recipe Columns (0.005000)   SHOW FIELDS FROM `recipes`

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Category Columns (0.005000)   SHOW FIELDS FROM `categories`

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Category Load (0.011000)   SELECT * FROM `categories` WHERE (`categories`.`id` = 2)

Jun 23, 2008 7:02:57 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO: Completed in 0.18900 (5 reqs/sec) | Rendering: 0.13300 (70%) | DB: 0.03200 (16%) | 200 OK [http://localhost/recipes]
</code>
</pre>
<p>
To install simply do <code>jruby -S gem install glassfish</code>, if you have previous installation first uninstall it
    using <code>jruby -S gem uninstall glassfish</code> and then install it.
</p>

<p>
    Try it out and send your comments to <a href="http://forums.java.net/jive/forum.jspa?forumID=138">forum</a> or <a href="mailto:webtier@glassfish.dev.java.net">alias</a> and report issues at the <a href="https://glassfish.dev.java.net/servlets/ProjectIssues
">issue tracker</a>.
</p>
</body>]]>

</content>
</entry>
<entry>
<title>Scala Lift Web Framework on GlassFish v3</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/05/scala_lift_web.html" />
<modified>2008-05-17T00:47:35Z</modified>
<issued>2008-05-17T00:35:49Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9824</id>
<created>2008-05-17T00:35:49Z</created>
<summary type="text/plain">During JavaOne I heard about Lift - a Scala web framework and wanted to try it. It claims to provide best of Rails(simple and fast development), Seaside(security), Django(access control by default) and uses Wicket for view templates. In few steps I had my first Lift web application running on GlassFish v3.</summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>Web Applications</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[<p>
During JavaOne I heard about <a href="http://liftweb.net/index.php/Main_Page">Lift</a>  - a Scala web framework and wanted to try it.
It claims to provide best of Rails(simple and fast development), Seaside(security), Django(access control by default)
and uses Wicket for view templates. In few steps I had my first Lift
web application running on GlassFish v3.
</p>

<p>
Lift applicatin development process is Maven based and uses Derby as the default database. These are the steps to build a simple Lift application and
    deploy it on Embedded GlassFish v3 during development or deploy it on <a href="https://glassfish.dev.java.net">GlassFish v3</a> server.
</p>
<b>Create Application</b>

<p>
    Lift uses Maven Archetype plugin to build a template project.
</p>
<pre>
    <code>
mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create  \
-DarchetypeGroupId=net.liftweb                             \
-DarchetypeArtifactId=lift-archetype-basic                 \
-DarchetypeVersion=0.8                            \
-DremoteRepositories=http://scala-tools.org/repo-releases  \
-DgroupId=<b>my.liftapp</b> <b>-DartifactId=liftapp</b>
    </code>
</pre>

This created <b>liftapp</b> directory.

<ul>
    <li>
        src/main/scala directory contains the Scala source code.
    </li>
    <li>
        src/main/webapp directory contains the HTML, JavaScript, CSS, and WEB-INF code.
    </li>
    <li>
        lift_example directory contains the derby database.
    </li>
</ul>

<b>Now let's build it</b>
<pre>
    <code>
cd liftapp
mvn install
    </code>
</pre>

<p>
    This would create a WAR directory structure at <b>target/liftapp-1.0-SNAPSHOT/</b> and also the WAR file
<b>target/liftapp-1.0-SNAPSHOT.war</b>
</p>


<b>Deploy on GlassFish v3</b>
<p>
I could simply deploy the application on GlassFish v3 server by doing:
</p>
<pre>
    <code>
        asadmin deploy target/liftapp-1.0-SNAPSHOT
    </code>
</pre>



<p>
    Click <a href="http://localhost:8080/liftapp-1.0-SNAPSHOT/">http://localhost:8080/liftapp-1.0-SNAPSHOT/</a> and you
    should see the Welcome screen. Also note that the access controls login, add user features are automatically generated similar to
    Django admin.
</p>

<p>
<img alt="lift-gf.png" src="http://weblogs.java.net/blog/vivekp/archive/images/lift-gf.png" width="786" height="679" />
</p>

<b>Code-Save-Refresh with GlassFish v3</b>
<p>
    The previous deployment on to GlassFish v3 works fine but I needed something that could help me do Code-Save-Refresh cycle without
    restarting the v3 server. Basically I wanted to use Embedded GlassFish v3 where I would simply invoke <b>mvn glassfish:run</b> and
    make changes and compile in another window and at the end refresh the browser to see the changes.
</p>

<p>
Since pom.xml generated by
Lift Archetype does not have entry for <b>maven-glassfish-plugin</b> so I had to add this plugin entry:
</p>

<pre>
    <code>

        &lt;pluginRepositories>
            &lt;pluginRepository>
                &lt;id>maven2.java.net&lt;/id>
                &lt;name>Java.net Repository for Maven 2&lt;/name>
                &lt;url>http://download.java.net/maven/2&lt;/url>
            &lt;/pluginRepository>
        &lt;/pluginRepositories>

        &lt;plugins>
            &lt;plugin>
                &lt;groupId>org.glassfish&lt;/groupId>
                &lt;artifactId>maven-glassfish-plugin&lt;/artifactId>
                &lt;version>1.0-alpha-4&lt;/version>
                &lt;configuration>
                    &lt;resourcesDirectory>target/liftapp-${project.version}&lt;/resourcesDirectory>
                &lt;/configuration>
            &lt;/plugin>
        &lt;/plugins>
    </code>
</pre>

<p>I also had to make one more change in src/main/webapp/WEB-INF/web.xml to workaround due to the fact that
    http://java.sun.com/j2ee/dtds/web-app_2_3.dtd has been renamed to http://java.sun.com/dtd/web-app_2_3.dtd and
    the aliasing is not happening properly with Embedded GlassFish v3</p>
<p>So the change was to edit src/main/webapp/WEB-INF/web.xml and replace <b>http://java.sun.com/j2ee/dtds/web-app_2_3.dtd</b>
    by <b>http://java.sun.com/dtd/web-app_2_3.dtd</b>. This step would not be required once it is fixed in embedded GlassFish v3.</p>

<p>
    That's it! Next I did was invoke <b>mvn glassfish:run</b>
</p>

<pre><code>
    vivekmz@boson(620)> mvn glassfish:run
    [INFO] Scanning for projects...
    [INFO] Searching repository for plugin with prefix: 'glassfish'.
    [INFO] ------------------------------------------------------------------------
    [INFO] Building liftapp
    [INFO]    task-segment: [glassfish:run]
    [INFO] ------------------------------------------------------------------------
    [INFO] Preparing glassfish:run
    [INFO] [resources:resources]
    [INFO] Using default encoding to copy filtered resources.
    [INFO] [yuicompressor:compress {execution: default}]
    [INFO] nb warnings: 0, nb errors: 0
    Downloading: http://scala-tools.org/repo-releases/org/igniterealtime/smack/smack/3.0.4/smack-3.0.4.pom
    Downloading: http://repo1.maven.org/maven2/org/igniterealtime/smack/smack/3.0.4/smack-3.0.4.pom
    Downloading: http://scala-tools.org/repo-releases/org/igniterealtime/smack/smackx/3.0.4/smackx-3.0.4.pom
    Downloading: http://repo1.maven.org/maven2/org/igniterealtime/smack/smackx/3.0.4/smackx-3.0.4.pom
    [INFO] [compiler:compile]
    [INFO] Nothing to compile - all classes are up to date
    [INFO] [scala:compile {execution: default}]
    [INFO] Nothing to compile - all classes are up to date
    [INFO] [glassfish:run]
    May 16, 2008 2:52:31 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: HK2 initialized in 236 ms
    May 16, 2008 2:52:31 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.naming.impl.ServicesHookup@1e708b2 Init done in 241 ms
    May 16, 2008 2:52:31 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.v3.server.Globals@1fbc355 Init done in 242 ms
    May 16, 2008 2:52:31 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.v3.server.SystemTasks@1f2edd2 Init done in 246 ms
    May 16, 2008 2:52:31 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.v3.services.impl.HouseKeeper@f221f6 Init done in 247 ms
    May 16, 2008 2:52:31 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.v3.services.impl.CmdLineParamProcessor@189a773 Init done in 249 ms
    JMXMP connector server URL = service:jmx:jmxmp://localhost:8888
    May 16, 2008 2:52:31 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 8080
    May 16, 2008 2:52:31 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.v3.services.impl.GrizzlyService@154ea79 startup done in 398 ms
    May 16, 2008 2:52:31 PM com.sun.enterprise.v3.services.impl.ApplicationLoaderService postConstruct
    INFO: loader service postConstruct started at 1210978351811
    May 16, 2008 2:52:31 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: Application Loader startup done in 431 ms
    May 16, 2008 2:52:31 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: Glassfish v3 started in 432 ms
    May 16, 2008 2:52:37 PM com.sun.enterprise.web.WebModuleContextConfig authenticatorConfig
    SEVERE: webModuleContextConfig.missingRealm
    Hit ENTER for redeploy

</code></pre>

<p>
   Click <a href="http://localhost:8080/liftapp/">http://localhost:8080/liftapp/</a> would display
</p>

<p>
    <img alt="lift-gf-1.png" src="http://weblogs.java.net/blog/vivekp/archive/images/lift-gf-1.png" width="787" height="575" />

</p>

<p>
    Then I tried to make some changes in the Scala code compile it and then refresh the browser to see if the changes appear there.
    So in another window, edit <b>src/main/scala/my/liftapp/snippet/HelloWorld.scala</b>
</p>

    Replace
<pre>
    <code>
        def howdy = <span>Welcome to liftapp at {new java.util.Date}</span>
    </code>
</pre>

    by

<pre>
    <code>
        def howdy = <span>Welcome to liftapp <b>deployed on GlassFish v3</b> at {new java.util.Date}</span>
    </code>
</pre>
<p>
    Save this file and run <b>mvn install</b> and hit Entner key in the windows where I ran embedded GlassFish v3.
</p>
That's
<p>
    Now, I go back to the browser and refresh the window and it displays the changed text, but first see the GlassFish log
    where you hit Enter and see the log printed when refresh button was pressed in the browser
</p>

<pre>
    <code>
        Hit ENTER for redeploy
        May 16, 2008 2:57:30 PM com.sun.enterprise.web.WebModuleContextConfig authenticatorConfig
        SEVERE: webModuleContextConfig.missingRealm
        INFO - Service request (GET) /liftapp/ took 412 Milliseconds
        INFO - Service request (GET) /liftapp/classpath/blueprint/screen.css took 13 Milliseconds
        INFO - Service request (GET) /liftapp/classpath/blueprint/print.css took 2 Milliseconds
        INFO - Service request (GET) /liftapp/classpath/blueprint/plugins/fancy-type/fancy-type.css took 2 Milliseconds
        INFO - Service request (GET) /liftapp/classpath/jquery.js took 4 Milliseconds
        INFO - Service request (GET) /liftapp/classpath/json.js took 1 Milliseconds
    </code>
</pre>

<p>
    <img alt="lift-gf2.png" src="http://weblogs.java.net/blog/vivekp/archive/images/lift-gf2.png" width="787" height="575" />

</p>

<p>
    To summarize, a Scala Lift application can be deployed on GlassFish v3 server as well as can be run in development
    mode with hot deployment by running embedded GlassFish <b>mvn glassfish:run</b>. Go ahead and try it out and let us know at
    the the <a href="http://forums.java.net/jive/forum.jspa?forumID=138">forum</a> or <a href="mailto:webtier@glassfish.dev.java.net">alias</a>
</p>
]]>

</content>
</entry>
<entry>
<title>GlassFish Gem 0.2.0 and JRuby 1.1.1 module for GlassFish v3 update center</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/05/glassfish_gem_0.html" />
<modified>2008-05-06T02:53:13Z</modified>
<issued>2008-05-06T02:52:15Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9695</id>
<created>2008-05-06T02:52:15Z</created>
<summary type="text/plain">GlassFish Gem 0.2.0 and JRuby 1.1.1 module for GlassFish v3 update center

New version of GlassFish gem 0.2.0 is out. See Arun&apos;s announcements. The major changes in this version are:

    * Version upgrade to GlassFish v3 TP2.
    * Fix to the size regression introduced in the previous release. It is back to about 3MB.
</summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[    <p>
        New version of GlassFish gem 0.2.0 is out. See Arun's <a href="http://weblogs.java.net/blog/arungupta/archive/2008/05/glassfish_v3_ge_4.html">announcements</a>.
        The major changes in this version are:
    </p>
    <ul>
        <li>
            Version upgrade to <a href="https://glassfish.dev.java.net/downloads/v3-techPreview-2.html">GlassFish v3 TP2</a>.
        </li>
        <li>
            Fix to the size regression introduced in the previous release. It is back to about 3MB.
        </li>        
    </ul>
    <p>We also released JRuby 1.1.1 runtime bundle that includes Rails 2.0.2 along with other
        required gems, such as jdbc, jdbc-mysql.</p>
    <p>
        To install JRuby 1.1.1 and Rails 2.0.2 runtime on Glassfish v3 TP2, do the following:
    </p>
    <ul>
        <li>
            From inside GlassFish install directory:
            <code><pre>bin/updatetool</pre></code>
            <p>This will get all the required jars to run updatetool. After it gets all the
            dependencies, run <code><pre>bin/updatetool</pre></code></p>
        </li>
    </ul>
    <br>
    <img alt="ips-jruby.png" src="http://weblogs.java.net/blog/vivekp/archive/images/ips-jruby.png" width="943" height="406" />
<br>
    <p>
        Select <b>JRuby On GlassFish</b> and click install. It will create jruby directory
        inside glassfish-tp2/glassfish/modules directory. Thats all you need. Now start deploying
        your Ruby/Rails applications on GlassFish v3 and you dont need to set JRUBY_HOME in config/asenv.bat or asenv.conf that
        you would do otherwise to tell GlassFish where to find JRuby runtime.
    </p>
]]>

</content>
</entry>
<entry>
<title>Scripting in GlassFish @ JavaOne 2008</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/05/scripting_in_gl.html" />
<modified>2008-05-04T18:29:19Z</modified>
<issued>2008-05-04T18:29:15Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9682</id>
<created>2008-05-04T18:29:15Z</created>
<summary type="text/plain">JavaOne 2008 starts form tomorrow, actually today: there is Unconference in the afternoon. This is going to be my first 8th JavaOne in a row and a most busy one! Here are some of the scripting related talks and events:</summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>JavaOne</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[<p>
<a href="http://java.sun.com/javaone/sf/index.jsp">JavaOne 2008</a> starts form tomorrow, actually today: there is <a href="http://wikis.sun.com/display/GFunconfSF08/GlassFish+unconference+planning">Unconference</a> in the afternoon. This is going to be my first 8th JavaOne in a row and a most busy one! Here are some of the scripting related talks and events:
</p>

<p>
<ul>
    <li>
        BOF-5111 Scripting in GlassFish 
    </li>
    </li>
    <li>
        TS-5416 JRuby: Why, What, How...Do It Now
    </li>
    <li>
        TS-4806 JRuby on Rails: Web Development Evolved
    </li>
    <li>
        TS-6039 Jython - Implementing Dynamic Language Features for the Java™ Platform Ecosystem
    </li>
    <li>
        PAN-5435 The Script Bowl: A Rapid-Fire Comparison of Scripting Languages
    </li>
    <li>
        TS-5764 Grails in Depth
    </li>
    <li>
        TS-5793 Groovy and Grails: Changing the Landscape of Java™ Platform, Enterprise Edition (Java EE Platform) Patterns
    </li>    
</ul>
</p>

<p>
    There are also all week GlassFish <a href="http://weblogs.java.net/blog/arungupta/archive/2008/04/glassfish_event.html">events</a>, do plan to attend these.
</p>

<p>
    I hope to meet many of you. I will be speaking at <b>BOF-5111: Scripting In GlassFish</b> and also at CommunityOne sessions <b>S295418 - Tools for GlassFish V3 (Java EE Platform and Scripting Environment) and Scripting environment</b>.
</p>

<p>
    We also have <b>POD#135 Scripting On GlassFish Booth</b> in the Pavillion. I plan to be around there on Wednesday afternoon so drop by to see what we are up to on supprting dynamic languages and frameworks on GlassFish.
</p>
]]>

</content>
</entry>
<entry>
<title>JRuby Module 3.0 for for GlassFish v2 is out</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/05/jruby_module_30.html" />
<modified>2008-05-03T09:11:47Z</modified>
<issued>2008-05-03T09:11:41Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9673</id>
<created>2008-05-03T09:11:41Z</created>
<summary type="text/plain">JRuby Update Center module 3.0 for GlassFish v2 is out. It has been tested to work with GlassFish v2 UR2. The Update Center modules provide out of the box tested-on-GlassFish version of JRuby, Rails and other required gems. For the GlassFish users it is very convinient just install the JRuby module from the GlassFish update center and start writing the Rails applications.</summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>J2EE</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[
<p>
JRuby Update Center module 3.0 for GlassFish v2 is out. It has been tested to work with <a href="https://glassfish.dev.java.net/downloads/v2ur2-b04.html">GlassFish v2 UR2</a>.
    The Update Center modules provide out of the box tested-on-GlassFish version of JRuby, Rails and other required gems.
    For the GlassFish users it is very convinient just install the JRuby module from the GlassFish update center and start
    writing the Rails applications.
</p>
<p>
    Here are some details on this release of Update Centner Modules:
</p>
<p>
    It is a major upgrade from the previous 2.1 version which came with JRuby 1.0.3 and Rails 1.2.6. The major upgrade
    comes in forms of JRuby version 1.1.1, Rails version 2.0.2 and <a href="http://caldersphere.rubyforge.org/warbler/">Warbler</a>. You can use Warbler to create a WAR of the
    Rails application on GlassFish v2. The UC module also provides ant scripts for shared mode, where JRuby and Goldspike
    jars are installed on Glassfish v2 and you don't have to package any of these jars and the gems with JRuby. This will
    result in to smaller Rails applications compared to the WAR files created by Warbler.
</p>

<p>
    Rails 2.0.2 is not backward compatible with Rails 1.2.6 so samples form the previous JRuby UC module will not work
    on this new ver 3.0.
</p>

<h3>
    JRuby and installed gem versions
</h3>
    <ul>
        <li>JRuby 1.1.1</li>
        <li>gems</li>
        <code>
            <pre>
actionmailer (2.0.2)
actionpack (2.0.2)
activerecord (2.0.2)
activerecord-jdbc-adapter (0.8)
activerecord-jdbcmysql-adapter (0.8)
activeresource (2.0.2)
activesupport (2.0.2)
jdbc-mysql (5.0.4)
rails (2.0.2)
rake (0.8.1)
rspec (1.1.3)
sources (0.0.1)
warbler (0.9.5)
            </pre>
        </code>
    </ul>

<h3>Installing JRuby UC Module 3.0</h3>
<p>
    To install, cd to your GlassFish installation, and run <code><pre>./updatecenter/bin/updatetool</pre></code>. This will bring the window below:
</p>
<p>
    <img alt="gfv2-jruby-uc.png" src="http://weblogs.java.net/blog/vivekp/archive/images/gfv2-jruby-uc.png" width="863" height="593" />
    
</p>

<p>
Select <b>JRuby On GlassFish</b> checkbox and click Install. After it finishes, it will create jruby director inside the
    GlassFish installation.
</p>
<p>
    <img alt="lsjruby.png" src="http://weblogs.java.net/blog/vivekp/archive/images/lsjruby.png" width="577" height="118" />

</p>
<h3>
    Run HelloWorldRailsApp sample
</h3>
    <ul>
        <li>
            Start GlassFish v2
            <code>
                <pre>
asadmin start-domain
                </pre>
            </code>
        </li>
        <li>
            Inside your GlassFish installation,
            <code><pre>cd jruby/samples/HelloWorldRailsApp</pre></code>
        </li>
        <li>
            Create a WAR file <b>HelloWorldRailsApp.war</b> by running warbler
            <code><pre>JRuby -S warble</pre></code>
        </li>
        <li>
            Now Deploy the war file
            <code><pre>asadmin deploy HelloWorldRailsApp.war</pre></code>
        </li>
        <li>
            Access http://localhost:8080/HelloWorldRailsApp/say/hello in your browser.
        </li>
    </ul>
<p>
    Above Warbler was used to create a standalone WAR file. Warbler packages all the required JARs and gems in the the WAR
    file resulting in to large WAR size. You can as well use <b>setup-shared-env</b> target from jruby/build.xml from inside
    the GlassFish installation. This will copy JRuby and Goldspike jars in to glassfish/lib directory. After this
    instead of running Warlbe, simply run <b>create-shared</b> target inside the application this will create WEB-INF/web.xml inside your
    Rails application. At the end simply run asadmin deploy yourRailsApp. For details see GLASSFISH_README.txt inside the samples.
</p>
Continue sending your feedback to the GlassFish WebTier <a href="http://forums.java.net/jive/forum.jspa?forumID=138">forum</a>
or to the <a href="mailto:webtier@glassfish.dev.java.net">mailing list</a>. Report any bugs to the <a href="https://glassfish.dev.java.net/servlets/ProjectIssues">IssueTracker</a>
]]>

</content>
</entry>
<entry>
<title>Embedding GlassFish v3 with Grails</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/05/embedding_glass.html" />
<modified>2008-05-02T00:52:25Z</modified>
<issued>2008-05-02T00:52:20Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9658</id>
<created>2008-05-02T00:52:20Z</created>
<summary type="text/plain"> In my blog on running Grails application on GlassFish v3, I need to create a war of my application and then deploy that war. This was a serious bottleneck in my development process as I wanted to test it out this application on GlassFish v3.

I really wanted to run my Grails application with GlassFish v3 as embedded server in the same fashion as running grails run-app, that is without creating a war file and to speed up my development. By default Grails uses Jetty web server to run the applications. But I wanted to use V3, it is very modular, extensible and embeddable and and is going to allow me to get the JavaEE features that I may like to use at some point in time. One possible way was that GlassFish v3 is an OSGi container and if Grails has an OSGi container I could easily replace jetty with v3. So I mentioned this problem to Kohsuke and came to know that he is working on GlassFish v3 embed APIs. So I gave it a try and guess what? It was darn simple to write few lines of groovy script to get it embedded with Grails and run my application. </summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>J2EE</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[
<p>
    In my <a href="http://weblogs.java.net/blog/vivekp/archive/2008/03/grails_applicat.html">blog</a> on running Grails application on GlassFish v3, I need to create a war of my application and then deploy that war.
    This was a serious bottleneck in my development process as I wanted to test it out this application on GlassFish v3. 
</p>
<p>
I really wanted to run my Grails application with GlassFish v3 as embedded server in the same fashion as running <b>grails
    run-app</b>, that is without creating a war file and to speed up my development. By default Grails uses
    Jetty web server to run the applications. But I wanted to use V3, it is very modular, extensible and embeddable and and is
    going to allow me to get the JavaEE features that I may like to use at some point in time.

    One possible way was that GlassFish v3 <a href="http://blogs.sun.com/dochez/entry/glassfish_v3_runs_on_osgi">is an OSGi
    container</a> and if Grails has an OSGi container I could easily replace jetty with v3. So I mentioned this problem
    to <a href="http://weblogs.java.net/blog/kohsuke/">Kohsuke</a> and came to know that he is <a href="http://weblogs.java.net/blog/kohsuke/archive/2008/04/glassfish_v3_ju.html">working on</a>
    GlassFish v3 embed APIs. So I gave it a try and guess what? It was darn simple to write few lines of groovy script to
    get it embedded with Grails and run my application.
    
</p>
<p>
    Here is the groovy script that starts GlassFish v3 server and deploys the grails application. Please note that the
    API is using scattered war in literal sense - there is no WAR file structure here.
</p>

<p>
    <code>
        <pre>
    appName = new File("${grailsAppName}");
    webxml = new File(webXmlFile.absolutePath)
    resource = new File("${basedir}/web-app")
    ScatteredWar war = new ScatteredWar(
                "${grailsAppName}",
                resource,
                webxml,
                Collections.singleton(new File(appName, classesDir.getAbsolutePath()).toURI().toURL()))

    grailsServer = new GlassFish(serverPort)/a>
    grailsApp = grailsServer.deploy(war)
        </pre>
    </code>
</p>

<p>I called this script RunaAppGf.groovy and after adding V3 Embed API and other v3 dependent jars (web-all.jar) to the
    Grails classpath, copied it to $GRAILS_HOME/script directory. With this I was ready to run my grails app and so I did
    by invoking <b>grails run-app-gf</b> inside my grails application directory.</p>
<code>
    <pre>
vivekmz@boson(653)> grails run-app-gf

Welcome to Grails 1.0.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /tools/grails

Base Directory: /myhome/vivekmz/dev/grails/hello
Environment set to development
Note: No plugin scripts found
Running script /tools/grails/scripts/RunAppGf.groovy
Starting GlassFish embedded server...Running Grails application..
Application name : hello
Web App Root :/myhome/vivekmz/dev/grails/hello/web-app
web.xml:/myhome/vivekmz/.grails/1.0.1/projects/hello/resources/web.xml
May 1, 2008 1:46:45 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: HK2 initialized in 380 ms
May 1, 2008 1:46:45 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.naming.impl.ServicesHookup@304648 Init done in 391 ms
May 1, 2008 1:46:45 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.v3.server.Globals@6c9f0f Init done in 393 ms
May 1, 2008 1:46:45 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.v3.server.SystemTasks@1cdc190 Init done in 400 ms
May 1, 2008 1:46:45 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.v3.services.impl.HouseKeeper@d9b071 Init done in 403 ms
May 1, 2008 1:46:45 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.v3.services.impl.CmdLineParamProcessor@19f9c7a Init done in 407 ms
JMXMP connector server URL = service:jmx:jmxmp://localhost:8888
May 1, 2008 1:46:45 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 8080
May 1, 2008 1:46:45 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: com.sun.enterprise.v3.services.impl.GrizzlyService@3a4822 startup done in 718 ms
May 1, 2008 1:46:45 PM com.sun.enterprise.v3.services.impl.ApplicationLoaderService postConstruct
INFO: loader service postConstruct started at 1209678405813
May 1, 2008 1:46:45 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Application Loader startup done in 764 ms
May 1, 2008 1:46:45 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Glassfish v3 started in 765 ms
May 1, 2008 1:46:51 PM com.sun.enterprise.web.WebModuleContextConfig authenticatorConfig
SEVERE: webModuleContextConfig.missingRealm
[0] commons.DefaultGrailsApplication The class [UrlMappings] was not found when attempting to load Grails application. Skipping.
[3] commons.DefaultGrailsApplication The class [Config] was not found when attempting to load Grails application. Skipping.
[5] commons.DefaultGrailsApplication The class [BootStrap] was not found when attempting to load Grails application. Skipping.
[8] commons.DefaultGrailsApplication The class [DataSource] was not found when attempting to load Grails application. Skipping.
[10] commons.DefaultGrailsApplication The class [resources] was not found when attempting to load Grails application. Skipping.
[1426] spring.GrailsWebApplicationContext Refreshing org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1e5052b: display name [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1e5052b]; startup date [Thu May 01 13:46:53 GMT-08:00 2008]; parent: org.springframework.web.context.support.XmlWebApplicationContext@13cb2c6
[1426] spring.GrailsWebApplicationContext Bean factory for application context [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1e5052b]: org.springframework.beans.factory.support.DefaultListableBeanFactory@192974
Server running. Browse to http://localhost:8080/hello
    </pre>
</code>
<p>
    The next steps are really to provide the required V3 jars, V3 Embed Jars and this script as a bundle so that you can
    easily install over the Grails installation and enjoy modularity, extensibility and embeddability of GlassFish v3. I plan to talk about it more during JavaOne and Kohsuke and me are trying to see if we could have something ready in another day or so.
</p>
]]>

</content>
</entry>
<entry>
<title>My first Jython web app on GlassFish v3</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/03/my_first_jython.html" />
<modified>2008-03-27T00:18:32Z</modified>
<issued>2008-03-27T00:17:06Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9432</id>
<created>2008-03-27T00:17:06Z</created>
<summary type="text/plain">I have been thinking of playing with Jython and GlassFish for quite some time. I thought of taking the first shot at it. So after looking around a bit I found out that I can simply use PyServlet to delegate the HTTP requests to my Jython servlet which can do whatever with the Python script and write it back to the Servlet output stream. Let us see how I did it</summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>Community: Java Enterprise</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[I have been thinking of playing with Jython and GlassFish for quite some time. 
I thought of taking the first shot at it. So after looking around a bit I found 
out that I can simply use PyServlet to delegate the HTTP requests to my Jython 
servlet which can do whatever with the Python script and write it back to the 
Servlet output stream. Let us see how I did it:

<h3>Setup</h3>
<ul>
<li>
Install <a 
href="http://download.java.net/javaee5/v3/releases/preview/glassfish-snapshot-v3-preview-26_03_2008.zip">GlassFish v3.</a>
</li>
<li>
Install <a href="http://www.jython.org/download.html">Jython </a>. The current 
version I got is Jython 2.2.1.<br/><br/>
<img alt="jythonv.png" 
src="http://weblogs.java.net/blog/vivekp/archive/images/jythonv.png" 
width="581" height="60" />

</li>
</ul>
<h3>Create a Python Servlet</h3>
<p>
<ul>
<li>
Create the servlet layout:
<br/><br/>
<pre>
cd c:/dev
mkdir calendar
cd calendar
mkdir WEB-INF
mkdir WEB-INF/lib
</pre>
<p>
Now, create Show.py, which is a Python Servlet and save it at c:/dev/calendar:
</p>
<pre>
from javax.servlet.http import HttpServlet 
class Show (HttpServlet): 
    def doGet(self,request,response): 
        self.doPost (request,response) 
    def doPost(self,request,response): 
        toClient = response.getWriter() 
        response.setContentType ("text/html") 
        toClient.println ("&lt;body>&lt;h1>Calendar&lt;/h1>&lt;pre>No 
Calendar&lt;/pre>&lt;/body>&lt;/html>")
</pre>
</li>

<li>
Create web.xml to serve all the python files by PyServlet:
<br/><br/>
<pre>
&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    &lt;servlet>
        &lt;servlet-name><b>PyServlet</b>&lt;/servlet-name>
        &lt;servlet-class><b>org.python.util.PyServlet</b>&lt;/servlet-class>
        &lt;load-on-startup>1&lt;/load-on-startup>
    &lt;/servlet>
    &lt;servlet-mapping>
        &lt;servlet-name>PyServlet&lt;/servlet-name>
        &lt;url-pattern><b>*.py</b>&lt;/url-pattern>
    &lt;/servlet-mapping>
    &lt;session-config>
        &lt;session-timeout>
            30
        &lt;/session-timeout>
    &lt;/session-config>
&lt;/web-app>    
</pre>
</li>

<li>
Copy jython.jar and python libraries to <b>WEB-INF/lib</b>. The Python 
libraries are located under <b>Lib</b> directory of Jython installation 
directory. You will also find jython.jar under the Jython installation 
directory.
<pre>
cd c:/tools/jython
cp jython.jar c:/dev/calendar/WEB-INF/lib
cp -rf Lib c:/dev/calendar/WEB-INF/lib
</pre>
</li>
</ul>
<h3>Deploy the Python web application</h3>
<ul>
<li>
Start GlassFish v3
<br/><br/>
<img alt="gfstart-jython.png" src="http://weblogs.java.net/blog/vivekp/archive/images/gfstart-jython.png" width="651" height="512" />


</li>
</ul>
<pre>
[/c/dev]
$./glassfish/bin/asadmin deploy calendar
properties=(name=calendar)
</pre>
<p>
Now access <b>http://localhost:8080/calendar/Show.py</b>, it should show this 
page:
</p>
<img alt="cal1.png" 
src="http://weblogs.java.net/blog/vivekp/archive/images/cal1.png" width="537" 
height="327" />

<p>This was simply a jython servlet but there was no Python specific libraries 
involved.</p>
<h3>Invoke Python libraries</h3>
<p>
We will show Year 2008 calendar using python class calendar.
</p>
Let us modify <b>Show.py</b>. 
<p>
<pre>
<b>import sys,calendar,time </b>
from javax.servlet.http import HttpServlet 
class Show (HttpServlet): 
    def doGet(self,request,response): 
        self.doPost (request,response) 
    def doPost(self,request,response): 
        toClient = response.getWriter() 
        response.setContentType ("text/html") 
        <b>toClient.println 
("&lt;body>&lt;h1>Calendar&lt;/h1>&lt;pre>%s&lt;/pre>&lt;/body>&lt;/html>" % 
calendar.calendar(time.localtime()[0]))</b>
</pre>
<br/>
Notice that the main change made to Show.py is that we invoke 
calendar.calendar() and pass it the localtime. Also, there is an import of 
calendar and time.
</p>

Now, go back to your browser and refresh the page and you would see Year 2008 
calendar:<br/>
<img alt="cal2.png" 
src="http://weblogs.java.net/blog/vivekp/archive/images/cal2.png" width="630" 
height="556" />

<p>This is it! However it involves Jython Servlet and some wiring and could be 
lot simpler. <a href="http://fwierzbicki.blogspot.com/">Frank</a> plans to work 
on simplified and better integrated support for Jython on GlassFish. Stay tuned 
there is more to come...
</p>]]>

</content>
</entry>
<entry>
<title>Using JPA with Rails on GlassFish and MySQL</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/03/using_jpa_with.html" />
<modified>2008-03-21T08:56:42Z</modified>
<issued>2008-03-21T08:56:33Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9398</id>
<created>2008-03-21T08:56:33Z</created>
<summary type="text/plain">In my last post I mentioned that &quot;...with Rails there are some known limitations, such as the ORM in Rails is not pluggable&quot; by which I basically meant that you can&apos;t plug in another ORM and the Rails Model creation and db migration will not generate the correct code for another kind of ORM. The good news is that with little bit of coding you can reuse your entity classes. caroljmcdonald commented on my blog that Brian in his blog succssfully tried out JPA and Rails on WEBRick using JavaDB. So, in this blog I would go over what you would need to do to make JPA and Rails work on GlassFish v2.</summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>Community: Java Enterprise</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[<p> In my last <a href="http://weblogs.java.net/blog/vivekp/archive/2008/03/report_on_jruby.html">post</a> I mentioned that "...with Rails there are some known limitations, such as the ORM in Rails is not pluggable" by which I basically meant that you can't plug in another ORM and the Rails Model creation and db migration will not generate the correct code for another kind of ORM. The good news is that with little bit of coding you can reuse your entity classes. caroljmcdonald commented on my blog that <a href="http://weblogs.java.net/blog/bleonard/">Brian</a> in his <a href="http://weblogs.java.net/blog/bleonard/archive/2007/09/rails_and_jpa_i.html">blog</a> succssfully tried out JPA and Rails on WEBRick using JavaDB. So, in this blog I would go over what you would need to do to make JPA and Rails work on <a href="https://glassfish.dev.java.net/downloads/v2ur1-b09d.html">GlassFish v2</a>.
</p>

<p>
Let's first try to understand how it is going to work: Rails by default uses ActiveRecords for Object Relational Mapping purposes or ORM. JPA is another ORM technique in JavaEE. Model class and database migration in Rails is what Entity class and persistence provider does for you in Java. Essentially In Java you just provide the Entity class and on the Rails side, you would provide the Model corresponding to the Entity class to do CRUD and that is pretty much it. The JPA provider does the rest. <br><br>This just means that to use Rails with JPA we simply <b>do not</b> use ActiveRecords - this means we don't create Model using Rails and we dont migrate the database. Just define your Entity class and code up the Rails Model without extending from <code>ActiveRecord::Base</code>.<br><br>Here is how I did it, which is basically few changes in Brian's sample and setting up GlassFish v2 with JRuby on Rails UC module.
</p>

<h3>Setup GlassFish v2 and NetBeans</h3>
<ol>
<li>
Install <a href="http://download.netbeans.org/netbeans/6.1/beta/">NetBeans 6.1 Beata with Web and Java EE profile</a>.
</li>
<li>
Follow <a href="http://wiki.glassfish.java.net/Wiki.jsp?page=GettingStartedGuide#section-GettingStartedGuide-GlassfishV2">these directions</a> to install and setup JRuby on GlassFish v2.
</li>
<li>
Setup JRuby jars as shared libraries on Glassfish<br/><br/>
<pre>
cd $GLASSFISH_HOME/jruby
$ant -f install.xml setup-shared-env
</pre>
</li>
<li>
Copy MySQL driver from your NetBeans installation: <br/><br/><pre>
cp "C:\Program Files\NetBeans 6.1 Beta\ide9\modules\ext\mysql-connector-java-5.1.5-bin.jar" c:/tools/glassfish/lib
</pre> or from <a href="http://dev.mysql.com/downloads/connector/j/5.1.html">here</a> to $GLASSFISH_HOME/lib.
</li>
<li>
Start MySQL server and create <strong>test</strong> database if not already there<br/><br/>
<pre>
mysqladmin -u root create test;
</pre>
</li>
</ol>

<h3>Create Java Entity Beans with MySQL</h3>
<p>
First we create an entity class and a persistence unit.
</p>
	<ol>
	  <li>Create a new Java Application named <strong>Post</strong>. There's no need for a Main Class.</li>
	  <li>Create a new Persistence Unit. Select <strong>jdbc:mysql://localhost:3306/test [root on Default Schema]</strong> as the database connection and the persistence unit name as <b>PostPU</b>click Finish. This will generate src/META-INF/persistence.xml</li>.
	  <li>Create a new Entity Class named <strong>Posts</strong>. Set the package name to <strong>entity</strong>.</li>
	  <li>Add fields and accessors for <strong>title</strong> and <strong>body</strong>. Your completed class should look as follows:<br>
    <br>
    <pre>
package entity;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

/**
 *
 * @author vivek
 */
@Entity
public class Posts implements Serializable {
    private static final long serialVersionUID = 1L;
    private Long id;
    private String title;
    private String body;

    public void setId(Long id) {
        this.id = id;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Posts)) {
            return false;
        }
        Posts other = (Posts) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Post[id=" + id + "]";
    }
    
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

}
    </pre></li>
    <li>
    Create Post.jar by clicking Build->Clean and Build Main Project or Shift+F11. This will create dist/Post.jar inside your project.
    </li>
    <li>
    Copy Post.jar to $GLASSFISH_HOME/lib directory. $GLASSFISH_HOME is where you installed GlassFish.
    <pre>
    cp dist/Post.jar c:/tools/glassfish/lib
    </pre>
    </li>
</ol>


<h3>Create the Rails Application</h3>
Simply download the <a href="http://weblogs.java.net/blog/bleonard/archive/2007/09/rails_jpa/jpa_blog.zip">Rails application</a> then do the following:
<p>
<pre>

cd $GLASSFISH_HOME/jruby/samples
unzip jpa_blog.zip
cd jpa_blog
</pre>
</p>
<p>
Brian's sample Rails application was created using Rails 1.2.3 and GlassFish v2 JRuby module includes Rails version 1.2.6. So edit <strong> config/environment.rb</strong> and replace <code>RAILS_GEM_VERSION = '1.2.3'</code> with <code>RAILS_GEM_VERSION = '1.2.6'</code>.
</p>
<p>
The last thing you want to do is prepare this rails application for deployment over GlassFish v2:
</p>
<p>
<pre>
[/c/tools/glassfish/jruby/samples/jpa_blog]
$ant -f ../../install.xml create-shared
Buildfile: ..\..\install.xml

create-shared:
    [mkdir] Created dir: c:\tools\glassfish\jruby\samples\jpa_blog\WEB-INF
     [copy] Copying 1 file to c:\tools\glassfish\jruby\samples\jpa_blog\WEB-INF

BUILD SUCCESSFUL
Total time: 0 seconds
</pre>
</p>
<p>
Simply deploy your rails application on to GlassFish (if you have not started Glassfish during GlassFish setup, you should do it now):
</p>
<p>
<pre>
[/c/tools/glassfish/jruby/samples/jpa_blog]
$cd ..
[/c/tools/glassfish/jruby/samples]
$../../bin/asadmin.bat deploy jpa_blog
Command deploy executed successfully.
</pre>
</p>

<p>
In the GlassFish server.log you should see:
</p>
<p>
<pre>
[#|2008-03-20T17:46:32.250-0700|INFO|sun-appserver9.1|javax.enterprise.system.to
ols.deployment|_ThreadID=20;_ThreadName=Thread-28;|deployed with moduleid = jpa_
blog|#]

[#|2008-03-20T17:46:33.531-0700|INFO|sun-appserver9.1|javax.enterprise.system.co
ntainer.web|_ThreadID=21;_ThreadName=ObjectPoolManager;|PWC1412: WebModule[/jpa_
blog] ServletContext.log():JRuby init time: 94ms|#]

[#|2008-03-20T17:46:39.296-0700|INFO|sun-appserver9.1|javax.enterprise.system.co
ntainer.web|_ThreadID=21;_ThreadName=ObjectPoolManager;|PWC1412: WebModule[/jpa_
blog] ServletContext.log():Rails init time: 5750ms|#]

[#|2008-03-20T17:46:39.296-0700|INFO|sun-appserver9.1|javax.enterprise.system.co
ntainer.web|_ThreadID=21;_ThreadName=ObjectPoolManager;|PWC1412: WebModule[/jpa_
blog] ServletContext.log():Runtime 0 loaded|#]

[#|2008-03-20T17:46:39.296-0700|INFO|sun-appserver9.1|javax.enterprise.system.co
ntainer.web|_ThreadID=21;_ThreadName=ObjectPoolManager;|PWC1412: WebModule[/jpa_
blog] ServletContext.log():Requests can now be processed|#]
</pre>
</p>


<p>
Now, accessing <strong><code>http://localhost:8080/jpa_blog/blog/</code></strong> should show you:
<br><br>
<img alt="index.PNG" src="http://weblogs.java.net/blog/vivekp/archive/images/index.PNG" width="533" height="503" />

</p>

<p>
Create a new Blog entry:
<br><br>

<img alt="new.png" src="http://weblogs.java.net/blog/vivekp/archive/images/new.png" width="764" height="736" />
</p>

<p>
See the list of all the blogs:
<br><br>
<img alt="list.PNG" src="http://weblogs.java.net/blog/vivekp/archive/images/list.PNG" width="700" height="475" />

</p>

<p>
I wanted to try it out on <a href="http://rubyforge.org/projects/glassfishgem/">Glassfish gem</a> but JPA is under development in GlassFish v3 and I get exception coming form inside GlassFish v3 where it can't find the PersistenceProvider:
</p>
<p>
<pre>
javax.persistence.PersistenceException: No resource files named META-INF/services/javax.persistence.spi.PersistenceProvider were found. Please make sure that the persistence provider jar file is in your classpath.
</pre>
</p>
<p>
Mitesh is working on JPA support in Glassfish v3, I would do a follow-up blog for GlassFish gem as soon as I see it working.
</p>

<p>
You can get the Rails and Entity code using the following link:
<ul>
<li>
<a href="http://weblogs.java.net/blog/vivekp/archive/Post-gf.zip">Entity</a>
</li>
<li>
<a href="http://weblogs.java.net/blog/vivekp/archive/jpa_gf_blog.zip">Rails project</a>
</li>
</p>
</ul>

<p>Continue using <a href="http://wiki.glassfish.java.net/Wiki.jsp?page=GettingStartedGuide">JRuby on GlassFish</a> and keep sending us feedback on <a href="http://forums.java.net/jive/forum.jspa?forumID=56">GlassFish forums</a>, <a href="mailto:dev@glassfish.dev.java.net">dev@glassfish</a> or <a href="http://rubyforge.org/mail/?group_id=5450">gem mailing list</a>. For the latest information about the gem and JRuby Update Center module can be found at <a href="http://wiki.glassfish.java.net/Wiki.jsp?page=JRuby">GlassFish JRuby wiki</a>.]]>

</content>
</entry>
<entry>
<title>Report on JRuby On Glassfish@Silicon Valley JUG</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/03/report_on_jruby.html" />
<modified>2008-03-19T19:22:39Z</modified>
<issued>2008-03-19T19:22:20Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9389</id>
<created>2008-03-19T19:22:20Z</created>
<summary type="text/plain">I was at Silicon Valley JUG (Java User&apos;s Group) to talk about Ruby on Rails in GlassFish. The slides used in this presentation can be found here.

The main theme of my presentation was on highlighting Rails development and deployment on GlassFish v2 and using GlassFish gem with live demos. </summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>Community: Java Enterprise</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[<p>
<a href="http://wiki.glassfish.java.net/Wiki.jsp?page=JRuby">

<div style="float:left">
<img style="border: 0px solid ; width: 223px; height: 100px;" alt="glassfish-jruby-logo.png" src="http://weblogs.java.net/blog/vivekp/archive/images/glassfish-jruby-logo.png"/>
</a>
<br/>
<a href="https://sv-web-jug.dev.java.net/">
<img style="border: 0px solid ; width: 223px; height: 100px;" alt="jug-logo-24pt.jpg" src="http://weblogs.java.net/blog/vivekp/archive/images/jug-logo-24pt.jpg" width="238" height="107" />
</a>
</div>
I was at Silicon Valley JUG (Java User's Group) to talk about <a href="https://sv-web-jug.dev.java.net/servlets/NewsItemView?newsItemID=5465">Ruby on Rails in GlassFish</a>. See Arun's <a href="http://blogs.sun.com/arungupta/entry/glassfish_and_jruby_silicon_valley">announcement</a> on this talk. The slides used in this presentation can be found <a href="http://weblogs.java.net/blog/vivekp/archive/docs/ror-gf.pdf">here</a>.

</p>

<p>
The main theme of my presentation was on highlighting Rails development and deployment on <a href="https://glassfish.dev.java.net/downloads/v2ur1-b09d.html">GlassFish v2</a> and using <a href="http://rubyforge.org/projects/glassfishgem/">GlassFish gem</a> with live demos. 
</p>

<p>These are some of the questions asked during presentation and my answer to those</p>

<p><b>Q:</b>This is cool that Rails applications can be deployed and run over GlassFish a JavaEE application server, but can the JavaEE features be invoked from inside a Rails application?</p>

<p><b>A:</b>Yes we think it can be done, with JRuby you can call anything in Java. We know from one of the JRuby users that he is able to call in to EJB service form Rails. Having said that with Rails there are some known limitations, such as the ORM in Rails is not pluggable, so we can't plugin GlassFish JPA implementation in to Rails to take benefit of it. <a href="http://merbivore.com/">Merb</a> allows such pluggable ORM. As a followup we would provide samples/blogs on Rails and JavaEE features. 
</p>

<p>
<b>Q:</b>What is the performance comparison between JRuby vs Ruby?
</p>

<p>
<b>Q:</b>No formal performance study has been done. There are some blog posts that talk about it, such as <a href="http://blog.nicksieger.com/articles/2007/10/25/jruby-performance-tweaks">this one</a> by Nick, that shows with warm up JRuby/GlassFish as good as C-Ruby/Mogreal and there is <a href="http://vysnu.com/log/2007/07/08/jruby-glassfish-investigation.html">another</a> JRuby on GlassFish comparison to Ruby/Mogrel. We expect with GlassFish gem these numbers would look even better. In next few months the focus  is going to be on performance and scalability, so stay tuned.
</p>

<p>
<b>Q:</b>Can you call in to Ruby from Java?
</p>
<p>
<b>A:</b>Yes, you can do it using JSR-223 APIs. JSR-223 scripting APIs are part of JDK6, with JDK 5 or earlier versions, you can get it from <a href="http://jcp.org/aboutJava/communityprocess/final/jsr223/index.html">here</a>.
</p>

<p>
<b>Q:</b>Does standalone JRuby programs can also get affect from PermGen issue?
</p>

<p>
<b>A:</b>It really depends on the application. For example, in a Rails application, because Rails being single threaded and so it results in to creating Rails for each of the concurrent requests and hence each Rails instance ends up consuming more of Permanent heap space.
</p>
<p>
There were more questions that I can't recall now. The talk was video recorded, I am not sure where and when it will be posted but when I get that link, I will add it to this blog.</p>

<p>Please use <a href="http://wiki.glassfish.java.net/Wiki.jsp?page=GettingStartedGuide">JRuby on GlassFish</a> and send us feedback on <a href="http://forums.java.net/jive/forum.jspa?forumID=56">GlassFish forums</a>, <a href="mailto:dev@glassfish.dev.java.net">dev@glassfish</a> or <a href="http://rubyforge.org/mail/?group_id=5450">gem mailing list</a>. For the latest information about the gem and JRuby Update Center module can be found at <a href="http://wiki.glassfish.java.net/Wiki.jsp?page=JRuby">GlassFish JRuby wiki</a>.


]]>

</content>
</entry>
<entry>
<title>Grails application now working on GlassFish v3</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/03/grails_applicat.html" />
<modified>2008-03-07T22:04:27Z</modified>
<issued>2008-03-07T21:58:13Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9332</id>
<created>2008-03-07T21:58:13Z</created>
<summary type="text/plain">Recently Guillaume reported to me that his Grail app is not working with the recently released GlassFish v3 Preview 2, I took the discussion to GlassFish mailing list, see the discussion here and the corresponding bug.

The good news is that Jerome quickly found out what the problem was and after the code went thru reviews, it was checked in and the fix went into yesterday&apos;s nightly build. </summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>Web Applications</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[<body>
<p>
Recently <a href="http://glaforge.free.fr/weblog/">Guillaume</a>
reported to me about his Grail app not deploying on <a href="https://glassfish.dev.java.net/downloads/v3-techPreview-2.html">GlassFish
    v3 Preview 2</a>.
The problem reported was that the Grail app was taking lots
of time to deploy on GlassFish v3 Preview 2. Although such failures are
not acceptable but considering GlassFish v3 is a complete new
architecture, is still under development and feature incomplete and
above all the preview releases do not go thru the normal test cycle so
such bugs can appear.
</p>
<p>
    This issue was discussed at the GlassFish <a href="mailto:users@glassfish.dev.java.net">mailing list</a>,
see the discussion <a href="http://forums.java.net/jive/thread.jspa?threadID=37205">here</a>
and the corresponding <a href="https://glassfish.dev.java.net/issues/show_bug.cgi?id=4255">bug</a>.
</p>
<p>
The good news is that <a href="http://blogs.sun.com/dochez/">Jerome</a> quickly
found out what the problem was and after the code went thru reviews, it was
checked in and the fix went into yesterday's
    <a href="http://download.java.net/javaee5/v3/releases/preview/glassfish-snapshot-v3-preview-06_03_2008.zip">nightly</a>
build.
</p>
<p>Here is how I created and deployed a Grails application on GlassFish v3:
</p>

<h3>Create a simple Grails app</h3>
<b>Setup Grails</b>
This is the standard way you would setup the Grails environments:
<p>
<code>
    <pre>
    export PATH=$GRAILS_HOME/bin:$PATH
    export GRAILS_HOME=/tools/grails
    </pre>
</code>
</p>
<p></p>
<b>Create a simple Grails app</b>
<code>
   <pre>
    vivekmz@boson(555)&gt; <b>grails create-app MyFirstGrailsApp</b>
    Welcome to Grails 1.0.1 - http://grails.org/
    Licensed under Apache Standard License 2.0
    Grails home is set to: /tools/grails
    Base Directory: /ws/sb
    Environment set to development
    Note: No plugin scripts found
    Running script /tools/grails/scripts/CreateApp.groovy
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/src
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/src/java
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/src/groovy
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/controllers
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/services
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/domain
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/taglib
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/utils
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/views
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/views/layouts
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/i18n
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/conf
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/test
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/test/unit
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/test/integration
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/scripts
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/web-app
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/web-app/js
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/web-app/css
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/web-app/images
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/web-app/META-INF
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/lib
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/conf/spring
    [mkdir] Created dir: /ws/sb/MyFirstGrailsApp/grails-app/conf/hibernate
    [propertyfile] Creating new property file:
    /ws/sb/MyFirstGrailsApp/application.properties
    [copy] Copying 2 files to /ws/sb/MyFirstGrailsApp
    [copy] Copying 2 files to /ws/sb/MyFirstGrailsApp/web-app/WEB-INF
    [copy] Copying 5 files to /ws/sb/MyFirstGrailsApp/web-app/WEB-INF/tld
    [copy] Copying 87 files to /ws/sb/MyFirstGrailsApp/web-app
    [copy] Copying 17 files to /ws/sb/MyFirstGrailsApp/grails-app
    [copy] Copying 1 file to /ws/sb/MyFirstGrailsApp
    [copy] Copying 1 file to /ws/sb/MyFirstGrailsApp
    [copy] Copying 1 file to /ws/sb/MyFirstGrailsApp
    [propertyfile] Updating property file:
    /ws/sb/MyFirstGrailsApp/application.properties
    Created Grails Application at /ws/sb/MyFirstGrailsApp
    </pre>
</code>

<h3>Start GlassFish v3</h3>
<code>
<pre>
    <b>vivekmz@boson(735)> glassfish/bin/asadmin start-domain</b>
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: HK2 initialized in 281 ms
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.naming.impl.ServicesHookup@51b48197 Init done in 307 ms
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.v3.services.impl.CmdLineParamProcessor@9c0ec97 Init done in 310 ms
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.v3.server.SystemTasks@1fd0fafc Init done in 382 ms
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.v3.services.impl.LogManagerService@388ee016 Init done in 411 ms
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.v3.services.impl.HouseKeeper@a210b5b Init done in 413 ms
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 8080
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 8181
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 4848
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.v3.services.impl.GrizzlyService@506f9b8e startup done in 630 ms
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: com.sun.enterprise.security.SecurityServicesUtil@585976c2 startup done in 732 ms
    Mar 7, 2008 7:43:04 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: Glassfish v3 started in 733 ms

</pre>
</code>
<br>You can see above it took 733ms to boot up!


<h3>Deploy the Grails App</h3>
Now that I have built <b>MyFirstGrailsApp</b>, it is time
to deploy. So first I will create a war file:
<p>
    <code>
    <pre>
    vivekmz@boson(558)&gt; cd MyFirstGrailsApp/
    vivekmz@boson(559)&gt; <b>grails war</b>
    </pre>
    </code>
</p>
Now Let's deploy to GlassFish v3:<br/>
<code><pre>
    vivekmz@boson(749)> <b>../glassfish/bin/asadmin deploy MyFirstGrailsApp-0.1.war</b>
    SUCCESS : MyFirstGrailsApp-0.1 deployed successfully
    properties=(name=MyFirstGrailsApp-0.1)
</pre>
</code>
<br/>
The server log tells, it took about 9.7 seconds to deploy it:
<p>
<code>[#|2008-03-07T20:19:03.580+0000|INFO|GlassFish10.0|javax.enterprise.system.tools.deployment|_ThreadID=12;_ThreadName=Thread-4;|Deployment
    of MyFirstGrailsApp-0.1 done is 9765 ms|#]
</code>
</p>
<p>Now when I accessing http://localhost:8080/MyFirstGrailsApp-0.1/ my Grails app appears in the Firefox:</p>

<a href="http://weblogs.java.net/blog/vivekp/archive/images/grails.png">
    <img src="http://weblogs.java.net/blog/vivekp/archive/images/grails-small.png"/>
</a>

<p></p>
<a href="https://glassfish.dev.java.net">GlassFish v3</a> has been going thru continuous improvements and the development team is busy making it rock solid while adding new features to it. Continue sending your
feedbacks to <a href="mailto:users@glassfish.dev.java.net">users@glassfish.dev.java.net</a>.
</body>]]>

</content>
</entry>
<entry>
<title>Python@Sun</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/03/more_on_pythons.html" />
<modified>2008-03-03T19:54:56Z</modified>
<issued>2008-03-03T19:54:48Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9307</id>
<created>2008-03-03T19:54:48Z</created>
<summary type="text/plain">This is further progress in solidifying Sun&apos;s Python story for dynamic
language support in the JVM. Frank has been involved with Jython for
quite some time and will be working on making Python language support
in JVM.</summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[<body>
This is further progress in solidifying Sun's Python story for dynamic
language support in the JVM. Frank has been involved with Jython for
quite some time and will be working on making Python language support
in JVM. Ted will be represening Python in the open source world.
Welcome <a href="http://fwierzbicki.blogspot.com/">Frank</a>
and <a href="http://www.sauria.com/blog/">Ted</a>!
See more on this story <a
 href="http://www.eweek.com/c/a/Application-Development/Sun-Hires-Python-Experts/">here</a>.<br>
<br>
This is just so exciting &nbsp;- JRuby, Jython, Da Vinci Machine,
all of these are going to make it easier to not only have better
support of dynamic languages in JVM but also in GlassFish! <br>
<br>
I am looking forward to working with Frank and Ted for Python/Jyton
support in GlassFish!&nbsp;<br>
<br>
&nbsp;
</body>
]]>

</content>
</entry>
<entry>
<title>Ruby plugin for Hudson</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/01/ruby_plugin_for_1.html" />
<modified>2008-03-27T00:45:59Z</modified>
<issued>2008-01-28T15:24:57Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9082</id>
<created>2008-01-28T15:24:57Z</created>
<summary type="text/plain">Yes, I wrote my first Hudson plugin - a Ruby plugin as my weekend hobby project! You can use this plugin to write the build scripts using Ruby. I must mention that Hudson has such an elegant architecture and the...</summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[Yes, I wrote my first <a href="https://hudson.dev.java.net">Hudson</a> plugin - a 
<a href="http://hudson.gotdns.com/wiki/display/HUDSON/Ruby+Plugin">Ruby plugin</a> 
as my weekend hobby project! You can use this plugin to write the build scripts using Ruby.<p></p><p></p><p>
<a href="http://weblogs.java.net/blog/vivekp/archive/20080126/ruby.png">
<img alt="ruby-small.png" src="http://weblogs.java.net/blog/vivekp/archive/images/ruby-small.png" width="396" height="192" />

</a>
 </p>
<p>I must mention that Hudson has such an elegant architecture and the code is 
so well written. <a href="http://weblogs.java.net/blog/kohsuke/">Kohsuke</a> you 
<a href="http://video.google.com/videoplay?docid=3687708468530214978">Rock</a>!</p>]]>

</content>
</entry>
<entry>
<title>What&apos;s up with Scripting support on Glassfish?</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2008/01/whats_up_with_s.html" />
<modified>2008-01-27T06:06:38Z</modified>
<issued>2008-01-27T06:04:09Z</issued>
<id>tag:weblogs.java.net,2008:/blog/vivekp/249.9077</id>
<created>2008-01-27T06:04:09Z</created>
<summary type="text/plain">Scripting is becoming ever popular among web application developers. Glassfish already supports Ruby on Rails with JRuby, Phobos brings in solid support for JavaScript on Glassfish and AJAX framework jMaki and all of these with excellent NetBeans tooling.</summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>Community: Java Web Services and XML</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[Scripting is becoming ever popular among web application developers. Glassfish 
already
<a href="http://weblogs.java.net/blog/arungupta/archive/2007/08/first_jruby_on.html">
supports</a> Ruby on Rails with <a href="http://jruby.codehaus.org/">JRuby</a>,
<a href="https://phobos.dev.java.net/">Phobos</a> brings in solid support for 
JavaScript on Glassfish and AJAX framework <a href="https://ajax.dev.java.net/">
jMaki</a> and all of these with excellent NetBeans tooling. There are other 
scripting languages such as PHP and Python, which are very popular among 
developers too. How nice would it be to deploy your PHP or Python based web 
applications on Glassfish? Well, we know that marrying Java and scripting 
languages has it's own challenges.
<p></p><p>
JSR-223 let you execute dynamic languages from inside Java. However the 
interpreters for such languages are written in Java and generate bytecodes and 
at runtime deal with all the dynamic types and method dispatching and what not. 
This is because JVM is designed to be used for statically typed language such as 
Java where you know the types at the compile time and to take care of&nbsp; 
types at the runtime the dynamic language interpreters use complex mechanism, 
which results in to uses of more memory, performance etc. JRuby overcomes these 
by doing JIT ahead of time, but then this poses limitation specially on the 
server side considering Rails which is single threaded. </p>

<p>The
<a href="http://www.infoq.com/presentations/gilad-bracha-dynamic-languages-jvm">
good news</a> is that there are efforts in place in JVM to support Dynamic 
Languages, such as <a href="http://jcp.org/en/jsr/detail?id=292">JSR -292</a> is 
going to add a new bytecode,
<a href="http://headius.blogspot.com/2007/01/invokedynamic-actually-useful.html">
invokedynamic</a>, that supports efficient and flexible execution of method 
invocations in the absence of static type information. There is also a new 
project <a href="http://openjdk.java.net/projects/mlvm/">Da Vinci Machine</a> 
that is going to bring in support for dynamic languages (or any other language) 
to JVM.</p>
<p>You might wonder why I am talking about all the scripting stuff! Well, I have 
taken up the role of Scripting Lead in <a href="https://glassfish.dev.java.net">
Glassfish</a>. I will ensure that Glassfish is home to many of the popular 
scripting languages out there and in fact will try to bring best of both worlds 
to Glassfish. JAX-WS will be lead by very capable
<a href="http://weblogs.java.net/blog/jitu/">Jitu</a>.</p>
<p>I am working on wrapping up implementing some new features for upcoming Metro 
1.2 or JAX-WS RI 2.1.4 and starting to take on Scripting Lead. Stay tuned, you 
will be hearing more form me in coming days...</p>]]>

</content>
</entry>
<entry>
<title>Metro 1.0.1 and 1.1 Released</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/vivekp/archive/2007/12/metro_101_and_1_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-12-21T01:10:34Z</issued>
<id>tag:weblogs.java.net,2007:/blog/vivekp/249.8876</id>
<created>2007-12-21T01:10:34Z</created>
<summary type="text/plain">Metro team is pleased to announce the release of Metro 1.1 and Metro 1.0.1. Both these releases are fully tested with many thousands of SQE/Unit/Compatibility/Interop tests on Glassfish V2 UR1.</summary>
<author>
<name>vivekp</name>

<email>Vivek.Pandey@Sun.COM</email>
</author>
<dc:subject>Web Services and XML</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/vivekp/">
<![CDATA[<div style="float:right">
<div>
    <a href="https://metro.dev.java.net/1.1"><img src=https://metro.dev.java.net/1.1/download.png border=0/></a></div>
<div><a href="https://glassfish.dev.java.net/downloads/v2ur1-b09d.html" title="GlassFish V2 UR1">
<img src="https://glassfish.dev.java.net/image/download_GFv2ur1-200_48px.jpg"
alt="Get GlassFish V2 UR1"
vspace="5"
hspace="5">
</a></div>
</div>
<p>

Metro team is pleased to announce the release of <a href="https://metro.dev.java.net/1.1">Metro 1.1</a> and
<a href="https://metro.dev.java.net/1.0.1">Metro 1.0.1</a>. Both these releases are fully tested with many thousands of SQE/Unit/Compatibility/Interop tests on
    <a href="https://glassfish.dev.java.net/downloads/v2ur1-b09d.html">Glassfish V2 UR1</a>.
</p>
<p>
<a href="https://metro.dev.java.net/1.0.1">Metro 1.0.1</a> is a restricted bug fix release and is integrated with
<a href="https://glassfish.dev.java.net/downloads/v2ur1-b09d.html">Glassfish V2 UR1</a>.
</p>

<p>
    Metro 1.0.1 includes <a href="https://wsit.dev.java.net">WSIT 1.0.1</a> and <a href="https://jax-ws.dev.java.net/2.1.2.1">JAX-WS RI 2.1.2.1</a>.
</p>

Changelog for Metro 1.0.1
<ul>
    <li>
     <a href="https://wsit.dev.java.net/issues/buglist.cgi?Submit+query=Submit+query&issue_type=DEFECT&component=wsit&issue_status=RESOLVED&resolution=FIXED&version=1.0&version=1.0.1&version=1.1&version=1.2&version=1.3&version=current&target_milestone=1.0.1&email1=&emailtype1=exact&emailassigned_to1=1&email2=&emailtype2=exact&emailreporter2=1&issueidtype=include&issue_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=fulltext&long_desc=&long_desc_type=fulltext&issue_file_loc=&issue_file_loc_type=fulltext&status_whiteboard=&status_whiteboard_type=fulltext&keywords=&keywords_type=anytokens&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&order=Issue+Number">WSIT 1.0.1 changes</a>   
    </li>
    <li>
        <a href="https://jax-ws.dev.java.net/issues/buglist.cgi?component=jax-ws&issue_status=RESOLVED&resolution=FIXED&target_milestone=2.1.2.1&email1=&emailtype1=exact&emailassigned_to1=1&email2=&emailtype2=exact&emailreporter2=1&issueidtype=include&issue_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=fulltext&long_desc=&long_desc_type=fulltext&issue_file_loc=&issue_file_loc_type=fulltext&status_whiteboard=&status_whiteboard_type=fulltext&keywords=&keywords_type=anytokens&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&namedcmd=as91only&newqueryname=&order=Reuse+same+sort+as+last+time&Submit+query=Submit+query">JAX-WS RI 2.1.2.1 changes</a>        
    </li>
</ul>

<p><a href="https://metro.dev.java.net/1.1">Metro 1.1</a> release includes
    <a href="https://wsit.dev.java.net">WSIT 1.1</a> and <a href="https://jax-ws.dev.java.net/2.1.3">JAX-WS RI 2.1.3</a>.
    Metro 1.1 is a stand alone release but can be easily installed on Glassfish v2 UR1, see the instructions on how to
    <a href="https://wsit-docs.dev.java.net/releases/1.1/install.html">here</a>. Good news is that Metro 1.1.1 which is a bug fix and selected feature
    release of Metro 1.1, will be integrated in
    to upcoming Glassfish v2.1 (Sailfin). See Metro <a href="https://metro.dev.java.net/discover/roadmap.html">roadmap</a> for details.

    <p>
    Here are some key features in Metro 1.1</p>

<ul>
    <li>
            Efficient Handler using Handler&lt;Message&gt; support. See Rama's <a href="http://weblogs.java.net/blog/ramapulavarthi/archive/2007/12/extend_your_web.html">blog</a>
    </li>
    <li>
        Large and Streaming attachment support
    </li>
    <li>
        XML Schema validation support for SOAP message
    </li>
    <li>
        Authentication support in wsimport
    </li>
    <li>
        Additional header support
    </li>
    <li>
        Early Access WS-Reliable Messaging 1.1 support
    </li>
    <li>
        Early Access Kerberose Token support
    </li>

</ul>
Complete Change log for Metro 1.1
        <ul>
            <li><a href="https://jax-ws.dev.java.net/issues/buglist.cgi?Submit+query=Submit+query&component=jax-ws&issue_status=RESOLVED&resolution=FIXED&target_milestone=2.1.3&email1=&emailtype1=exact&emailassigned_to1=1&email2=&emailtype2=exact&emailreporter2=1&issueidtype=include&issue_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=fulltext&long_desc=&long_desc_type=fulltext&issue_file_loc=&issue_file_loc_type=fulltext&status_whiteboard=&status_whiteboard_type=fulltext&keywords=&keywords_type=anytokens&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&order=Reuse+same+sort+as+last+time">JAX-WS RI 2.1.3</a> </li>
            <li><a href="https://wsit.dev.java.net/issues/buglist.cgi?Submit+query=Submit+query&component=wsit&issue_status=RESOLVED&resolution=FIXED&target_milestone=1.1&email1=&emailtype1=exact&emailassigned_to1=1&email2=&emailtype2=exact&emailreporter2=1&issueidtype=include&issue_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&short_desc=&short_desc_type=fulltext&long_desc=&long_desc_type=fulltext&issue_file_loc=&issue_file_loc_type=fulltext&status_whiteboard=&status_whiteboard_type=fulltext&keywords=&keywords_type=anytokens&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&order=Reuse+same+sort+as+last+time">WSIT 1.1</a></li>
        </ul>

<p>
    For the users who like <a href="https://jax-ws.dev.java.net">JAX-WS RI</a> stand alone bundle and Maven releases there is corresponding release of JAX-WS RI,
    <a href="https://jax-ws.dev.java.net/2.1.3">JAX-WS RI 2.1.3</a> and <a href="https://jax-ws.dev.java.net/2.1.2.1">JAX-WS RI 2.1.2.1</a>. These version are also
    released in the <a href="http://download.java.net/maven/1/com.sun.xml.ws/">JAX-WS Maven repository</a>. See the detailed announcement
    <a href="https://jax-ws.dev.java.net/servlets/NewsItemView?newsItemID=5593">here</a>.
</p>

<p>
    What is next? We are planning Metro 1.2 that will be released around March 2008 and also on Metro 1.1.1. Metro 1.1.1 will be integrated
    with upcoming <a href="http://wiki.glassfish.java.net/Wiki.jsp?page=PlanForGlassFishV2.1">Glassfish v2.1</a>. See the details on
    Metro <a href="https://metro.dev.java.net/discover/roadmap.html">roadmap</a>. 
</p>
<p>
    Continue sending your feedbacks to the <a href="http://forums.java.net/jive/forum.jspa?forumID=46">forum</a> and
    to the <a href="mailto:users@metro.dev.java.net">mailing list</a>.

</p>
]]>

</content>
</entry>

</feed>