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

Migration from 2.0.0-M2 to newer version #1083

Closed
lugolu opened this issue Oct 11, 2024 · 2 comments
Closed

Migration from 2.0.0-M2 to newer version #1083

lugolu opened this issue Oct 11, 2024 · 2 comments

Comments

@lugolu
Copy link

lugolu commented Oct 11, 2024

Serverless Java Container version: >=2.0.0

Implementations: Spring Boot 3

Framework version: SpringBoot 3.2.2.RELEASE

Frontend service: REST API

Deployment method: SAM

Java: 17 (i've tried updating to 21, according on template is used runtime 21 instead of runtime 17. and same error)

Scenario

I'm trying to migrate an existing lambda from 2.0.0-M2 to a newer version. I've tried all versiones from 2.0.0 to 2.0.3.

Expected behavior

Project should compile and tests executed ok.

Actual behavior

I'm getting cast errors when tests are executed.

Full log output

2024-10-11T12:49:27.104-03:00  WARN 31968 --- [           main] o.s.w.c.s.GenericWebApplicationContext   : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletWebServerFactory' defined in class path resource [org/springframework/cloud/function/serverless/web/ServerlessAutoConfiguration.class]: class org.springframework.web.context.support.GenericWebApplicationContext cannot be cast to class org.springframework.boot.web.context.ConfigurableWebServerApplicationContext (org.springframework.web.context.support.GenericWebApplicationContext and org.springframework.boot.web.context.ConfigurableWebServerApplicationContext are in unnamed module of loader 'app')
2024-10-11T12:49:27.114-03:00  INFO 31968 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-10-11T12:49:27.139-03:00 ERROR 31968 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletWebServerFactory' defined in class path resource [org/springframework/cloud/function/serverless/web/ServerlessAutoConfiguration.class]: class org.springframework.web.context.support.GenericWebApplicationContext cannot be cast to class org.springframework.boot.web.context.ConfigurableWebServerApplicationContext (org.springframework.web.context.support.GenericWebApplicationContext and org.springframework.boot.web.context.ConfigurableWebServerApplicationContext are in unnamed module of loader 'app')
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:606) ~[spring-beans-6.1.3.jar:6.1.3]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) ~[spring-beans-6.1.3.jar:6.1.3]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.1.3.jar:6.1.3]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.1.3.jar:6.1.3]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.1.3.jar:6.1.3]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.1.3.jar:6.1.3]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975) ~[spring-beans-6.1.3.jar:6.1.3]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:959) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624) ~[spring-context-6.1.3.jar:6.1.3]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.2.jar:3.2.2]

@deki
Copy link
Collaborator

deki commented Oct 16, 2024

Hi, thanks for your issue report. Looks like this is already reported in #904. We are waiting for a new spring-cloud-function release. As a workaround you can exclude the dependency for now.

@deki
Copy link
Collaborator

deki commented Nov 27, 2024

Fixed as part of the 2.1.0 release.

@deki deki closed this as completed Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants