loentar / ngrest

Fast and easy C++ RESTful WebServices framework
Apache License 2.0
464 stars 93 forks source link

NGREST service works iwith in built ngrest server, but returns "No service found to handle resource" with Apache web server on RHEL 8.4 #86

Closed raadiy closed 2 years ago

raadiy commented 2 years ago

Hi Dmitry,

Need a help in matching the "Location" directive in ngrest.conf of apache httpd with that defined in the C++ header source file. I have tried several combinations. The test runs as expected with the default web server that comes with ngrest, but when deployed on apache web server gives an error "No service found to handle resource " . Details are below.

I have defined NGREST service metatags in C++ header as given below:

//! TEST Resource server /! TEST resource server for TEST CRUD services / // *location: testMgmt class testres_svr: public ngrest::Service { public: testres_svr(); ~testres_svr();

    //! HTTP Get operation
    // *location: /{arg1}
    // *method: GET
    void getHandler(const std::string& arg1,
                    ngrest::MessageContext &context);

    //! HTTP Patch operation
    // *location: /
    // *method: PATCH
    void patchHandler(ngrest::MessageContext &msgCtx);

    //! HTTP POST operation
    // *location: /
    // *method: POST
    void postHandler(ngrest::MessageContext &msgCtx);

};

I have ngrest module running on Apache web server on RHEL 8.4. How should the "Location" directive be defined in ngrest.conf file

I have tried several values for Location, but everytime I get an error as given below:

E/02-04-2022 03:45:35.936 Deployment.cpp:65 deployAll: No services found W/02-04-2022 03:45:35.936 Engine.cpp:100 dispatchMessage: ServiceDispatcher.cpp:364 dispatchMessage : No service found to handle resource /voiceNetworkManagement/scpAddr

The following is the section in ngrest.conf.

# path to deploy ngrest services from ServicesPath /tester # filters path is optional. comment this line if you do not use filters FiltersPath /tester # location regex on which ngrest is bound. SetHandler ngrest

Any help will be appreciated.

Thanks Raajesh

raadiy commented 2 years ago

Among other things, I also verified that ServicesPath had all the shared objects used by the project... any help please?

raadiy commented 2 years ago

Hi Dmitry

More updates below, I tried to bring up Apache webserver for debugging ("httpd -X") and gathered the following logs. Can you please take a look and suggest...

