This problem is maddening and I hope someone can point me in the right direction.
I'm trying to deploy an instance of Redmine to a Jetty servlet. I've created the war using Warbler, have created the context, and it seems to deploy. Unfortunately, I see the following behaviors:
If I access my app at its configured hostname's /, I see a directory listing of the webapp directory.
If I access the app by sending a GET request to /braillewizard (the context name) with a configured hostname sent, the app is run.
If I send a request to /braillewizard with a Host: header not included in the list of hostnames, the app is not run and I get a 404.
So it would seem like I have virtual hosting partially configured correctly, but something isn't quite right. The especially annoying thing is that I am running a similar setup fine on two other systems, including one which runs Redmine, and everything works fine.
The only difference I can think of for this one system is that I'm setting up a vhost for the system's FQDN whereas on other systems the hosts are on incidental domains. Not sure if that is a factor, but my attempts to get rid of the context configuration and go with the app in /root still seem to require a GET of /root.
I'm also telnetting directly to the Jetty server, so this isn't a problem with my front-end web server.
Here is my context configuration:
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="war"><SystemProperty name="jetty.home"/>/webapps/braillewizard.war</Set>
<Set name="contextPath">/</Set>
<Set name="virtualHosts">
<Array type="java.lang.String">
<Item>braillewizard.org</Item>
<Item>www.braillewizard.org</Item>
</Array>
</Set>
</Configure>
And my web.xml, generated by Warbler:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>rails.env</param-name>
<param-value>production</param-value>
</context-param>
<context-param>
<param-name>public.root</param-name>
<param-value>/</param-value>
</context-param>
<filter>
<filter-name>RackFilter</filter-name>
<filter-class>org.jruby.rack.RackFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RackFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
</listener>
</web-app>
If there's anything else I might provide, then please let me know. I've been googling for a solution for hours and not finding anything.
Edit: OK, here are a few more details. The idea that /context worked wasn't exactly true. Rather, the app was failing to load and I couldn't see the exception for some reason. Various tweaks later and the problem seems slightly different.
It seems that / isn't running whatever route is attached to / in the Rails app. Rather, it's triggering a directory listing for the webapp folder. If I visit a URL in my app directly, other than / of course, everything seems to work nicely.
Calling Jetty with -DDEBUG as a JVM arg seems to indicate that RackHandler is being hit, then is falling through to the default handler. This would seem consistent with a handler not running, but I'm not sure why I see the behavior in one version of this deployment and not another.