Compatibility issues not noted between Okta Java SDK and Okta Spring SDK

Hi there,

I currently have okta-sdk-api, okta-sdk-impl, and okta-sdk-httpclient at version 1.6.0 (the Okta Java SDK) and I have okta-spring-sdk at version 1.4.0. I just tried upgrading the Okta Java SDK to 2.0.0 and I ended up getting the error below. In short, looks like it’s a Caused by: java.lang.NoClassDefFoundError: com/okta/sdk/client/Proxy. Upon closer inspection on the Okta Java SDK javadoc, looks like there’s no * com.okta.sdk.client.Proxy class in 2.0.0 but there is in 1.6.0. I can’t seem to find any documentation on which versions of the Okta Java SDK and the Okta Spring SDK are compatible with each other. Someone asked a similar question two weeks ago. Any help?

Full log below.

Caused by: java.lang.IllegalStateException: Error processing condition on com.okta.spring.boot.sdk.OktaSdkConfig.oktaSdkClientCredentials

at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]

at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:184) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:144) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE]

at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:120) ~[spring-boot-test-2.3.4.RELEASE.jar:2.3.4.RELEASE]

at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ~[spring-test-5.2.9.RELEASE.jar:5.2.9.RELEASE]

... 65 common frames omitted

Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.okta.spring.boot.sdk.OktaSdkConfig] from ClassLoader [sun.misc.Launcher$AppClassLoader@3d646c37]

at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:742) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_242]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:741) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:680) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:648) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1614) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:523) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:495) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]

at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:238) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]

at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:231) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]

at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:221) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]

at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:169) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]

at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:144) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]

at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]

... 82 common frames omitted

Caused by: java.lang.NoClassDefFoundError: com/okta/sdk/client/Proxy

at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_242]

at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_242]

at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_242]

at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]

... 98 common frames omitted

Caused by: java.lang.ClassNotFoundException: com.okta.sdk.client.Proxy

at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_242]

at java.lang.ClassLoader.loadClass(ClassLoader.java:419) ~[na:1.8.0_242]

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) ~[na:1.8.0_242]

at java.lang.ClassLoader.loadClass(ClassLoader.java:352) ~[na:1.8.0_242]

... 102 common frames omitted

Hey @kapple!

Currently, the Okta Spring Boot Starter only works with the 1.x line of the Okta SDK. We are currently working this and will be putting out a v2 of the Okta Spring Boot Starter to address this.

Until then you have a couple of different options:

  • Continue 1.x version of the Okta SDK in the short term
  • Remove the SDK bits of the starter by excluding com.okta.spring:okta-spring-sdk dependency

NOTE: This last option would also remove the related autowiring of the SDK Client object.

I’ll also add a note to the project readme stating that the 1.x version is currently supported. That said, we recommend using the version of the SDK that is pulled in automatically.

Keep us posted!
-Brian

1 Like

The Okta Spring Boot Starter v2 has been released and resolves this problem.
Keep us posted!

-Brian

2 Likes

Thank you for the help!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.