question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spring Boot Application containerizes but Tomcat Server doesn't start

See original GitHub issue

Description of the issue:

  1. Create a Rest service w/ Spring Boot, and add Jib to Maven pom.xml.
  2. Validate that local run, default port 8080 is exposed.
  3. Run `jib:build
  4. Run the created container image
  5. Notice the port isn’t opened. Tomcat didn’t start.

Expected behavior: Created image should behave like the JAR.

Steps to reproduce:

  1. Build application here: https://github.com/saturnism/spring-cloud-gcp-guestbook/tree/master/11-kubernetes/guestbook-frontend
  2. Build container w/ Jib.
  3. Notice the port isn’t opened.

Environment: MacOS, Maven

jib-maven-plugin Configuration:

<plugin>
  <groupId>com.google.cloud.tools</groupId>
  <artifactId>jib-maven-plugin</artifactId>
  <version>0.9.6</version>
  <configuration>
    <to>
      <image>gcr.io/.../guestbook-frontend</image>
    </to>
  </configuration>
</plugin>

Log output: Normal Startup w/o Jib

2018-07-17 14:09:02.191  INFO [-,,,] 60312 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : started _org.springframework.integration.errorLogger
2018-07-17 14:09:02.485  INFO [-,,,] 60312 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2018-07-17 14:09:02.488  INFO [-,,,] 60312 --- [           main] c.example.frontend.FrontendApplication   : Started FrontendApplication in 9.774 seconds (JVM running for 10.318)

Failed startup w/ Jib

springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2018-07-17 18:05:09.937  INFO [-,,,] 1 --- [           main] o.s.i.channel.PublishSubscribeChannel    : Channel 'application-1.errorChannel' has 1 subscriber(s).
2018-07-17 18:05:09.937  INFO [-,,,] 1 --- [           main] o.s.i.endpoint.EventDrivenConsumer       : started _org.springframework.integration.errorLogger
2018-07-17 18:05:09.967  INFO [-,,,] 1 --- [           main] c.example.frontend.FrontendApplication   : Started FrontendApplication in 9.085 seconds (JVM running for 9.892)

Additional Information:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (15 by maintainers)

github_iconTop GitHub Comments

3reactions
coollogcommented, Jul 17, 2018

Ah I found it: @saturnism

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
			<scope>provided</scope>
		</dependency>

The scope is set to provided, but should be none/compile.

0reactions
coollogcommented, Jul 17, 2018

Not sure why it wasn’t being added since spring-boot-starter-web includes spring-boot-starter-tomcat, which includes tomcat-embed-core.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tomcat Doesn't Come Up When Running Spring Boot ...
I have run into a bit of a strange problem. I have a Spring Boot application that listens on 8080. Here's my config:...
Read more >
Dockerize a Spring Boot Application with Tomcat - Indellient Inc.
We move the WAR file (that comes from the Maven build) into the correct location and run the Tomcat server.
Read more >
Deploy a Spring Boot Application into Tomcat - Okta Developer
The most popular way to start a Spring project is with Spring Initializr. Navigate to start.spring.io in your favorite web browser, then choose ......
Read more >
76. Embedded Web Servers - Spring
Many Spring Boot starters include default embedded containers. For servlet stack applications, the spring-boot-starter-web includes Tomcat by including spring- ...
Read more >
How to Configure Spring Boot Tomcat - Baeldung
Spring Boot web applications include a pre-configured, embedded web server by default. In some situations, though, we'd like to modify the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found