HotswapProjects / HotswapAgent

Java unlimited redefinition of classes at runtime.
GNU General Public License v2.0
2.32k stars 489 forks source link

V2.0.0: Error on startup with Spring Boot 3 / Spring 6 application #581

Open askpythia opened 1 week ago

askpythia commented 1 week ago

I use the Version 2.0.0 of the hotswap plugin with spring boot 3 / spring 6 and i get the following errors on startup:

HOTSWAP AGENT: 22:13:42.956 ERROR (org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent) - failed to convert filePath file:/D:/Pools/.m2/repository/org/springframework/security/spring-security-config/6.2.4/spring-security-config-6.2.4.jar!/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfiguration.class to classPath path HOTSWAP AGENT: 22:13:42.957 ERROR (org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent) - failed to convert filePath file:/D:/Pools/.m2/repository/org/springframework/security/spring-security-config/6.2.4/spring-security-config-6.2.4.jar!/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfiguration.class to classPath path HOTSWAP AGENT: 22:13:42.957 ERROR (org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent) - failed to convert filePath file:/D:/Pools/.m2/repository/org/springframework/security/spring-security-config/6.2.4/spring-security-config-6.2.4.jar!/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfiguration.class to classPath path HOTSWAP AGENT: 22:13:42.957 ERROR (org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent) - failed to convert filePath file:/D:/Pools/.m2/repository/org/springframework/security/spring-security-config/6.2.4/spring-security-config-6.2.4.jar!/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfiguration.class to classPath path HOTSWAP AGENT: 22:13:42.957 ERROR (org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent) - failed to convert filePath file:/D:/Pools/.m2/repository/org/springframework/security/spring-security-config/6.2.4/spring-security-config-6.2.4.jar!/org/springframework/security/config/annotation/method/configuration/SecuredMethodSecurityConfiguration.class to classPath path HOTSWAP AGENT: 22:13:42.957 ERROR (org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent) - failed to convert filePath file:/D:/Pools/.m2/repository/org/springframework/security/spring-security-config/6.2.4/spring-security-config-6.2.4.jar!/org/springframework/security/config/annotation/method/configuration/Jsr250MethodSecurityConfiguration.class to classPath path

a short time later:

Description: An attempt was made to call a method that does not exist. The attempt was made from the following location: org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent.registerXmlBeanDefinitionScannerAgent(XmlBeanDefinitionScannerAgent.java:99) The following method did not exist: 'org.springframework.beans.factory.support.BeanDefinitionRegistry org.springframework.beans.factory.xml.XmlBeanDefinitionReader.getBeanFactory()'

Is the spring plugin not compatible with spring boot 3 / spring 6? I also use Vaadin 24.

skybber commented 1 week ago

It supports 1.x, 2.x, look at https://github.com/HotswapProjects/HotswapAgent/tree/master/plugin/hotswap-agent-spring-boot-plugin

@cvictory could you help please?

Jeetah commented 1 week ago

Could this also be the reason for those errors:

HOTSWAP AGENT: 13:47:04.378 ERROR (org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent) - failed to convert filePath file:/Users/.../.gradle/caches/modules-2/files-2.1/org.springframework.security/spring-security-config/6.3.1/e4f6c1cf4f8969c9e5ed26121f0fbd7ee35a7ca4/spring-security-config-6.3.1.jar!/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfiguration.class to classPath path HOTSWAP AGENT: 13:47:04.379 ERROR (org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent) - failed to convert filePath file:/Users/.../.gradle/caches/modules-2/files-2.1/org.springframework.security/spring-security-config/6.3.1/e4f6c1cf4f8969c9e5ed26121f0fbd7ee35a7ca4/spring-security-config-6.3.1.jar!/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfiguration.class to classPath path HOTSWAP AGENT: 13:47:04.379 ERROR (org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent) - failed to convert filePath file:/Users/.../.gradle/caches/modules-2/files-2.1/org.springframework.security/spring-security-config/6.3.1/e4f6c1cf4f8969c9e5ed26121f0fbd7ee35a7ca4/spring-security-config-6.3.1.jar!/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfiguration.class to classPath path HOTSWAP AGENT: 13:47:04.379 ERROR (org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent) - failed to convert filePath file:/Users/.../.gradle/caches/modules-2/files-2.1/org.springframework.security/spring-security-config/6.3.1/e4f6c1cf4f8969c9e5ed26121f0fbd7ee35a7ca4/spring-security-config-6.3.1.jar!/org/springframework/security/config/annotation/method/configuration/PrePostMethodSecurityConfiguration.class to classPath path HOTSWAP AGENT: 13:47:04.379 ERROR (org.hotswap.agent.plugin.spring.files.XmlBeanDefinitionScannerAgent) - failed to convert filePath file:/Users/.../.gradle/caches/modules-2/files-2.1/org.springframework.security/spring-security-config/6.3.1/e4f6c1cf4f8969c9e5ed26121f0fbd7ee35a7ca4/spring-security-config-6.3.1.jar!/org/springframework/security/config/annotation/method/configuration/AuthorizationProxyConfiguration.class to classPath path

Followed by this NPE afterwards:

java.lang.NullPointerException: Cannot invoke "org.hotswap.agent.plugin.spring.reload.BeanFactoryAssistant.isReload()" because the return value of "org.hotswap.agent.plugin.spring.reload.BeanFactoryAssistant.getBeanFactoryAssistant(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)" is null at org.hotswap.agent.plugin.spring.core.BeanFactoryProcessor.postProcessDestroySingleton(BeanFactoryProcessor.java:63) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:560) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1202) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:520) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1195) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1195) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:638) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) at org.springframework.boot.test.context.SpringBootContextLoader.lambda$loadContext$3(SpringBootContextLoader.java:137) at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58) at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46) at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1463) at org.springframework.boot.test.context.SpringBootContextLoader$ContextLoaderHook.run(SpringBootContextLoader.java:553) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:137) at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:108) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:225) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:152) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:130) at org.springframework.test.context.junit.jupiter.SpringExtension.getApplicationContext(SpringExtension.java:355) at org.springframework.test.context.junit.jupiter.SpringExtension.resolveParameter(SpringExtension.java:341) at org.junit.jupiter.engine.execution.ParameterResolutionUtils.resolveParameter(ParameterResolutionUtils.java:136) at org.junit.jupiter.engine.execution.ParameterResolutionUtils.resolveParameters(ParameterResolutionUtils.java:103) at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:59) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestClassConstructor(ClassBasedTestDescriptor.java:364) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateTestClass(ClassBasedTestDescriptor.java:311) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateTestClass(ClassTestDescriptor.java:79) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:287) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:279) at java.base/java.util.Optional.orElseGet

Jeetah commented 5 days ago

Are there any plans to support Spring 3 in the near future? Cause using the Sprinter IntelliJ plugin with the Hotswap agent speeds up local testing a lot...