users@glassfish.java.net

Re: Deployment contexts with GF v3 Prelude

From: Peter Williams <Pete.Williams_at_Sun.COM>
Date: Sat, 08 Nov 2008 19:48:05 -0800

Hi Bill,

Comment inline.

Bill Kocik wrote:
> 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 don't remember if I saw them. I keep up on dev_at_ruby.netbeans.org, but
users, not so much. If you are asking about things you think are bugs,
it's better to ask on the dev list since it's more likely we'll see
them. Or just file the bugs :)
>
> 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.
Bleeding edge for sure. I haven't tested anything resembling that combo
yet.

> 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.
I haven't seen this but I agree it shouldn't happen. Can you file a bug
please? (http://issues.netbeans.org, category/subcategory
serverplugins/glassfish_v3)
>
> 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.
Ok, that's weird and definitely shouldn't happen. You're using the
default domain, correct? So HTTP is on 8080 and admin is on 4848?
Please file a bug against glassfish
(https://glassfish.dev.java.net/issues, category/subcategory V3/jruby)

I think you can workaround this by going directly to
http://localhost:4848/login.jsf

>
> 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).
This is expected behavior, though I was reading some various user
experiences that suggested exactly your impression -- what happens is
not intuitive. The "deploy at / (or not)" setting, if changed, does not
affect applications that are already deployed. <Run> will cause the
plugin to redeploy the application if this setting has been changed.

I've had some thoughts about how to improve the experience here but they
likely won't be implemented until the next version of NetBeans. In the
meantime, <Run> on the application (and if you really want to be sure,
undeploy it via the services tab first) will fix it.

This setting is originally sort of a hack that I put in to resolve some
issues in 6.1 + V3 TP2 for JavaONE demos. It needs improvement.

> Sometimes it takes several starts and stops to get it to do this, though.
That is strange and I've not seen such behavior. If you want to test
further, run netbeans with -J-Dglassfish.level=FINE and the V3 plugin
will log the admin commands it executes when you choose <Run> on your
application. What you should see is that it checks the deployment
context root and compares against the current server setting and
redeploys if they are found to be different. I have never seen this
fail as you describe, nor can I imagine why it would -- it's pretty
straight forward.
>
> 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}.
I recall that inside rails, there are some changes you need to add to
make sure that the context root is stripped before doing internal
routing. See this message, and the entire thread:

http://markmail.org/message/msijwo7gm73aw5ea#query:%22server%20integration%20in%20rails%20project%22+page:1+mid:es7ymjy4t7as4hlg+state:results

This was in reference to Rails 2.0.2 I think so perhaps things have
changed somewhat. I'm not sure.

Is it possible for you to try a test application using the stock NB 6.5
ruby bundle (JRuby 1.1.4, Rails 2.1, V3 Prelude) and see it behaves the
same way with respect to your issues above? It would be good to rule
out the changes in environment.

Hope this helps.

-Peter
>
> 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
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>