[root@rhel-test-1 tmp]# cat ngrest.out D/05-04-2022 04:01:57.072 Deployment.cpp:84 deploy: Deploying service library: /testuser/favicon.so... D/05-04-2022 04:01:57.074 Deployment.cpp:120 deployStatic: Deploying service group name: ngrest D/05-04-2022 04:01:57.074 ServiceDispatcher.cpp:260 registerService: Registering service ngrest.Favicon V/05-04-2022 04:01:57.074 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /favicon.ico/ D/05-04-2022 04:01:57.074 ServiceDispatcher.cpp:325 registerService: Service ngrest.Favicon has been registered D/05-04-2022 04:01:57.074 Deployment.cpp:84 deploy: Deploying service library: /testuser/serverstatus.so... D/05-04-2022 04:01:57.076 Deployment.cpp:120 deployStatic: Deploying service group name: ngrest D/05-04-2022 04:01:57.076 ServiceDispatcher.cpp:260 registerService: Registering service ngrest.ServerStatus V/05-04-2022 04:01:57.076 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /ngrest/filters V/05-04-2022 04:01:57.076 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /ngrest/services V/05-04-2022 04:01:57.076 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /ngrest/service/{name} V/05-04-2022 04:01:57.076 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /ngrest/operation/{serviceName}/{operationName} D/05-04-2022 04:01:57.076 ServiceDispatcher.cpp:325 registerService: Service ngrest.ServerStatus has been registered D/05-04-2022 04:01:57.076 Deployment.cpp:84 deploy: Deploying service library: /testuser/testres_svr.so... D/05-04-2022 04:01:57.095 Deployment.cpp:120 deployStatic: Deploying service group name: D/05-04-2022 04:01:57.095 ServiceDispatcher.cpp:260 registerService: Registering service testres_svr V/05-04-2022 04:01:57.095 ServiceDispatcher.cpp:291 registerService: Registering resource: GET /testres_svr/{arg1} V/05-04-2022 04:01:57.095 ServiceDispatcher.cpp:291 registerService: Registering resource: PATCH /testres_svr/ V/05-04-2022 04:01:57.095 ServiceDispatcher.cpp:291 registerService: Registering resource: POST /testres_svr/ D/05-04-2022 04:01:57.095 ServiceDispatcher.cpp:325 registerService: Service testres_svr has been registered D/05-04-2022 04:01:57.095 Deployment.cpp:84 deploy: Deploying service library: /testuser/libngrestengine.so... W/05-04-2022 04:01:57.096 Deployment.cpp:74 deployAll: Can't load service: /testuser/libngrestengine.so: Failed to get symbol [ngrestPlugin]: /testuser/libngrestengine.so: undefined symbol: ngrestPlugin D/05-04-2022 04:01:57.096 Deployment.cpp:84 deploy: Deploying service library: /testuser/libngrestjson.so... W/05-04-2022 04:01:57.096 Deployment.cpp:74 deployAll: Can't load service: /testuser/libngrestjson.so: Failed to get symbol [ngrestPlugin]: /testuser/libngrestjson.so: undefined symbol: ngrestPlugin D/05-04-2022 04:01:57.096 Deployment.cpp:84 deploy: Deploying service library: /testuser/libngrestcommon.so... W/05-04-2022 04:01:57.096 Deployment.cpp:74 deployAll: Can't load service: /testuser/libngrestcommon.so: Failed to get symbol [ngrestPlugin]: /testuser/libngrestcommon.so: undefined symbol: ngrestPlugin D/05-04-2022 04:01:57.096 Deployment.cpp:84 deploy: Deploying service library: /testuser/libngrestutils.so... W/05-04-2022 04:01:57.096 Deployment.cpp:74 deployAll: Can't load service: /testuser/libngrestutils.so: Failed to get symbol [ngrestPlugin]: /testuser/libngrestutils.so: undefined symbol: ngrestPlugin D/05-04-2022 04:01:57.096 Deployment.cpp:84 deploy: Deploying service library: /testuser/libtestmsgdrv.so... W/05-04-2022 04:01:57.096 Deployment.cpp:74 deployAll: Can't load service: /testuser/libtestmsgdrv.so: Failed to get symbol [ngrestPlugin]: /testuser/libtestmsgdrv.so: undefined symbol: ngrestPlugin D/05-04-2022 04:01:57.096 Deployment.cpp:84 deploy: Deploying service library: /testuser/mod_ngrest.so... W/05-04-2022 04:01:57.096 Deployment.cpp:74 deployAll: Can't load service: /testuser/mod_ngrest.so: Failed to get symbol [ngrestPlugin]: /testuser/mod_ngrest.so: undefined symbol: ngrestPlugin D/05-04-2022 04:01:57.096 Deployment.cpp:84 deploy: Deploying service library: /testuser/ngrestmcswifilter.so... D/05-04-2022 04:01:57.096 Deployment.cpp:120 deployStatic: Deploying service group name: mcsWiFilterGroup E/05-04-2022 04:01:57.096 Deployment.cpp:141 deployStatic: Failed to deploy [mcsWiFilterGroup]. W/05-04-2022 04:01:57.096 Deployment.cpp:74 deployAll: Can't load service: /testuser/ngrestmcswifilter.so: Invalid argument: (wrapper) D/05-04-2022 04:01:57.096 Deployment.cpp:84 deploy: Deploying service library: /testuser/libngrestxml.so... W/05-04-2022 04:01:57.097 Deployment.cpp:74 deployAll: Can't load service: /testuser/libngrestxml.so: Failed to get symbol [ngrestPlugin]: /testuser/libngrestxml.so: undefined symbol: ngrestPlugin D/05-04-2022 04:01:57.097 Deployment.cpp:84 deploy: Deploying service library: /testuser/libngrestcgparser.so... W/05-04-2022 04:01:57.097 Deployment.cpp:74 deployAll: Can't load service: /testuser/libngrestcgparser.so: Failed to get symbol [ngrestPlugin]: /testuser/libngrestcgparser.so: undefined symbol: ngrestPlugin D/05-04-2022 04:01:57.097 Deployment.cpp:84 deploy: Deploying service library: /testuser/ngrestcgparser-cpp.so... D/05-04-2022 04:01:57.098 Deployment.cpp:120 deployStatic: Deploying service group name: cpp [root@rhel-test-1 tmp]#

Thanks Raajesh

raadiy commented 2 years ago

I was able to resolve this by keeping separate directories for ServicePath and FilterPath in ngrest.conf file. Thanks Raajesh