TOTD #32: Rails Deployment on GlassFish v3 from NetBeans IDE


Rails powered by the GlassFish Application Server explains all the benefits of using GlassFish for developing and deploying your Rails applications. If you are using NetBeans 6.1 builds then you can deploy your Rails application directly on GlassFish v3 from within NetBeans IDE. No longer you need to have different development and deployment options.

This blog explains how to install a bleeding-edge GlassFish v3 plugin and use it to deploy your Rails app natively on GlassFish (no WAR or anything :). Let's get started! Note, this plugin is bleeding edge and will soon be released on the Beta Update Center.
  1. Install "GlassFish v3 TP2" plugin in NetBeans 6.1
    1. In NetBeans 6.1 IDE, go to "Tools", "Plugins" and click on "Settings". The following window is shown:


    2. Click on "Add" and specify the URL of Bleeding Edge Update Center values as shown (copy from "http://deadlock.netbeans.org/hudson/job/javadoc-nbms/lastSuccessfulBuild/artifact/nbbuild/nbms/updates.xml.gz"):



      Click on "OK". The updated "Plugins" window looks like:




      Notice "Available Plugins" has changed from 58 to 140 as many more bleeding edge plugins are now available.
    3. Click on "Available Plugins" and search for "GlassFish" in the top-right corner text box as shown below:


    4. Select "GlassFish V3 JRuby Integration" and "GlassFish V3 JavaEE Integration" plugin and click on "Install" as shown below:



      Follow the instructions to install the plugin. The IDE needs to restart for successful plugin installation.
    5. In the restarted IDE,  go to "Services" tab, right-click on "Servers" and select "Add Server...". Select "GlassFish v3 TP2" as shown below:


    6. Select "Next >", accept the license agreement and click on "Download V3 Now..."



      Click on "Download V3 Now...". This downloads the latest GlassFish v3 TP2 build and installs in "/Users/arungupta/GlassFish_V3_TP2" directory. This is only an interim build, final TP2 build will be available soon! The following screen is shown once GlassFish v3 is installed:



      Click on "Finish". In 58 seconds, you downloaded and installed the entire GlassFish v3 app server, cool isn't it!
  2. Create a Rails app and deploy on GlassFish V3
    1. In NetBeans IDE, in the "Projects" tab, right-click and select "New Project...". Select "Ruby" in "Categories" and "Ruby on Rails Applications" in "Projects" as shown:



      Click on "Next".
    2. Now comes the cool part. Enter the application name and select the recently installed GlassFish v3 as shown:



      This is a brand new feature in the "GlassFish v3 TP2" plugin available only on "Bleeding Edge" Update Center. It'll soon replace the default GlassFish v3 plugin from the Beta Update Center.

      Click on "Finish" to take all other defaults.
    3. On the newly created project, right-click and select "Run" as shown:

    4. The default browser page "http://localhost:8080/" shows up. Change the URL to "http://localhost:8080/HelloRails" and the following page shows up:

Now, NetBeans IDE and GlassFish v3 serves your need for a complete development and deployment platform for Ruby-on-Rails applications.

If any part of the tooling is not working or you have suggestions and improvement then please file bugs on IssueZilla ("serverplugins" component) and use "glassfish_v3" subcomponent. If any part of the runtime is not working, then please file bugs on Issue Tracker ("V3" component) and use "jruby" subcomponent.

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive is available here.

Technorati: totd glassfish v3 netbeans rubyonrails
Comments:

Upto this part its fine..When i try to access a controller say
http://localhost:8080/HelloRails/hello

my browser hangs up and in the log i can see "Java heap space : Out Of Memory"..

The JVM Xmx for GlassFish V3 TP2 is 512m by default.
My system has 1 Gb RAM

Any guess? Thanks in advance.

Posted by flash on July 07, 2008 at 12:42 AM PDT #

Flash, I tried on 2GB memory machine and did not see that issue. Can you try command-line deployment as described at:

http://blogs.sun.com/arungupta/entry/first_jruby_on_rails_app

Posted by Arun Gupta on July 07, 2008 at 07:32 AM PDT #

Arun, I have tried command-line delpoyment as described at http://blogs.sun.com/arungupta/entry/first_jruby_on_rails_app but still facing the same issue !!

"Java Heap Space Out of Memory"

What do you think?

Thanks

Posted by flash on July 09, 2008 at 08:13 PM PDT #

Have you tried a recent version of Gem as described at:

http://blogs.sun.com/arungupta/entry/getting_started_with_merb_using

It's much slicker.

Posted by Arun Gupta on November 18, 2008 at 10:14 AM PST #

Post a Comment:
Comments are closed for this entry.
About

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


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today