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.
- Install "GlassFish v3 TP2" plugin in NetBeans 6.1
- In NetBeans 6.1 IDE, go to "Tools", "Plugins" and click
on
"Settings". The following window is shown:

- 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.
- Click on "Available Plugins" and search for "GlassFish"
in the top-right corner text box as shown below:

- 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.
- In
the restarted IDE, go to "Services" tab, right-click on
"Servers"
and select "Add Server...". Select "GlassFish v3 TP2" as shown below:

- 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!
- Create a Rails app and deploy on GlassFish V3
- 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".
- 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.
- On the newly created project, right-click and select
"Run" as shown:

- 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
Posted
by Arun Gupta in web2.0 |

|

|

|

|

|

|
|
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 07: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 02:32 PM 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 10, 2008 at 03:13 AM 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 06:14 PM PST #