Tomcat初始化并在其他端口上启动

时间:2019-01-31 13:14:59

标签: spring-boot tomcat springrunner

端到端测试存在问题:

driver.findElement(By.xpath("//div[contains(@id,'leftcontainer')]/div[3]/div[3]/a"));

test.properies

@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@TestPropertySource(locations = {"classpath:test.properties"})
public class ConfigurationTest {

  /.../

}

如果我在本地运行测试,一切都很好。但是,如果我在VM上运行此测试,每次收到错误:

server.port=56156

在运行该测试之前,我确定该端口是空闲的,并且没有进程在使用它。但是当我在本地运行此测试时,我在日志中发现了这两行,可能看起来很糟糕:

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.

tomcat好像启动了两次?有可能吗?

0 个答案:

没有答案