LWM2M implementation on Spring boot java application

340 views Asked by At

We have an application on java springboot which would interact with IoT devices via HTTP Rest API. However, there is an IoT device that communicates with the LWM2M protocol. So, I need to set up an LWM2M server and make the application an LWM2M client. First I wanted to make a prototype on my local machine running application on Windows with eclipse ide. I tried importing the Leshan project from this link on eclipse workspace. However when maven clean install, it is not creating a jar file for every project. Attaching the result at eclipse console, when I do maven clean install.result of maven clean install. My ask is:

  1. Am I going the right way, in order to implement the LWM2M protocol locally?
  2. How to resolve all jars not creating with Maven clean Install.
3

There are 3 answers

0
eliasw On BEST ANSWER

Our commercial LWM2M offering that is part of Cumulocity IoT in fact is a Spring Boot application which includes Leshan. So you are definitely on the right track.

While I am not able to disclose internals, I am happy to provide you some pointers how to get this flying.

  1. In your pom.xml, declare the needed Leshan dependencies, for example:

        <dependency>
                 <groupId>org.eclipse.leshan</groupId>
                 <artifactId>leshan-core</artifactId>
                 <version>2.0.0-M9</version>
             </dependency>
             <dependency>
                 <groupId>org.eclipse.leshan</groupId>
                 <artifactId>leshan-server-core</artifactId>
                 <version>2.0.0-M9</version>
             </dependency>
             <dependency>
                 <groupId>org.eclipse.leshan</groupId>
                 <artifactId>leshan-server-cf</artifactId>
                 <version>2.0.0-M9</version>
             </dependency>
             <dependency>
                 <groupId>org.eclipse.leshan</groupId>
                 <artifactId>leshan-server-redis</artifactId>
                 <version>2.0.0-M9</version>
             </dependency>
             <dependency>
                 <groupId>org.eclipse.californium</groupId>
                 <artifactId>californium-core</artifactId>
                 <version>3.7.0</version>
             </dependency>
             <dependency>
                 <groupId>org.eclipse.californium</groupId>
                 <artifactId>scandium</artifactId>
                 <version>3.7.0</version>
             </dependency>
    
  1. I assume you know how to set up a Spring Boot application using maven. If not, this tutorial shows precisely how it can be done.

  2. In your spring boot application you then can construct a LeshanServer object and accept LWM2M traffic. Have a look at the leshan-server-demo maven module in the Eclipse Leshan source code on how to do that.

0
Rajnish On

I have skipped the integration testing by commenting its dependency in the pom file. Then all other modules got compiled.

0
Achim Kraus On

Questions about build issues get much better help and answers, if you use Eclipse/Leshan - github issues. Not all open-source projects are watching stackoverflow and so you can get a "first hand first class" answers only there.