Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native image tests works fine with 3.0.5 but fails with 3.1.0 #30518

Closed
phejl opened this issue May 22, 2023 · 4 comments
Closed

Native image tests works fine with 3.0.5 but fails with 3.1.0 #30518

phejl opened this issue May 22, 2023 · 4 comments
Labels
for: external-project Needs a fix in external project theme: aot An issue related to Ahead-of-time processing

Comments

@phejl
Copy link

phejl commented May 22, 2023

The tests fail with:

       org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:142)
       org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:127)
       org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:191)
       org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:130)
       org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:241)
       [...]
     Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxController': Unexpected AOP exception
       org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:605)
       org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
       org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
       org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
       org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
       [...]
     Caused by: org.springframework.aop.framework.AopConfigException: Unexpected AOP exception
       org.springframework.aop.framework.CglibAopProxy.buildProxy(CglibAopProxy.java:222)
       org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:158)
       org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
       org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor.postProcessAfterInitialization(AbstractAdvisingBeanPostProcessor.java:127)
       org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:434)
       [...]
     Caused by: java.lang.UnsupportedOperationException: CGLIB runtime enhancement not supported on native image. Make sure to include a pre-generated class on the classpath instead: com.xxx.XXXController$$SpringCGLIB$$42
       org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:359)
       org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:575)
       org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.lambda$new$1(AbstractClassGenerator.java:103)
       org.springframework.cglib.core.internal.LoadingCache.lambda$createEntry$1(LoadingCache.java:52)
       [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:264)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 22, 2023
@sbrannen sbrannen added the theme: aot An issue related to Ahead-of-time processing label May 23, 2023
@sbrannen
Copy link
Member

Hi @phejl,

That's unfortunately insufficient information for us to diagnose the issue.

Please provide a minimal sample that reproduces the issue, preferably something that we can download and run (for example, a ZIP file or a public Git repository).

Thanks

@sbrannen sbrannen added the status: waiting-for-feedback We need additional information before we can continue label May 23, 2023
@phejl
Copy link
Author

phejl commented May 23, 2023

@sbrannen Thank you. Yeah sure I'll try. I'm not done with that one yet :) Hopefully I'll get some clue. Proxies seem to be generated.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 23, 2023
@phejl phejl changed the title Application compiled to native image works fine with 3.0.5 but fails with 3.1.0 Native image tests works fine with 3.0.5 but fails with 3.1.0 May 23, 2023
@phejl
Copy link
Author

phejl commented May 24, 2023

@sbrannen Hm, afterall the underlying issue is this: #30525 (comment)

When org.springframework.boot.test.autoconfigure.web.servlet.SpringBootMockMvcBuilderCustomizer is registered for reflection the tests pass ok.

@sbrannen
Copy link
Member

Thanks for the feedback.

In light of that, I am closing this issue.

@sbrannen sbrannen closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2023
@sbrannen sbrannen added for: external-project Needs a fix in external project and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project Needs a fix in external project theme: aot An issue related to Ahead-of-time processing
Projects
None yet
Development

No branches or pull requests

3 participants