I'm creating a guest book/mini blog type application with ColdFusion.
After writing it all, I thought it'd be working fairly well.
However I go to the page (addpost.cfm), it works, I type in the details for a test post and click submit. It goes to the processing page and I receive a 404:
"The website encountered an error while retrieving http://localhost:8500/blog/addpost_process.cfm. It may be down for maintenance or configured incorrectly."
But I can connect to it, when I navigate to that URL without going through the addpost.cfm page it loads fine (although I receive an error because I haven't submitted any information from addpost.cfm).
So why would this be happening? I know I haven't provided much information, I can't post any of the code here.
Would it be a database connection error? Why wouldn't it be able to find addpost_process.cfm through addpost.cfm, but if I navigate to it manually it works?
Just as a test, change your form method to a GET and see what happens.
Could you possibly have some rewrite rule in place that tampers with POST requests? Admittedly this seems unlikely as it looks like you're just using the inbuilt JRun webserver, but I figured it was worth asking.
Thanks for the help, it didn't seep to make a difference though. Yes I am building the inbuilt server.
If it helps, my code is slightly based off of this tutorial:
addpost_process.cfm = addentry_action.cfm in the tutorial.
addpost.cfm = addentry.cfm in the tutorial.
The only thing displayed in the error log is:
Error","web-14","04/17/12","21:51:44","blog","'' The specific sequence of files included or processed is: C:\ColdFusion9\wwwroot\blog\addpost_process.cfm'' "
Are you sure it's a 404? The error message looks more like a 500. So here's a thought: You say you are able to request the page directly but you get a regular CF error because there was no form submitted to your handler code. In that case, you could cfparam your form fields to simulate the form submission and then hit the page directly and see what happens. The "correct" execution of the code in addpost_process.cfm might actually be crashing the CF server (so then you'd see the error 500). Then CF auto-restarts so you're not aware that it crashed. Have you checked your cfserver.log?
Thanks, it is a 500 error.
I took your advice, added the cfparams and now when I go directly to addpost_process.cfm I recieve the error page that I set (a page that just says "You left a field blank") rather than the ColdFusion error page that said "Element is undefined in FORM". So that's a plus, however the form still wont submit if I try it, I still recieve the 500 error.
I checked the server log, no entries since the last time I turned my computer on.
Alright, so, if I were you I would cfparam the form fields to the sort of values that you would actually submit if you were submitting the form (i.e. non-blank values most likely). I advise that you do this so you can avoid the "You left a field blank" message and the rest of your script will execute, possibly triggering the expected error 500. Also, you should look in cfserver.log where you will find quite a bit more detailed information than in server.log.
Have you turned ColdFusion debugging on for your local IP address? That will sometimes provide lots and lots of useful information to help with troubleshooting issues.
That way you can verifiy exactly what fields/values are being passed. It will also show what pages were parsed to generate your error page.
I never use the built in web server because I like a bit more control over things. I usually setup a virtual directory in IIS and a ColdFusion mapping so I can add a little more direction to where my pages are going. It's not essential, but it is sometimes nice to use all of the tools availalble to your advantage.
Thanks for all the help, a few of you helped solve other problems. It turns out the main cause was a comma where there shouldn't be one, I must have missed it when I went through the code. Thank you all.
Europe, Middle East and Africa