Linked Questions

Popular Questions

Tomcat initialized and starts on different ports

Asked by At

I have a problem with my end to end test:

@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@TestPropertySource(locations = {""})
public class ConfigurationTest {





If I run my test locally, everything is fine. But if I run this test on VM, every time I receive an error:

06:22:20 *************************** 06:22:20 APPLICATION FAILED TO START 06:22:20 *************************** 06:22:20 06:22:20 Description: 06:22:20 06:22:20 The Tomcat connector configured to listen on port 0 failed to start. The port may already be in use or the connector may be misconfigured.

Before running that test I'm sure that the port is free, and no process is using it. But when I run this test locally, I find this two lines in logs, maybe looks bad:

2019-01-31 13:34:18,746 | INFO | main | TomcatWebServer | Tomcat initialized with port(s): 0 (https) /.../ 2019-01-31 13:34:30,751 | INFO | main | TomcatWebServer | Tomcat started on port(s): 56156 (https) with context path ''

It's looks like tomcat started twice? It's possible?

Related Questions