Search code examples
javaspring-bootrfidoctane-sdk

How to implement Impinj Octane SDK with Springboot?


I'm working with Impinj Octane SDK 3.7.0 and Java Spring boot. I want to import the package to my solution, but I'm finding several problems with it. This is what I have done so far:

mvn install:install-file -Dfile=OctaneSDKJava-3.7.0.0-jar-with-dependencies.jar -DgroupId=com.impinj -DartifactId=octane -Dversion=3.7.0.0 -Dpackaging=jar

It builds succesfully, and I can use Octane SDK's classes but when I run the programme, then appears the following error:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration$StandardGsonBuilderCustomizer.customize(GsonAutoConfiguration.java:90)

The following method did not exist:

'com.google.gson.GsonBuilder com.google.gson.GsonBuilder.setLenient()'

The method's class, com.google.gson.GsonBuilder, is available from the following locations:

jar:file:/C:/Users/hyc/.m2/repository/com/impinj/octane/3.7.0.0/octane-3.7.0.0.jar!/com/google/gson/GsonBuilder.class

The class hierarchy was loaded from the following locations:

com.google.gson.GsonBuilder: file:/C:/Users/hyc/.m2/repository/com/impinj/octane/3.7.0.0/octane-3.7.0.0.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of com.google.gson.GsonBuilder

What should in order to make it work??


Solution

  • I finally found the solution, I only had to add the latest gson dependency into the pom.xml file:

            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>2.8.5</version>
            </dependency>