We are trying to use initialize Platform API in our lambda function which is running outside of cumulocity environment.
We’re getting below error when trying to initialize the PlatformImpl
Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/core/MediaType
what is your java version here used to run springboot?
Are you aware of the fact that some classes have been moved from the javax namespace (used by Oracle/SUN) to the jakarta namespace (used by Apache/Jakarta)?
One idea might be to check with springboot if there is a version, which is compatible with above mentioned namespace change.
can you explore the class PlatformImpl, if it is referencing the right imports?
Beginninng with SpringBoot 3, it should support the new JakartaEE 9.x specs with the new namespaces jakarta.* instead of the old JavaEE 8 namespaces javax.*.
You can perform a search on the web with “javax jakarta” or similar queries to determine why the namespaces had to be changed.
It might be helpful to provide more informations about the platform impl.
You might want to check with C8Y support if they already support or plan to support JakartaEE 9.x with which version of C8Y.
Addendum:
You might want to check if you need to upgrade your cumulocity client to a 10.20 version.
In latest versions the PlatformImpl class cannot be used directly anyway anymore, hence you should follow the Spring Boot Bean injection principles to use the SDK and its beans, e.g. just inject “InventoryApi” instead of using the “PlatformImpl” class.
There’s also a link with a sample repository that shows how to use these beans instead of the PlatformImpl class.