Skip navigation
Currently Being Moderated

404 Error - cannot connect to .cfm file?

Apr 17, 2012 5:11 AM

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?

 
Replies
  • Currently Being Moderated
    Apr 17, 2012 5:33 AM   in reply to Abidubbah

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2012 11:24 AM   in reply to Abidubbah

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2012 12:53 PM   in reply to Abidubbah

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2012 12:55 PM   in reply to Abidubbah

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

     

    ~Day

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2012 2:55 PM   in reply to Abidubbah

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points