I have a Rails 3.0.3 project successfully running with jRuby/Webbrick
using NetBeans 6.9.1. I need to deploy to WebSphere.
I installed a local copy of WAS 7.0 on my PC. I successfully created a
WAR file using Warbler and installed the application into WAS without
problems.
The application failed to run with a 404 missing file error.
I then figured out I need to change the web.xml.erb file to add the
servlet tags for the RackServlet. This change got me further. Now my
start page displays but I get an error at the first AJAX call invoked by
the page.
The error is:
Error 404:
com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No
target servlet configured
Its complaining about the URL called by the AJAX request.
I found the problem. I installed the application with the context root
“/myApp”. All of my Ajax calls work off the root, which in this case was
“/”.
I changed my Javascript code and passed in the root name so it is
prefixed to all Ajax calls. This worked although I’m not happy with the
solution.
I realize this a Javascript question, but it seems everything should
work off the root no matter how the app is deployed. Is there another
approach I can use to make this work with having to pass in the root?
approach I can use to make this work with having to pass in the root?
If you have static string URLs in your .js files calling things like
Ajax.Request directly, then those URLs won’t magically change if you
switch context roots.
To avoid this, when I need to write javascript that calls Ajax.Request
directly, I always pass in the path and token to the function, like
this: