The problem has been solved. Basically, you have to send each request through index.cfm. So, if you pass an url like localhost:8888/index.cfm/hello/wow you will not encounter an error and the requested url can be fetched using CGI.REQUEST_URL (e.g. /hello/wow).
Moreover, if you want to remove index.cfm marker you have to enable URL rewrite. Then the url (localhost:8888/hello/wow) will work without throwing any error.
For URL rewrite refer to these,