Merb app. deployed to Websphere 6.1 fails on both AIX and Windows

All,

Any Websphere - heads in the house?.

I’ve generated a WAR file around a small Merb. (0.9.3) app. using
Warbler (0.9.10). Although I can get it to work fine in Websphere’s
Community Edition (which is basically Apache Geronimo/Tomcat), I cannot
get it to work on Websphere 6.1 (on either AIX or Windows XP). “Get it
to work” means successfully retrieve the request for “/” which is mapped
to my “users” controller, index action.

I know that the Web app. deployment has worked in Websphere because I
can retrieve all of the static resources (images, stylesheets) with no
problem.

Behavior in Websphere 6.1 on Windows XP:

1A) If I request “/”, I see the following error:

[8/6/08 20:22:02:301 BST] 0000002d WebApp E [Servlet
Error]-[com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor
incompatible with com.ibm.wsspi.webcontainer.servlet.IServletWrapper]:
java.lang.ClassCastException:
com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor
incompatible with com.ibm.wsspi.webcontainer.servlet.IServletWrapper
at
com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:499)
at
com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:111)
at
com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3107)
at
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)

This makes me think that the container is unable to handle just using
the RackFilter (org.jruby.rack.RackFilter) for some reason.

1B) If I request “/users/index” directly, I see the following errors:

[8/6/08 20:41:12:697 BST] 0000002d SRTServletRes W WARNING: Cannot set
status. Response already committed.
[8/6/08 20:41:12:713 BST] 0000002d SRTServletRes W WARNING: Cannot set
header. Response already committed.

Behavior in Websphere 6.1 on AIX:

  1. If I request “/” or “/users/index”, I see no errors in the out or err
    logs, just "Error 404: SRVE0190E: File not found: {0} " on the screen.

Clearly the servlet filter isn’t being picked up at all here.

My next step will be to insert a standard index.jsp file into the Web
app. and see if I can get a default “/” request to work that way.

Any insight that anyone can provide would be most appreciated.

Thanks,
Wes


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Wes G. wrote:

Behavior in Websphere 6.1 on AIX:

  1. If I request “/” or “/users/index”, I see no errors in the out or
    err logs, just "Error 404: SRVE0190E: File not found: {0} " on the
    screen.

Clearly the servlet filter isn’t being picked up at all here.

So I’ve taken a look at the jruby-rack source to see if I could figure
out what’s going on. I have a theory.

Here is the doFilter() method of org.jruby.rack.RackFilter:

public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
HttpServletRequest httpRequest =
maybeAppendHtmlToPath(request);
HttpServletResponse httpResponse = (HttpServletResponse)
response;
ResponseStatusCapture capture = new
ResponseStatusCapture(httpResponse);
chain.doFilter(httpRequest, capture);

    if (capture.isError()) {
        httpResponse.reset();
        request.setAttribute(RackDispatcher.DYNAMIC_REQS_ONLY,

Boolean.TRUE);
dispatcher.process((HttpServletRequest) request,
httpResponse);
}
}

The way that this appears to work is that the
chain.doFilter(httpRequest, capture) call occurs for our dynamic request
(e.g. “/users/index”). It will fail of course, since there is no file
or servlet configured for that URI. What should happen is that the
capture variable (which is an instance of class ResponseStatusCapture
extends HttpServletResponseWrapper) should have its status set to 404
and then the “if (capture.isError())” block will be executed, which will
actually dispatch the request to Merb.

The fact that I get the 404 back indicates to me that the capture
variable does not get it’s status set as expected, and therefore cannot
be properly interrogated as to whether isError() is true, and thus, no
dispatching on to Merb.

Does this make sense? Can anyone help me figure out how best to verify
it?

Thanks,
Wes
My theory is that for


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Wed, Aug 6, 2008 at 6:26 PM, Wes G. [email protected] wrote:

  HttpServletResponse   httpResponse = (HttpServletResponse) response;

}
does not get it’s status set as expected, and therefore cannot be properly
interrogated as to whether isError() is true, and thus, no dispatching on to
Merb.

Does this make sense? Can anyone help me figure out how best to verify it?

Sounds like a good operating theory. I’d suggest grabbing the source
and building it yourself, then you can add some println debugging or
perhaps load the source into your IDE so you can set breakpoints and
step through source. Building instrctions are at the bottom of the
page in the wiki.

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Nick,

Nick S. wrote:

