springboot Modify the built in tomcat version

  • 2020-06-23 02:18:49
  • OfStack

springboot- Modification of the built-in tomcat version

1. Resolve Spring Boot parent dependencies


<parent> 
 <groupId>org.springframework.boot</groupId> 
 <artifactId>spring-boot-starter-parent</artifactId> 
 <version>1.5.6.RELEASE</version> 
</parent> 
 

This configuration is the Spring Boot parent dependency. With this, the current project is the Spring Boot project. spring-boot-starter-parent is a special starter that provides the associated Maven default dependency. For information on which jar packages Spring Boot provides dependencies, see C:\Users\ users.m2\ org\springframework\boot\ spring-ES32en-ES33en \1.5.1.RELEASE\ ES35en-ES36en-ES37en-1.5.1.RELEASE.pom

2. Open the pom file and search "ES43en.version" to find: < tomcat.version > 8.5.16 < /tomcat.version >

You can modify the version of tomcat you want directly here

(2) Add a version to pom for your own project to override this version. Such as:

tomcat version configuration code in Pom


<properties> 
  <tomcat.version>8.0.29</tomcat.version> 
</properties> 

With this added, spingboot's default startup version of tomcat is what you need. And we're almost done here.

But sometimes an error is reported:

Tomcat boot error code


Caused by: java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory 
  at org.apache.catalina.util.LifecycleBase.<clinit>(LifecycleBase.java:37) 
  at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:169) 
  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) 
  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) 
  ... 13 common frames omitted 

Because tocmat lacks jar package at this time, it would be better to add the following dependency to maven project:


<dependency> 
   <groupId>org.apache.tomcat</groupId> 
   <artifactId>tomcat-juli</artifactId> 
   <version>${tomcat.version}</version> 
 </dependency>

Above is the example of springboot- modify the built-in tomcat version, if you have any questions, please leave a message or to this site community exchange discussion, thank you for reading, hope to help you, thank you for your support to this site!


Related articles: