users@glassfish.java.net

Deployment contexts with GF v3 Prelude

From: Bill Kocik <bkocik_at_gmail.com>
Date: Sat, 8 Nov 2008 20:15:38 -0500

I raised these issues over on a NetBeans list and was met with mixed
reviews. I thought I'd try them out here. I hope no one minds.

I'm developing a Rails application using Rails 2.2RC1 and JRuby 1.1.5
with NetBeans 6.5RC2 and GlassFish v3 Prelude (yep, I'm way out there
on the edge - but for the record the same problems I'm seeing happen
with Rails 2.1.0 as well). I'm having a bit of trouble understanding
deployment contexts. There is a setting at Tools -> Servers ->
GlassFish v3 Prelude -> JRuby labeled "Deploy All Rails Applications
At Root Context (/)", which is a checkbox. For brevity I'll call this
the "root context setting".

I begin with that setting on and my application loaded and running at
"/". The first thing I notice is that when I start the server,
NetBeans sends my browser to http://localhost:8080// (note the extra
slash). The second slash is harmless, but clearly shouldn't be there.

The next thing I notice is that I can't get to the admin console. If I
go to http://localhost:4848/ I get my deployed Rails application.

If I stop the server, turn the root context setting off, and start the
server, it deploys the app at the root context anyways (INFO: Loading
Rails application twittertracks at /). Often stopping and starting the
server again (by stopping the running GF server and right-clicking on
my app in NetBeans and choosing "Run"), it gets it right on the second
try (INFO: Loading Rails application twittertracks at /twittertracks).
Sometimes it takes several starts and stops to get it to do this,
though.

Once the application is running in its own context, I can access the
admin console again at http://localhost:4848. But now my application's
routes seem not to work correctly. If I try to access my one
scaffolded controller (this is a brand new blank Rails-generated app
with only one scaffolded controller and model for testing), I get a
routing error: No route matches "/twittertracks/fakes" with
{:method=>:get}.

If I turn the root context setting back on and stop and start the
server - at least twice - it deploys my application at the root
context again, and I'm back where I started. My application works, but
I cannot access the GlassFish console.

Sorry for the long-winded explanation. Just trying to paint as
complete a picture as I can. Can someone shed a little light on what
I'm seeing?


--
Bill Kocik