I have no websphere experience, but I can suggest a couple of things to try:

  • If you want to still use the filter, try playing around with the
    filter prefix in web.xml. (Maybe try ‘/’ instead of ‘/*’ and so on.)

Already tried this with “/”, “" to no avail. As far as I can tell "/
is the officially correct way to specify all requests per JEE
documentation.

I will give this a shot in the morning, and failing that, I’ll try and
debug the source per my earlier post.

Many thanks for the help!

Wes


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Nick,

Nick S. wrote:

Cheers,
/Nick

This seems to work, sort of. It appears that dynamic requests are being
made as expected, but if I directly request a static resource (an image
or a stylesheet), it is being interpreted as a static request.

I notice that in Goldspike configurations, there appears to be a
FileServlet servlet whose purpose is to pull static files, and then it
forwards on to the RailsServlet (Goldspike, recall).

Seems like I have the option of either:

a) using a real value in the configuration to force
the RackServlet to be used only for dynamic routes of which I’m aware

or

b) do something like I described above and steal the Goldspike
FileServlet and just have it forward to the RackServlet if necessary.

Thoughts?

Wes


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Mistake:

"This seems to work, sort of. It appears that dynamic requests are
being made as expected, but if I directly request a static resource (an
image or a stylesheet), it is being interpreted as a dynamic request. "

Wes G. wrote:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Wed, Aug 6, 2008 at 11:02 PM, Wes G. [email protected] wrote:

Mistake:

"This seems to work, sort of. It appears that dynamic requests are being
made as expected, but if I directly request a static resource (an image or a
stylesheet), it is being interpreted as a dynamic request. "

Yes. I do have a Rack handler that will serve the static file, but it
has to go through JRuby to do it, so it’s not going to be fast. That
was the point of the filter in the first place, to avoid that
overhead. If you can’t afford the extra overhead for static files, you
might have to use a front-end to serve the static content, or steal
Goldspike’s FileServlet.

/Nick

Wes
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Nick S. wrote:

On Wed, Aug 6, 2008 at 11:02 PM, Wes G. [email protected] wrote:

Mistake:

"This seems to work, sort of. It appears that dynamic requests are being
made as expected, but if I directly request a static resource (an image or a
stylesheet), it is being interpreted as a dynamic request. "

Yes. I do have a Rack handler that will serve the static file,
Is this “Rack handler” something other than the RackServlet? If so, how
do I use it?

Wes


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Wed, Aug 6, 2008 at 12:54 PM, Wes G. [email protected] wrote:

java.lang.ClassCastException:

Behavior in Websphere 6.1 on AIX:

  1. If I request “/” or “/users/index”, I see no errors in the out or err
    logs, just "Error 404: SRVE0190E: File not found: {0} " on the screen.

Clearly the servlet filter isn’t being picked up at all here.

My next step will be to insert a standard index.jsp file into the Web app.
and see if I can get a default “/” request to work that way.

Any insight that anyone can provide would be most appreciated.

I have no websphere experience, but I can suggest a couple of things to
try:

  • If you want to still use the filter, try playing around with the
    filter prefix in web.xml. (Maybe try ‘/’ instead of ‘/*’ and so on.)
  • You can also try the servlet version, which would use config like
    this in web.xml. Comment out or remove the filter/filter-mapping bits
    and use this instead:

    RackServlet
    org.jruby.rack.RackServlet


    RackServlet
    /*

Cheers,
/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Wed, Aug 6, 2008 at 11:27 PM, Wes G. [email protected] wrote:

Is this “Rack handler” something other than the RackServlet? If so, how do
I use it?

Yes. It’s for Rails apps; enabled by default but disabled if you use
the RackFilter. The code is here:

http://git.caldersphere.net/?p=jruby-rack.git;a=blob;f=src/main/ruby/rack/adapter/rails.rb#l19
http://git.caldersphere.net/?p=jruby-rack.git;a=blob;f=src/main/ruby/rack/adapter/rails.rb#l49

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hmmm…

I removed the RackFilter from my web.xml file, so it is not being
used. I see that the Rack::Adapter::Rails module is in the
jruby-rack-0.9.1.jar file.
I further see how the RackFilter sets the “rack.dynamic.requests.only”
environment hash key, so it makes sense that the Rack handler and the
RackFilter are mutually exclusive.

So I’m wondering why the Rack handler doesn’t seem to be getting used.

I see this line in the initialize of the Rack::Adapter::Rails class:

@public = options[:public] || ::File.join(@root, “public”)

My guess is that the static files are being looked for under /public,
instead of under / which is where warbler has put them in the WAR file.

So:

How do I pass the :public option to the Rack handler?

Or

How do I force the static files to be placed in /public by Warbler so
that the lookup in /public will work?

Thanks,
Wes

Nick S. wrote:

c a l d e r s p h e r e . n e t


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I suspect that the failure of the RackFilter has something to do with
these known IBM issues (which appear to plague the 6.1 version of
Websphere that I am using):

Bleh.

Wes


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Thu, Aug 7, 2008 at 12:11 AM, Wes G. [email protected] wrote:

How do I pass the :public option to the Rack handler?
Or

How do I force the static files to be placed in /public by Warbler so that
the lookup in /public will work?

You need to set the ‘public.root’ context parameter to ‘/’ in web.xml.
(Maybe this should be the default? The current default is
/WEB-INF/public, but that’s not in sync with Warbler.) You can do this
in config/warble.rb as follows::

Warbler::Config.new do |config|

config.webxml.public.root = ‘/’

end

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Updated to reflect IBM Websphere reality:
http://wiki.merbivore.com/pages/deploying-a-merb-application-to-a-jee-container-us

Wes


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email