#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0

    REST CFC on Win7 and Apache


    Hello,

    Last night I spent 6 hours (no kidding) trying to get a hello world REST CFC to work and could not. Very disappointing. I have been using CF for 12 years and have been using Jersey for a year in java. There is so much conflicting information out there on setting this up that it is just hard to know which tutorial to believe.

    My environment is my Windows 7 PC running CF10 downloaded about 6 months ago coupled with Apache and for this test site I am listening on port 8080 and using a virtual host.

    I have tried every possible permutation of:
    Using and not using forward or backward slashes in restPath parameters.
    Moving my entire site underneath or outside of htdocs so it is within webroot.
    Putting "/" in my function resPath
    Having only one "Get" method in my CFC
    Refreshing CF app server a gazillion times
    Playing with mappings in CFadmin to have my CFC located
    Using CFAdmin or the function call to register the service
    Using the Application.cfc (this.name) in url calls
    If it is out there on the web I tried it last night!

    Nothing - SO VERY FRUSTRATING. Usually CF is plug and go but perhaps many kinds still in REST/CFC

    The url I am trying to use is:

    localhost:8080/rest/refdata/dropdowns

    Ultimately I want a REST service component I can make ajax calls to for reference data.

    Let's start with the basics, from the environment I have just described are there any known issues that would prevent this from working? Are there any patches I need for my CF10 from 6 months ago for running on Win7?

    thanks - I am trying to put together a prototype to present at my MAJOR telecomm company. They are not currently a CF shop but I believe so strongly in CF I want to get it going in there. This is disheartening though!
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,264
    Rep Power
    968
    I haven't used the REST CFCs in 10 yet. Would something like this tutorial help?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0
    Thank you for your reply. This is one of MANY tutorial/presentations I looked at last night trying to get his working. I also looked at Ray Camden's site a presentation by the Salt Lake users group, some Adobe "getting started" articles and many more.

    Again I want to ask if there have been patches put out that address any REST related issues, if running via virtual host on Apache on port 8080 should be OK (other normal page and CFC operations are fine), if the CFC MUST be within the web root (htdocs for me).

    Also many folks seem to be putting a call to the register function on each page request. Is that needed? I wouldn't think so but I keep seeing that popup too. Folks are putting calls to that function in Application.cfc on the request start.

    Judging by the number of posts I've found in these forums I wouldn't guess this has been highly adopted yet but I hope I'm wrong.

    Again - thanks to anybody who has any type of info for me on this. It is appreciated. If I can get this going it would be a major step in me selling CF into my LARGE workplace.
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,264
    Rep Power
    968
    On the patches question, I can't say for certain if this particular thing is in one of them, but there have been several updates for CF10 and you always should be running the most recent updates/hotfixes. If you aren't, the first thing I'd do is update.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0
    I found out what the issue was. I had two virtual hosts setup in my Apache httpd.conf file and one was interfering with the other I believe. I had one listening on port 80 for a site I maintain for a client of mine. The second one is listening on port 8080 and that is the test site where I've been trying to get REST going.

    Among other things I commented out the whole virtual directory for the site on port 80 and I now have some basic REST ops working off of port 8080.

    I just wanted to post quickly that I have a working configuration.

    Tonight when I have more time I will add one more post onto this thread to post what I feel is relevant information about my working configuration so others that read will see something that is working for me.
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0
    For anybody monitoring this post, apologies for not posting code / config info.

    As a final resolution I'm posting that the cause of my issues was rooted in how apache was involved in my environment. I have seen that 1 environment waffle back and forth between working and not working and have not isolated the exact issue but have a high confidence that it has to do with my web server config.

    The reason for this is that I stood up a completely separate environment and used the built in web server listening on the default port to test on and my REST CFC just worked immediately.

    I don't think it has to do with the port. Most likely something to do with virtual directories or pathing in some way.

IMN logo majestic logo threadwatch logo seochat tools logo