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.

Only support tomcat?I used undertow

See original GitHub issue

this my pom.xml

   <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-undertow</artifactId>
        </dependency>
    </dependencies>

docker run

 root@nasoft-virtual-machine:/usr/local/tools# docker logs -f 5a42c2075b9a
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
	at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:179)
	at org.orh.Application.main(Application.java:13)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 2 more

If it is tomcat, no problem.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:22 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
d5nguyenvancommented, Jul 19, 2018

Hi @qq12157138, The reason is in your class the docker-maven-plugin depend on the spring-boot-maven-plugin and there are some differences in the dependencies processing between spring-boot-maven-plugin with jib-maven-plugin. I tested on spring-boot-maven-plugin by marking provided to java-servlet-api, however, when I run spring-boot:repackage the java-servlet-api still include in the final jar file, that is why the docker-maven-plugin run successfully.

1reaction
chanseokohcommented, Jul 19, 2018

@d5nguyenvan @qq12157138 you can run Jib twice to tag your image with different names: #654. Jib is optimized and will skip building images in this case.

@coollog looks like the “provided” dependency issue is not uncommon with Spring Boot-based WAR applications, e.g. #640. That makes sense, as a normal WAR expects that the Servlet APIs and a Servlet engine are provided and not part of the WAR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot and Embedded Servers - Tomcat, Jetty and ...
We will discuss the different options that Spring Boot supports - Tomcat, Jetty and Undertow. Image. You will learn. What is an embedded...
Read more >
76. Embedded Web Servers - Spring
76.6 Enable HTTP Response Compression. HTTP response compression is supported by Jetty, Tomcat, and Undertow. It can be enabled in application.properties , as ......
Read more >
Spring Boot Embedded Servers - Tomcat, Jetty and Undertow
Spring Boot includes support for embedded Tomcat, Jetty, and Undertow servers. Most developers use the appropriate “Starter” to obtain a fully configured ...
Read more >
java - Replacing tomcat with undertow server for spring-boot ...
I'm trying to setup a simple spring-boot example project (keycloak tutorial) but I'm stuck at a startup error. The only thing that differs...
Read more >
Undertow May Be Better for SpringBoot than Tomcat - Medium
According to the StackShare community, Apache Tomcat has a broader approval ... SrpingBoot has completely inherited the Undertow technology, we only need to ......
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