[JAVA] Please note that Spring Boot + Tomcat 8.5.8 cannot be used!

The latest version currently released (as of 12/13/2016) is Spring Boot 1.4.2.RELEASE, and the default is 8.5.6 for Tomcat. You can easily change the version of Tomcat by creating a project via SPRING INITIALIZR.

If you are using Maven as your build tool, just specify the version in the properties as shown below.

<properties>
    <!-- ... -->
    <tomcat.version>8.5.8</tomcat.version>
</properties>

What happens if you use 8.5.8?

For the time being ... Tomcat won't start if you use the default port number (8080): scream:

The content of the error is "Address already in use". In a sense, it's a common error that you may encounter when you're touching multiple Spring Boot applications at the same time and they're still running.

...
2016-12-11 03:12:06.364 ERROR 20786 --- [           main] o.a.coyote.http11.Http11NioProtocol      : Failed to start end point associated with ProtocolHandler [http-nio-8080]

java.net.BindException: Address already in use
	at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_102]
	at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_102]
...

But this time, no other app is running and there is no zombie process ...

So why is Address already in use?

I won't go into the details, but when I use the built-in Tomcat 8.5.8 on Spring Boot, I accidentally create two Connectors on Tomcat. By default, both use the 8080 port, so "Address already in use" appears ...

As a trial ... Try changing the server port number to 18080 using the Spring Boot properties ...

server.port=18080

The following log will be output and the server will start.

...
2016-12-11 03:15:39.717  INFO 20842 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 18080 (http)
2016-12-11 03:15:39.721  INFO 20842 --- [           main] com.example.Tomcat858DemoApplication     : Started Tomcat858DemoApplication in 2.639 seconds (JVM running for 3.076)

It starts, but ... 8080 (Connector made by Tomcat) and 18080 (Connector made by Spring Boot) start Tomcat that waits for a request: tired_face:

If you want to know the detailed cause ...

Andy Wilkinson of Spring Boot's Core Committer, a Project Member of the Spring Project, reported a bug! !!

The content is the same as the one introduced here, but since the issue is made on the Spring Boot side, I will post a link.

What should I do?

Well, I think it's better to use Tomcat 8.5.6 obediently. If for some reason you need to use a higher version instead of 8.5.6 ... try 8.5.9. For the time being, I started it: sweat_smile: I haven't seen the cause, but when I raised it to 8.5.9 and publicized it, an error occurred in the Spring Boot test, so even with 8.5.9, there may be some things that do not go well when combined with Spring Boot. Hmm.

Summary

Unless you have a specific reason, just use Tomcat, which depends on your Spring Boot. At the very least, it must be a proven version that has been used in past Spring Boot release versions ... You should be aware that you are at increased risk of encountering fatal malfunctions.

Reference site

Recommended Posts

Please note that Spring Boot + Tomcat 8.5.8 cannot be used!
Note that system properties including JAXBContext cannot be used in Java11
The story that the port can no longer be used in the Spring boot sample program
Because getSupportLoaderManager cannot be used
[Java] [Spring] Spring Boot 1.4-> 1.2 Downgrade Note
CentOS7 VirtualBOX yum cannot be used
Be aware that the default for Spring boot redirect is http
[PHP] Solved "mb_strpos cannot be used"
Note that Insert could not be done with Spring Data JDBC
A memo that touched Spring Boot
[Spring Boot] List of validation rules that can be used in the property file for error messages
Java code that cannot be used from Kotlin (for in-house study sessions)
I used Docker to solidify the template to be developed with spring boot.
Spring Boot 2.0.0 does not start built-in tomcat
Try Spring Boot 1 (Environment construction ~ Tomcat startup)
SameSite cookie in Spring Boot (Spring Web MVC + Tomcat)
[Rails 6] method :: delete cannot be used with link_to
[Java] Scenes that cannot be reassigned (substantially final)
Organize methods that can be used with StringUtils
[Ruby] Methods that can be used with strings
Annotations used in Spring Boot task management tool
Why Java String typeclass comparison (==) cannot be used