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 »
10,743 Comments

@Stephen,

Ah, very nice!


Jun 3, 2010 at 11:16 AM // reply »
23 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 »
10,743 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 »
10,743 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 »
10,743 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 »
23 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 »
10,743 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
InVision App - Prototyping Made Beautiful With Prototyping Tools Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
May 16, 2012 at 8:18 PM
Best Of ColdFusion 10 Contest Entry - HTML Email Utility
Just found this, looks good! I'm trying to run it on local, it's the 64bit version and I'm experiencing horrible lag. On average the generate.cfm processes the content change in 60-90 seconds. I've ... read »
May 16, 2012 at 6:40 PM
Maintaining Sessions Across Multiple ColdFusion CFHttp Requests
I am trying to integrate this CFHTTPsession into an application that will log into zeekrewards.com to post ads and I am not having any luck. The code works perfectly for logging into other websites, ... read »
May 16, 2012 at 2:44 PM
Creating A Sometimes-Fixed-Position Element With jQuery
Thank you, very useful technique! Worked like a charm. ... read »
May 16, 2012 at 1:58 PM
Movies As A Religious Experience
Acting can, in a way, ruin the movie-goer's experience. I used to be able to get so caught up in movies and their plots, and totally engaged. But lately, I haven't been able to as much with a lot o ... read »
May 16, 2012 at 1:52 PM
The Science Of Optimal Post-Exercise Nutrition
children of this age eat very less vegetables so u can opt for salads they will like it also carrot ,cucumber,onion and as far as pulses are concerned u can boil them ,give him along with mashed rice ... read »
May 16, 2012 at 1:34 PM
Strange ColdFusion JRUN Stack Overflow Error
Hey, Recently I updated my jrun4 using the latest updater 7 and now i am having memory issues :(:(:( any help is appreciated ... read »
May 16, 2012 at 9:56 AM
ColdFusion 10 Beta, Apache Tomcat, And Symbolic Links On Mac OSX
Hi, Now that ColdFusion 10 is out I have stumbled over this as well and I cannot figure out the proper solution. We're running virtual hosts via Apache2; the ColdFusion-applications store their fil ... read »
May 15, 2012 at 6:03 PM
Movies As A Religious Experience
@Ben, I don't know whether you'd consider this a religious observation, but it seems to me, in a sense, movies multiply how many lives we get to have. Each movie is like a little extra life we get ... read »