We help IT Professionals succeed at work.

mp3 file not playing in coldfusion app

jameskane used Ask the Experts™
Environment - Coldfusion testing on FIREFOX with quicktime plugin.

Hi I have a coldfusion app which works correctly. However, I need to change the location of the .MP3's in a table. Currently the table has an entry MP3Audio/01 The Sutters of Selkirk.mp3 - no problem. Changing that address to MP3Audio/BOXONE/BOXTWO/01 The Sutters of Selkirk.mp3
gets the following error. I can't understand why this does not work. Can someone interpret the error message below


/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)
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


WOOPS, should have mentioned, I am using MSACCESS as database


Further Notes
/dance_project/MP3Audio/BOXONE/BOXTWO/01 The Sutters of Selkirk.mp3 ... does not work - get error message

/dance_project/MP3Audio/BOXONE/01 The Sutters of Selkirk.mp3.... This works

/dance_project/MP3Audio/01 The Sutters of Selkirk.mp3.... this works
Most Valuable Expert 2015

> /dance_project/MP3Audio/BOXONE/BOXTWO/01 The Sutters of Selkirk.mp3

1) Does the file exist in that directory AND do you have permission to access that directory?
2) Since the url has spaces in it, I assume you are properly encoding the url ?


HI Agx

Answer to 1) is yes to both questions
Answert to 2 is ??? don't really know ...... The names of the mp3 are inserted into a field in the MSaccess database and then used to launch the mp3. For mp3 I used for the example is entered into the database exactly like that, space and all.

This is the piece of code which makes use of the database table (MusicLink is the field name in the MUSICLINKS table.

<cfquery name="MusicLink2" datasource="SDance">
SELECT cdid, cdid_trkNo, MusicLink
where cdid_trkNo like "#custom2#"

Click <a href="../#TRIM(musiclink2.musiclink)#" title="HEAR MUSIC" target="MYFRAME">here</a> to listen.&nbsp;&nbsp;

Thanks as always for you time !!

Most Valuable Expert 2015
> <a href="../#TRIM(musiclink2.musiclink)#"

The first thing I would check is the path.  Since it's a relative path, it might be pointing to the wrong place.  What path does "../#TRIM(musiclink2.musiclink)#" translate to ?

BTW: Personally, I don't store the full url in the db. Just the file name or subdirectory and file name. That makes it easier to change paths in the web app.  

>> Answert to 2 is ??? don't really know

     If the path contains spaces you should encode the URL using the URLEncodedFormat
     function for best compatibility. ie #URLEncodedFormat(TheFileName)#.   Some browsers
     like IE may do this automatically. But others will just display an 404 - file not found error
     if the url isn't properly encoded.  That's not the problem you're having now, but good to
     keep in mind  :)


../MP3Audio/boxone/boxtwo/01 The Sutters of Selkirk.mp3 ... that looks right - compared with those which do work:-
../MP3Audio/boxone/01 The Sutters of Selkirk.mp3
../MP3Audio/01 The Sutters of Selkirk.mp3

Your point about not storing the fill url in the db is interesting  for me.  This project is not a green field one, and I am working with a Three level directory structure which stores the mp3's. This has 'evolved' over the years. I decided up front to not attempt retaining this directory structure, but went for a simple MP3Audio/xxx.mp3's  structure - all the mp3's in one directroy, flat.

The application has been completed now (just for your interest,  you can see a subset of it (not all mp3's) at this address - http://artsurligne.com/dance_project - would not have been possible to complete without your stardust sprinklings !!!

I am in the process of persuading my friend that he should not just forget about his multidirectory structure and settle with the flat one.  So the example above is an experiment.

It looks like Coldfusion just does not want to hand 3 deep directory (2 is ok, but 3 NO !!)

Ahh.. thats interesting !!

Again, this project is not a green field and its taking a hodge podge of MSACCESS tables and a 3 level deep directory structure which houses the mp3's. I have created new tables and in particular the table with the pointers to the mp3's which is, as you recommend, a single directory with the XXX.mp3.

BUT my friend is very attached to his multilevel directory structure for his MP3's and wants to retain that. I am in the process of trying to convince him that's not a good idea !! I am suggesting he keep is current mp3 repository, but for this app, he should also have a repository Folder/mp3's..  

ps, just for fun, attached is the small set of mp3's I am using  for this demo - if you fancy listening to a bit of scottish dane music that is !!
Most Valuable Expert 2015

Just back from the holiday after enjoying a little of the music samples :)  

>> Your point about not storing the fill url in the db is interesting  for me

You can if you prefer. However, it makes things more portable if you store only the file name OR the subdirectory path. ie It makes it easier if you ever move the music files for some reason.

>> It looks like Coldfusion just does not want to hand 3 deep directory (2 is ok, but 3 NO !!)

I don't see a reason why it shouldn't work. But again, with relative paths the most common problem is things aren't resolved correctly.  If you try the resulting URL in your browser does it work?


HI agx, glad you enjoyed the scottish music !!

To  your last question, yes it resolves correctly - I determine that by running the page and then looking at the page code via the browser. The level 3 was exactly the same as the level 1 and 2. Anyhow, I think its just one of those mysteries of Coldfusion - might be the combination of the weird .mp3 names and the level ?

Its no longer a problem and my friend has seen the light and is staying with the MP3AUDIO/xxx.mp3 pointer.

What is the approach to moving the MP3 directory  out from under the wwwroot to some other location on the same PC. Is the include function a   way to go ?

Thanks again for all the help !

Most Valuable Expert 2015
>> Is the include function a   way to go ?

Not really unless you're going to change the way you serve the files. Right now they're web accessible via a hyperlink.  So the mp3 directory can be anywhere you want, as long as the directory is web accessible and you update the URL paths if needed.

You could move the files to a non-web accessible directory, and serve them up with CFCONTENT. But that has some performance implications. Not to mention, it's a significant change from your current process.