ArcadeData / arcadedb

ArcadeDB Multi-Model Database, one DBMS that supports SQL, Cypher, Gremlin, HTTP/JSON, MongoDB and Redis. ArcadeDB is a conceptual fork of OrientDB, the first Multi-Model DBMS. ArcadeDB supports Vector Embeddings.
https://arcadedb.com
Apache License 2.0
505 stars 63 forks source link

undertow-servelet upgrade causes spring boot error #1846

Open unimaginativeusername opened 3 days ago

unimaginativeusername commented 3 days ago

ArcadeDB Version:

24.6.1 - 24.11.1

OS and JDK Version:

JDK 21

Expected behavior

Application should start

Actual behavior

Applicationbfails to start.

Steps to reproduce

Spring Boot project with dependencies

       <dependency>
            <groupId>com.arcadedb</groupId>
            <artifactId>arcadedb-gremlin</artifactId>
            <version>24.6.1</version>
        </dependency>
        <dependency>
            <groupId>com.arcadedb</groupId>
            <artifactId>arcadedb-server</artifactId>
            <version>24.11.1</version>
        </dependency>

fails, with an error:

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-11-30T18:44:26.382+01:00 ERROR 62695 --- [demo] [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration.characterEncodingFilter
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60) ~[spring-boot-autoconfigure-3.4.0.jar:3.4.0]
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:99) ~[spring-context-6.2.0.jar:6.2.0]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:184) ~[spring-context-6.2.0.jar:6.2.0]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:145) ~[spring-context-6.2.0.jar:6.2.0]
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:121) ~[spring-context-6.2.0.jar:6.2.0]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:430) ~[spring-context-6.2.0.jar:6.2.0]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:290) ~[spring-context-6.2.0.jar:6.2.0]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349) ~[spring-context-6.2.0.jar:6.2.0]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118) ~[spring-context-6.2.0.jar:6.2.0]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:791) ~[spring-context-6.2.0.jar:6.2.0]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:609) ~[spring-context-6.2.0.jar:6.2.0]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.4.0.jar:3.4.0]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) ~[spring-boot-3.4.0.jar:3.4.0]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-3.4.0.jar:3.4.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:318) ~[spring-boot-3.4.0.jar:3.4.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361) ~[spring-boot-3.4.0.jar:3.4.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350) ~[spring-boot-3.4.0.jar:3.4.0]
    at com.example.demo.DemoApplication.main(DemoApplication.java:21) ~[classes/:na]
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration$UndertowWebServerFactoryCustomizerConfiguration] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@4e0e2f2a]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:483) ~[spring-core-6.2.0.jar:6.2.0]
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:360) ~[spring-core-6.2.0.jar:6.2.0]
    at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:417) ~[spring-core-6.2.0.jar:6.2.0]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$1(AbstractAutowireCapableBeanFactory.java:751) ~[spring-beans-6.2.0.jar:6.2.0]
    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) ~[na:na]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:750) ~[spring-beans-6.2.0.jar:6.2.0]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:683) ~[spring-beans-6.2.0.jar:6.2.0]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:654) ~[spring-beans-6.2.0.jar:6.2.0]
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1683) ~[spring-beans-6.2.0.jar:6.2.0]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:592) ~[spring-beans-6.2.0.jar:6.2.0]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:564) ~[spring-beans-6.2.0.jar:6.2.0]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanDefinitionsForType(OnBeanCondition.java:311) ~[spring-boot-autoconfigure-3.4.0.jar:3.4.0]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanDefinitionsForType(OnBeanCondition.java:303) ~[spring-boot-autoconfigure-3.4.0.jar:3.4.0]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanDefinitionsForType(OnBeanCondition.java:293) ~[spring-boot-autoconfigure-3.4.0.jar:3.4.0]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:219) ~[spring-boot-autoconfigure-3.4.0.jar:3.4.0]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.evaluateConditionalOnMissingBean(OnBeanCondition.java:196) ~[spring-boot-autoconfigure-3.4.0.jar:3.4.0]
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:143) ~[spring-boot-autoconfigure-3.4.0.jar:3.4.0]
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-3.4.0.jar:3.4.0]
    ... 17 common frames omitted
Caused by: java.lang.NoClassDefFoundError: io/undertow/servlet/api/DeploymentInfo
    at java.base/java.lang.Class.getDeclaredMethods0(Native Method) ~[na:na]
    at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3578) ~[na:na]
    at java.base/java.lang.Class.getDeclaredMethods(Class.java:2676) ~[na:na]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465) ~[spring-core-6.2.0.jar:6.2.0]
    ... 34 common frames omitted
Caused by: java.lang.ClassNotFoundException: io.undertow.servlet.api.DeploymentInfo
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[na:na]
    ... 38 common frames omitted

Process finished with exit code 1

If you force the version to its previous state using

        <dependency>
            <groupId>io.undertow</groupId>
            <artifactId>undertow-servlet</artifactId>
            <version>2.3.17.Final</version>
        </dependency>

in the project pom, the application boots and runs as expected.

Change: https://github.com/ArcadeData/arcadedb/pull/1707

Not quite certain when and how this happened, we were on 24.6.1 initially, and it used to work with the same two dependencies in that version. After a recent refresh and re-start, things failed and we couldn't trace any changes on our end,

Upgrading to the most recent Arcade release saw no changes, the forced dependcy downgrde works on 24.11.1

robfrank commented 3 days ago

hi! Our next version will use 2.3.18.Final: can you try to forse this version and see what happens?

Some questions:

Thanks in advance.

unimaginativeusername commented 3 days ago

I have no idea why Arcade 24.6.1 uses undertow 2.3.18 on my system. I could replicate it with a new SpringBoot Maven project that had no other imports.

On Arcade 24.11.1 it uses undertow 2.3.18 by default with the same error. If I force the version to .18 by including it it in the POM.xml , the pp launches again.

1) I am accessing a standalone server and not 100% certain if the dependency is needed. But I should be able to include it either way,

2) attached file should be enough?

demo.zip

Additional information: I am fairly certain I made no relevant changes to the project setup before the error occurred, other than re-building, possibly flushing the cache, etc.

robfrank commented 3 days ago

if you are accessing a standalone server using RemoteDatabase you don't need arcadedb-server nor gremlin on the client side (your appplication is the client) and the only dependency you need is arcadedb-network.

If you are using arcadedb in embedded way, arcadedb-engine is the dependency to go.

Arcadedb-server allows you to execute a standalone DB and includes undertow as its own http server. If this is not your use case, switch to one of the options suggested above.

BTW, the demo you provided starts without any issue .