• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

404 Error - cannot connect to .cfm file?

New Here ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

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?

Views

9.5K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

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.

--

Adam

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

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:

http://tutorial54.easycfm.com/

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'' "

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

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?

~Day

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

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.

~Day

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

Obviously, these cfparams are just for troubleshooting. You're not going to want to leave them in place in production.

~Day

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

Hello,

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.


Best regards,

KR

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 17, 2012 Apr 17, 2012

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation