Skip to main content
Ben Nadel at NCDevCon 2016 (Raleigh, NC) with: Phillip Senn and Michael Senn
Ben Nadel at NCDevCon 2016 (Raleigh, NC) with: Phillip Senn ( @PhillipSenn ) Michael Senn

JRUN Throwing 404 Errors For PATH_INFO In Multiserver ColdFusion Installation

By on
Tags:

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

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

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

34 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

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)

15,674 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?

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel