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

Cannot register RESTful service

New Here ,
Mar 06, 2013 Mar 06, 2013

Copy link to clipboard

Copied

I'm running CF 10 Developer (64-bit) (using IIS) on top of Windows 2008R2 (64-bit). This server is running in a Virtualbox VM on my Windows 7 Pro (64-bit) workstation.

Everytime I attempt to add a RESTful service (even the most minimalistic), I get an error.

For instance, this very simple CFC:

/RestExample/HelloWorld.cfc

<cfcomponent rest="true" restPath="/hello">

        <cffunction name="sayHello" access="remote" returnType="String" httpMethod="GET">

                 <cfset res="Hello World">

                 <cfreturn res>

        </cffunction>

</cfcomponent>

I then proceed to register the service in CF admin:

Root Path: C:/websites/test/RestExample/

Service Mapping: Example

This will produce this error:

Error registering REST service. Please ensure that you have entered a proper mapping and path.

Application Example could not be initialized.

Reason: The application does not contain any rest enabled CFCs.

The application does not contain any rest enabled CFCs.

Note, if I run the following code, it will add the service.

<cfscript>

restInitApplication(getDirectoryFromPath(getCurrentTemplatePath()).concat("main\"), "Example");

<cfscript>

However, when I attempt to reach the service using its URL, I get the following error:

"Error","ajp-bio-8012-exec-4","03/01/13","16:51:58","RestSample","object is not an instance of declaring class

Funny enough, this same code worked when I installed CF10 64-bit on my other Windows 7 64-bit workstation without any issue. I wasn't going through IIS in this case (not that I think it makes a difference).

Views

4.1K

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 ,
Mar 11, 2013 Mar 11, 2013

Copy link to clipboard

Copied

Two things here.

First of all if you are not able to register REST service from Administrator and it's giving errors like "No CFC found" OR "some problem with CFC",

then my suggestion is you try to access the cfc directly in browser as you would access any cfm.

This will tell you if there are any errors with your cfc or not.

Secondly, whenever you see this error  "obje ct is not an instance of declaring class", please refresh your service, either from Admin or from function and see if there is any error or not. If there is any error please rectify it and try again to refresh. Once refreshed succesfully, you will be able to call your REST service.

Thanks,

Milan.

CF Engineering Team.

Votes

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 ,
Mar 12, 2013 Mar 12, 2013

Copy link to clipboard

Copied

I was able to navigate to the cfc without any errors.

I also tried to refresh/recreate my service and kept getting that error. My install must be foobar, this is too simple not to work (even though, I did reinstall once already).

Votes

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 ,
Mar 13, 2013 Mar 13, 2013

Copy link to clipboard

Copied

Do you have access to ColdFusion webroot, if so then can you try to setup REST in ColdFusion webroot instead of IIS webroot.

Make a folder in ColdFusion webroot, put your REST CFC there, try to access it in browser and then register a REST service(use different name) in Admin.

This will help to nail down the issue, we will get to know if it's related to webserver.

Votes

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 ,
Mar 13, 2013 Mar 13, 2013

Copy link to clipboard

Copied

mchandna wrote:

Do you have access to ColdFusion webroot, if so then can you try to setup REST in ColdFusion webroot instead of IIS webroot.

Make a folder in ColdFusion webroot, put your REST CFC there, try to access it in browser and then register a REST service(use different name) in Admin.

This will help to nail down the issue, we will get to know if it's related to webserver.

OMG, this works!

What is the difference between putting the files under an IIS website root folder vs Coldfusion wwwroot? An AppPool issue/rights?

Votes

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 ,
Mar 20, 2013 Mar 20, 2013

Copy link to clipboard

Copied

Creating REST Service in your ColdFusion root or connector(IIS) webroot shouldn't matter actually untill and unless your connector is properly configured.

Can you reconfigure you connector again with admin rights and then try to create REST Service in connector webroot.

Also try to give all access to the REST folder.

Votes

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 ,
Mar 13, 2013 Mar 13, 2013

Copy link to clipboard

Copied

Out of curiosity do you have "Case Sensitivity for File and Folder Names" turned on for your Windows 2008 R2 VM?

I just had a very similar problem migrating a REST service from my Windows dev box to a Linux staging server.  What resolved the issue for me was changing the file name to all lower case. i.e.: > mv HelloWorld.cfc helloworld.cfc

Votes

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 ,
Mar 13, 2013 Mar 13, 2013

Copy link to clipboard

Copied

mootinat0r wrote:

Out of curiosity do you have "Case Sensitivity for File and Folder Names" turned on for your Windows 2008 R2 VM?

I just had a very similar problem migrating a REST service from my Windows dev box to a Linux staging server.  What resolved the issue for me was changing the file name to all lower case. i.e.: > mv HelloWorld.cfc helloworld.cfc

I changed to all lower case and I still get the same error. What about permissions? I'm running out of ideas.

Votes

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 ,
Jan 02, 2019 Jan 02, 2019

Copy link to clipboard

Copied

LATEST

you may need to add service mapping ..even though it is mentioned as optional,if you dont have an application.cfc file with your rest component at the root folder of webserver then service mapping is mandatory.ie,either you need an application.cfc to mention service mapping or you need to specify it in the cfadmin.

i am a beginer in coldfusion so if i am wrong or need anything to add,please feel free to suggest the same.

Votes

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