JRUN Throwing 404 Errors For PATH_INFO In Multiserver ColdFusion Installation

Posted June 3, 2010 at 9:58 AM by Ben Nadel

Tags: ColdFusion

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:

/index.cfm/foo/bar/

... 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:

web.xml

 
 
 
 
 
 
JRUN web.xml Configuration File With SES Commented Out In Multiserver ColdFusion Installation. 
 
 
 

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!




Reader Comments

Jun 3, 2010 at 10:15 AM // reply »
3 Comments

I'm pretty certain that I did point you to my multi-server setup checklist blog entry.

http://nil.checksite.co.uk/index.cfm/2006/5/3/cfmx-multiserver-set-up

No. 16 on the list. :)


Jun 3, 2010 at 10:25 AM // reply »
11,314 Comments

@Stephen,

Ah, very nice!


Jun 3, 2010 at 11:16 AM // reply »
31 Comments

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 :)


Jun 3, 2010 at 11:23 AM // reply »
11,314 Comments

@Jamie,

Ahh, ok. Yeah, this is all new to me, so I might be making up some of these explanations :)


Jun 7, 2010 at 8:31 AM // reply »
12 Comments

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..


Jun 7, 2010 at 9:43 AM // reply »
11,314 Comments

@Roman,

Sorry my man - I'll get faster with it next time :)


JC
Jun 7, 2010 at 10:48 AM // reply »
16 Comments

Is this a new problem with 9? We've never had this issue in 8 that I can recall.


Jun 7, 2010 at 10:51 AM // reply »
11,314 Comments

@JC,

The SES web.xml config was commented out in both the CF8 and CF9 multi-instance installs that I was using.


Jun 7, 2010 at 11:17 AM // reply »
31 Comments

@JC,

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:
http://corfield.org/blog/post.cfm/Railo_for_Dummies_Part_V


Jul 2, 2010 at 5:34 AM // reply »
1 Comments

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 !!

many thanks

james kane
================================================
404

/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
at jrun.servlet.file.FileServlet.service(FileServlet.java:349)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)


Aug 1, 2010 at 10:29 PM // reply »
11,314 Comments

@James,

Are you actually using the path_info? I am not seeing any file path in your demo. Did you ever figure this out?


Mar 14, 2011 at 12:22 PM // reply »
2 Comments

Thanks Ben - once again your blog has the answer - I was really scratching my head with this one!


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
Jun 19, 2013 at 2:01 PM
Experimenting With The Amazon Simple Storage Service (S3) API Using ColdFusion
I have coincidentally been beating my head against the S3 API for the last week or so. One big "gotcha" I had to work around was file names and paths containing spaces. Remember to URL Enco ... read »
Jun 19, 2013 at 1:27 PM
Using Slice(), Substring(), And Substr() In Javascript
very good article. By the way IE supports negative values in substr or slice in verson 10. ... read »
Jun 19, 2013 at 11:33 AM
Filter vs. ngHide With ngRepeat In AngularJS
In your assessment, is it correct to say that given a list of say 500 items its more performant to use the `ngHide` method over the `filter` method? ... read »
Jun 19, 2013 at 10:18 AM
ColdFusion Path Usage And Manipulation Overview
Anyone happen to know if the file created by getTempFile will be automatically removed at any point? Nothing mentioned in the docs, and restarting CF doesn't remove them, so it seems it needs manu ... read »
Jun 19, 2013 at 9:41 AM
Working With Inherited Collections In AngularJS
I actually just ran into this same situation with a demo I was putting together. Your implementation of multi-lvl $scope's > Mine :) ... read »
Jun 19, 2013 at 8:17 AM
My Experience With AngularJS - The Super-heroic JavaScript MVW Framework
@Prateek, to match a word or text you should use .toContain('word') that's a jasmine reference. website is : http://pivotal.github.io/jasmine/ ... read »
Jun 19, 2013 at 8:10 AM
My Experience With AngularJS - The Super-heroic JavaScript MVW Framework
Hi Guys, Actually i am doing e2e test of angular js of my project but i am not getting one thing that is how to press enter key through the test when my form is filled as i am not using a button but ... read »
Jun 18, 2013 at 9:20 PM
Mapping AngularJS Routes Onto URL Parameters And Client-Side Events
I couldn't find examples of passing multiple arguments using the when() routing statement so figured out through trial and error that you can pass multiple arguments using the following format: .whe ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools