JRUN Throwing 404 Errors For PATH_INFO In Multiserver ColdFusion Installation
Posted June 3, 2010 at 9:58 AM by Ben Nadel
A few weeks ago, I hired Jamie Krug to help me set up a local development environment consisting of a multiserver ColdFusion installation. This included setting up Apache, ColdFusion 8, and ColdFusion 9 for use on the same code bases. For as long as I can remember, I've only ever used the standalone version of ColdFusion; so, when it came to deploying EAR files, I wanted some professional guidance. Jamie did the most fantastic job hand-holding me through the process - we got ColdFusion 8 and ColdFusion 9 EAR files running on the first try.
However, when I went to test one of the ColdFusion EAR deployments on my personal site (bennadel.com), JRUN started throwing "404 Not Found" errors. After a bit of poking around, we realized that the problem seemed to stem from the fact that my site was using URL Rewriting (mod_rewrite locally, IIS Mod-Rewrite in production). The underlying rewrite rules were forwarding the request to URLs that looked like this:
... where "/foo/bar/" was the PATH_INFO aspect of the URL after the rewrite rules were applied.
Once we realized that this was the problem, we tried using PATH_INFO on the standalone ColdFusion install (the one being used to deploy the EAR files). This worked as expected; so, the next thing we did was compare the web.xml file of the standalone install to the web.xml files of the multiserver ColdFusion installations. What we found was that the SES section of the web configuration files were commented out in the multiserver installations:
| || || || || |
| || |
| || || |
As Jamie explained it to me, apparently not all J2EE servers support PATH_INFO; so, when you use a multiserver installation, the installer cannot be sure that PATH_INFO will be tolerated and therefore comments it out. Once we figured this out, I uncommented the SES configuration, restarted the ColdFusion service, and everything ran perfectly!
- Wanted: Full-Time ColdFusion Developer at Intoria Internet Architects
- Cold Fusion Senior Developer at Edge Information Management
- Back-End Web Developer-Information Technologist at Michigan State University
- ColdFusion Developer at Nonfat Media
- Mid-to-Senior Level Web Application Developer at SiteVision, Inc.
I'm pretty certain that I did point you to my multi-server setup checklist blog entry.
No. 16 on the list. :)
Ah, very nice!
Hey Ben, glad to help. To be clear, it's not so much that some J2EE app servers are lacking support for PATH_INFO, but rather a matter of url-pattern syntax in the servlet-mapping of the descriptor file (web.xml). I'm pretty sure the format used there by JRun is non-compliant with the J2EE specs (albeit very useful!). So, the commented out config would not work with Tomcat, however, there is a fairly simple workaround in Tomcat. It's just not a configuration that's universally supported by all Java EE servers, but there is usually a way :)
Ahh, ok. Yeah, this is all new to me, so I might be making up some of these explanations :)
Okay, THAT comes a bit late Ben ;)
About 4 months ago I also tried to get a multiserver running on my home system and as you might guess AFAIK I had the same problem. After some testing I wasn't able to solve the problem so I reinstalled my single server.
After reading this I think I'll give it another try sometime..
Sorry my man - I'll get faster with it next time :)
Is this a new problem with 9? We've never had this issue in 8 that I can recall.
The SES web.xml config was commented out in both the CF8 and CF9 multi-instance installs that I was using.
If you used the CF Admin to create and deploy additional instances, you probably would not run into this issue, because it of course know it's deploying to JRun only. The issue arises when you use the installer to create an EAR (or WAR), which is meant to work on any J2EE compliant app server. The servlet-mapping in question is definitely supported on JRun, but could cause problems on other servlet containers (even officially supported J2EE options, such as JBoss), hence it is commented out by default.
Here's some information regarding alternative url-pattern expressions that will allow for the "SES" URLs in Tomcat/JBoss:
I have an msaccess database with a table pointing to mp3s. I am encountering the following problem, which seems similar to your one.
/dance_project/MP3Audio/BOXONE/BOXTWO/01 The Sutters of Selkirk.mp3 ... DOES NOT WORK - get error message Java 404..see below
/dance_project/MP3Audio/BOXONE/01 The Sutters of Selkirk.mp3.... THIS WORKS
/dance_project/MP3Audio/01 The Sutters of Selkirk.mp3.... THIS WORKS
I have looked at the WEB.XML file but there is nothing commented out. I am using COLDFUSION 8, developers version.
If anything jumps to mind, I would really appreciate a note !!
/dance_project/MP3Audio/BOXONE/BOXTWO/01 The Sutters of Selkirk.mp3
java.io.FileNotFoundException: /dance_project/MP3Audio/BOXONE/BOXTWO/01 The Sutters of Selkirk.mp3
Are you actually using the path_info? I am not seeing any file path in your demo. Did you ever figure this out?
Thanks Ben - once again your blog has the answer - I was really scratching my head with this one!