eclipse / org.eclipse.sensinact.gateway

Eclipse Public License 2.0
6 stars 12 forks source link

SensiNact Gateway Setup - 404 Not Found Error When Accessing via curl #400

Closed w4sk closed 1 month ago

w4sk commented 1 month ago

I tried to set up SensiNact following the documentation (https://eclipse-sensinact.readthedocs.io/en/latest/setup.html), but when I run curl http://localhost:8082/sensinact , I get a 404 Not Found error. (The same happens with curl http://localhost:8082/sensinact/providers/sensiNact/services/system/resources/version/GET .)

Details are as follows:

Environment

What I did

  1. Cloned the project repository (git clone git@github.com:eclipse/org.eclipse.sensinact.gateway.git)
  2. Compiled using the following command: mvn clean install
  3. Unzipped the generated zip file (/distribution/assembly/target/gateway.zip)
  4. Changed the permissions of start.sh using chmod +x start.sh

Setting up the HTTP REST northbound provider

  1. Edited the /configuration/configuration.json file and changed it to the following:
    {
    ":configurator:resource-version": 1,
    ":configurator:symbolic-name": "org.eclipse.sensinact.gateway.configuration",
    ":configurator:version": "0.0.1",
    "sensinact.launcher": {
        "features": [
            "core-feature",
            "jakarta-servlet-whiteboard-feature",
            "jakarta-rest-whiteboard-feature",
            "northbound-rest-feature"
        ],
        "repository": "repository",
        "featureDir": "features"
    },
    "org.apache.felix.http": {
        "org.osgi.service.http.port": 8082,
        "org.apache.felix.http.name": "sensiNact"
    },
    "JakartarsServletWhiteboardRuntimeComponent": {
        "osgi.jakartars.name": "sensiNact.rest",
        "osgi.http.whiteboard.target": "(org.apache.felix.http.name=sensiNact)"
    },
    "sensinact.northbound.rest": {
        "allow.anonymous": true,
        "osgi.jakartars.whiteboard.target": "(osgi.jakartars.name=sensiNact.rest)"
    }
    }
  2. ./start.sh
  3. Tried interacting with the gateway using curl commands. : curl http://localhost:8082/sensinact
  4. Recieved 404 Not Found
    
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
    <title>Error 404 Not Found</title>
    </head>
    <body><h2>HTTP ERROR 404 Not Found</h2>
    <table>
    <tr><th>URI:</th><td>/sensinact</td></tr>
    <tr><th>STATUS:</th><td>404</td></tr>
    <tr><th>MESSAGE:</th><td>Not Found</td></tr>
    <tr><th>SERVLET:</th><td>org.apache.felix.http.base.internal.dispatch.DispatcherServlet-3d6b25b7</td></tr>
    </table>



---
Please let me know if there's any additional information I should provide or anything else I should try. Thank you.
tcalmant commented 1 month ago

Hi,

A quick fix would be to remove the osgi.jakartars.whiteboard.target entry in the sensinact.northbound.rest configuration. That should let the Northbound REST endpoint be provided discovered by the Jakarta whiteboard component. We'll have to check why it doesn't work as expected.

Please let us know if this fixes your issue.

w4sk commented 1 month ago

Thank you very much. By your advice and making the changes to configuration.json, I was able to get a response of {"type":"COMPLETE_LIST","uri":"/","statusCode":200,"providers":[]} when running curl http://localhost:8082/sensinact . I appreciate your prompt assistance in resolving this issue.