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

Upgrade Spring Boot #31

Open
borditamas opened this issue Dec 20, 2021 · 4 comments
Open

Upgrade Spring Boot #31

borditamas opened this issue Dec 20, 2021 · 4 comments
Assignees

Comments

@borditamas
Copy link
Collaborator

Change to v2.6.2 once it will be released and remove log4j2.version property.

Background: https://spring.io/blog/2021/12/10/log4j2-vulnerability-and-spring-boot

@borditamas borditamas self-assigned this Dec 20, 2021
@InRiPa
Copy link

InRiPa commented Jan 3, 2022

Could anyone verify a successful upgrade yet? I'm really struggling with that since I'm unable to retrieve the legacy versions and need java 17 for my current ones. So what I did:

  • Upgrade version in pom.xml to 2.6.2
<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>2.6.2</version>
  <relativePath/> <!-- lookup parent from repository -->
</parent>
  • Setting required java version
<plugins>
	<plugin>
    	<groupId>org.springframework.boot</groupId>
    	<artifactId>spring-boot-maven-plugin</artifactId>
  	</plugin>  	
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-compiler-plugin</artifactId>
		<version>3.8.1</version>
		<configuration>
			<source>17</source>   <!-- maven.compiler.source  -->
			<target>17</target> <!-- maven.compiler.target -->
		</configuration>
	</plugin>		  			
</plugins>

Applying mentioned changes, building the project with mvn clean install and running the jar file results in following error:

2022-01-03 11:01:09.518  INFO 23509 --- [           main] e.a.a.s.p.ProviderMain                   : Starting ProviderMain v4.4.0.1 using Java 17.0.1 on hostpc with PID 23509 (/path/to/application-skeleton-provider/target/arrowhead-application-skeleton-provider-4.4.0.1.jar started by user in /path/to/)
2022-01-03 11:01:09.531  INFO 23509 --- [           main] e.a.a.s.p.ProviderMain                   : No active profile set, falling back to default profiles: default
2022-01-03 11:01:10.614  INFO 23509 --- [           main] e.a.a.s.p.c.ContainerConfiguration       : ####################################################################################
2022-01-03 11:01:10.614  INFO 23509 --- [           main] e.a.a.s.p.c.ContainerConfiguration       : #
2022-01-03 11:01:10.614  INFO 23509 --- [           main] e.a.a.s.p.c.ContainerConfiguration       : # TomcatCustomizer
2022-01-03 11:01:10.614  INFO 23509 --- [           main] e.a.a.s.p.c.ContainerConfiguration       : #
2022-01-03 11:01:10.616  INFO 23509 --- [           main] e.a.a.s.p.c.ContainerConfiguration       : # custom maxKeepAliveRequests 1
2022-01-03 11:01:10.616  INFO 23509 --- [           main] e.a.a.s.p.c.ContainerConfiguration       : # origin keepalive timeout: 60000 ms
2022-01-03 11:01:10.616  INFO 23509 --- [           main] e.a.a.s.p.c.ContainerConfiguration       : # keepalive timeout: 60000 ms
2022-01-03 11:01:10.616  INFO 23509 --- [           main] e.a.a.s.p.c.ContainerConfiguration       : # connection timeout: 60000 ms
2022-01-03 11:01:10.616  INFO 23509 --- [           main] e.a.a.s.p.c.ContainerConfiguration       : # max connections: 8192
2022-01-03 11:01:10.616  INFO 23509 --- [           main] e.a.a.s.p.c.ContainerConfiguration       : #
2022-01-03 11:01:10.616  INFO 23509 --- [           main] e.a.a.s.p.c.ContainerConfiguration       : ####################################################################################
2022-01-03 11:01:10.655  INFO 23509 --- [           main] o.s.b.w.e.t.TomcatWebServer              : Tomcat initialized with port(s): 8888 (https)
2022-01-03 11:01:10.679  INFO 23509 --- [           main] o.a.c.c.StandardService                  : Starting service [Tomcat]
2022-01-03 11:01:10.680  INFO 23509 --- [           main] o.a.c.c.StandardEngine                   : Starting Servlet engine: [Apache Tomcat/9.0.56]
2022-01-03 11:01:10.739  INFO 23509 --- [           main] o.a.c.c.C.[.[.[/]                        : Initializing Spring embedded WebApplicationContext
2022-01-03 11:01:10.739  INFO 23509 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1158 ms
2022-01-03 11:01:10.861  WARN 23509 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'providerApplicationInitListener': Unsatisfied dependency expressed through field 'arrowheadService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ArrowheadService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'ArrowheadService': Requested bean is currently in creation: Is there an unresolvable circular reference?
2022-01-03 11:01:10.864  INFO 23509 --- [           main] o.a.c.c.StandardService                  : Stopping service [Tomcat]
2022-01-03 11:01:10.877  INFO 23509 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-01-03 11:01:10.898 ERROR 23509 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

The dependencies of some of the beans in the application context form a cycle:

   providerApplicationInitListener (field private ai.aitia.arrowhead.application.library.ArrowheadService ai.aitia.arrowhead.application.library.config.ApplicationInitListener.arrowheadService)
┌─────┐
|  ArrowheadService
└─────┘


Action:

Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.

@borditamas
Copy link
Collaborator Author

borditamas commented Jan 4, 2022

@InRiPa I was able to replicate your issue with the car-demo example project so a fix will come soon with v4.4.0.2.

In the meantime you can implement a quick fix by placing the following property to your application.properties file:
spring.main.allow-circular-references=true

Additional note for the upgrade:
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3-Release-Notes#validation-starter-no-longer-included-in-web-starters

@InRiPa
Copy link

InRiPa commented Jan 4, 2022

The workaround works. Thanks for addressing the issue.

@borditamas
Copy link
Collaborator Author

Fix has been released

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