No rest service for [/test/hello/world] found

Trying to get a REST component working and can’t get past the error.

I registered the virtual folder “test” with the physical main directory where the cfc is.
I created the cfc

<cfcomponent rest="true" restpath="/hello">
    <cffunction name="myHello" access="remote" returnType="String" httpMethod="get" restPath="/world">
        <cfset res="Hello World!">
        <cfreturn res>
    </cffunction>
</cfcomponent>

If I call http://[server]/rest I get

Available sevice mappings are:

  • /rest/test

If I try to call the function with http://[server]/rest/test/hello/world

I get

no rest service for [/test/hello/world] found

I’ve restarted the server to make sure the cfc was registering.

OS: Windows 10 64 bit
Java Version: 15.0.1 (Oracle Corporation) 64bit
Tomcat Version: Apache Tomcat/9.0.41
Lucee Version: 5.3.7.47

@isruther There is a related forum available,

Related mailing list: https://lucee.daemonite.io/t/enabling-rest-under-windows/7946

For more detail, RESTful Server - Part 1 - YouTube watch this video.

Watched the video and tried the solution at the other forum post (https://lucee.daemonite.io/t/lucee-rest-on-windows/6383/2). I still get the same error.

I’ve restarted both IIS and Lucee to make sure.

image

Were you able to hit the specific rest path directly on port 8888? What happens then?

I’d bet you are placing your rest component cfc in the wrong file location.

Where is the IIS wwwroot pointing to, and where is the tomcat context pointing to? They need to be the same. By default, Lucee points to path-to-Lucee-install/tomcat/webapps/ROOT and IIS default to an C:/inetpub/wwwroot .

If you are using mod_cfml, place an index.cfm file to the IIS wwwroot, hit it with the browser so mod_cfml creates the context in Tomcat. Wait a little and then try again hitting the rest path?

I tried matching the IIS root to the path to the Lucee app and then tried pointing both to path-to-Lucee-install/tomcat/webapps/ROOT and copying the cfc there. Both produce the same result.

To my previous question: what happens if you hit it directly on port 8888?

http://[server]:8888/rest/test/hello/world

The server is on port 8429 so, no, 8888 doesn’t do anything. I have a bunch of servers running in my development environment so I can’t just set them to the default.

ok…

so what happens when you go directly to port 8429 ?

If I go directly to server:8429 I get:

Page /index.cfm [[folder path]\Tomcat\webapps\ROOT\index.cfm] not found

The actual home directory is at server:8429/[root folder]

8429 is not Lucees default port.
So, again to my question above: What do you get if you request

http://[server]:8429/rest/test/hello/world

Do you still get Page /index.cfm [[folder path]\Tomcat\webapps\ROOT\index.cfm] not found?

If so, you haven’t set up a rest to run in that web context.

I get no rest service for [/test/hello/world] found.

Any other thoughts on this?

@isruther Can you try to create rest using application.cfc?

component {
this.name = “rest”;

restInitApplication( dirPath="fullpath",serviceMapping='rest',password='password' );

}

In the applicationonstart function?

I’m not sure I understand. You want me to create a new application that is just a component call to another server?

@isruther Just create an application.cfc in your rest path(component path). Use the rest service created by the application.cfc

I don’t understand the reasoning here. The rest path is on another server. If I create a new application.cfc there, how do I access the components that are in that folder differently by having this new component there?

I think now I can’t follow. You need to set up REST in the same web context you want them to be served. Since you haven’t been able to set it up through Lucee Administrator, @cfmitrah gave you a good alternative to set it up doing it through an Application.cfc ( without having to set it up in Lucee Web Administrator).

Maybe that is the cause of you getting the error “no rest service for [/test/hello/world] found.”? You are requesting a REST path were you haven’t any set up.

First you need to know in which web context you want to serve your REST and then set it up in the Administrator of that web context, or alternatively as @cfmitrah suggested.