Tomcat 7 and Spring boot war start up

how to deploy spring boot war file in external tomcat
spring boot deploy war to tomcat
how to create war file in spring boot
spring boot without embedded tomcat
spring boot executable war
how to deploy spring boot application in production
spring boot war tomcat 404
spring-boot-starter-tomcat

I get the following message when I deploy my war to the Tomcat 7:

nested exception is java.lang.NoClassDefFoundError: javax/el/ELManager

I added <tomcat.version>7.0.61</tomcat.version> to my pom.xml and can now reproduce the error on my development environment.

The error happens after the bean creation, the other changes that were necessary to get the war to run I made.

I tried to change my pom.xml so that it uses old versions which might play nice with tomcat 7, but failed to remove the problem. I don't know which package produces the problem.

See pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.xxx</groupId>
    <artifactId>monitormonitor</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>monitormonitor</name>
    <description>Web Service Monitoring project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <start-class>com.xxx.monitormonitor.MonitormonitorApplication</start-class>
        <!-- deploying war-file on tomcat 7 -->
        <tomcat.version>7.0.61</tomcat.version><!-- nested exception is java.lang.NoClassDefFoundError: javax/el/ELManager -->
        <servlet-api.version>3.0.1</servlet-api.version>
    </properties>

    <packaging>war</packaging>

    <dependencies>
        <!-- added other version of log4j for invalid byte tag error -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <!-- changed version vs. ClassFormatException: Invalid byte tag in constant pool: 19 -->
            <!--<version>2.11.1</version>-->
            <version>2.7</version>
            <!--<scope>provided</scope>-->
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.7</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <!-- <scope>provided</scope> -->
        </dependency>

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
        </dependency>
        <!--
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <version>1.1.6.RELEASE</version>            
            <scope>provided</scope>
        </dependency>
        -->
        <!-- added vs java.lang.NoClassDefFoundError: javax/el/ELManager -->
        <!--<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        -->
        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <version>2.2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>javax.el</artifactId>
            <version>2.2.4</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>    
                    <mainClass>com.xxx.monitormonitor.MonitormonitorApplication</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

dependency tree:

    [INFO] com.xxx:monitormonitor:war:0.0.1-SNAPSHOT
    [INFO] +- org.apache.logging.log4j:log4j-api:jar:2.7:compile
    [INFO] +- org.apache.logging.log4j:log4j-core:jar:2.7:compile
    [INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.1.2.RELEASE:compile
    [INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.1.2.RELEASE:compile
    [INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.1.2.RELEASE:compile
    [INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
    [INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
    [INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.11.1:compile
    [INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
    [INFO] |  |  \- org.yaml:snakeyaml:jar:1.23:runtime
    [INFO] |  +- com.zaxxer:HikariCP:jar:3.2.0:compile
    [INFO] |  |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
    [INFO] |  \- org.springframework:spring-jdbc:jar:5.1.4.RELEASE:compile
    [INFO] |     \- org.springframework:spring-tx:jar:5.1.4.RELEASE:compile
    [INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:2.1.2.RELEASE:compile
    [INFO] |  \- com.sun.mail:javax.mail:jar:1.6.2:compile
    [INFO] |     \- javax.activation:activation:jar:1.1:compile
    [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.1.2.RELEASE:compile
    [INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.1.2.RELEASE:compile
    [INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
    [INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
    [INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
    [INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.8:compile
    [INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.8:compile
    [INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.8:compile
    [INFO] |  +- org.hibernate.validator:hibernate-validator:jar:6.0.14.Final:compile
    [INFO] |  |  +- javax.validation:validation-api:jar:2.0.1.Final:compile
    [INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
    [INFO] |  |  \- com.fasterxml:classmate:jar:1.4.0:compile
    [INFO] |  +- org.springframework:spring-web:jar:5.1.4.RELEASE:compile
    [INFO] |  \- org.springframework:spring-webmvc:jar:5.1.4.RELEASE:compile
    [INFO] |     +- org.springframework:spring-aop:jar:5.1.4.RELEASE:compile
    [INFO] |     \- org.springframework:spring-expression:jar:5.1.4.RELEASE:compile
    [INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.2.RELEASE:provided
    [INFO] |  +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
    [INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.61:provided
    [INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:7.0.61:provided
    [INFO] |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:7.0.61:provided
    [INFO] +- org.springframework.boot:spring-boot-devtools:jar:2.1.2.RELEASE:runtime
    [INFO] |  +- org.springframework.boot:spring-boot:jar:2.1.2.RELEASE:compile
    [INFO] |  \- org.springframework.boot:spring-boot-autoconfigure:jar:2.1.2.RELEASE:compile
    [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.1.2.RELEASE:test
    [INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.1.2.RELEASE:test
    [INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.2.RELEASE:test
    [INFO] |  +- com.jayway.jsonpath:json-path:jar:2.4.0:test
    [INFO] |  |  \- net.minidev:json-smart:jar:2.3:test
    [INFO] |  |     \- net.minidev:accessors-smart:jar:1.2:test
    [INFO] |  |        \- org.ow2.asm:asm:jar:5.0.4:test
    [INFO] |  +- junit:junit:jar:4.12:test
    [INFO] |  +- org.assertj:assertj-core:jar:3.11.1:test
    [INFO] |  +- org.mockito:mockito-core:jar:2.23.4:test
    [INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.9.7:test
    [INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.9.7:test
    [INFO] |  |  \- org.objenesis:objenesis:jar:2.6:test
    [INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
    [INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
    [INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
    [INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
    [INFO] |  +- org.springframework:spring-core:jar:5.1.4.RELEASE:compile
    [INFO] |  |  \- org.springframework:spring-jcl:jar:5.1.4.RELEASE:compile
    [INFO] |  +- org.springframework:spring-test:jar:5.1.4.RELEASE:test
    [INFO] |  \- org.xmlunit:xmlunit-core:jar:2.6.2:test
    [INFO] +- org.springframework:spring-context-support:jar:5.1.4.RELEASE:compile
    [INFO] |  +- org.springframework:spring-beans:jar:5.1.4.RELEASE:compile
    [INFO] |  \- org.springframework:spring-context:jar:5.1.4.RELEASE:compile
    [INFO] +- javax.el:javax.el-api:jar:2.2.4:provided
    [INFO] \- org.glassfish.web:javax.el:jar:2.2.4:provided

spring boot 2.1.2 release supports any Servlet 3.1+ compatible container.

Tomcat 7 is not one of them

spring boot docs

Use tomcat 8 or beyond http://tomcat.apache.org/whichversion.html

Deploy a Spring Boot WAR into a Tomcat Server, Learn how to configure a Spring Boot application to be deployed on a us to set up a production-ready setup of a Spring project, and Tomcat� After that, our WAR file is generated at target/spring-boot-tomcat.war (assuming the Maven artifactId is “spring-boot-tomcat”). We should consider that this new setup makes our Spring Boot application a non-standalone application (if you would like to have it working in standalone mode again, remove the provided scope from the tomcat

Spring Boot 2.1 requires a Servlet 3.1 compatible container. Tomcat 7 is a Servlet 3.0 container so you cannot use it with Spring Boot 2.1.

You'll need to upgrade to Tomcat 8.5.x or 9.0.x.

Deploying Spring Boot Applications, Tomcat. When you run your application, Spring Boot will detect that you have a Spring MVC controller and start up an embedded Apache Tomcat 7 instance, by default. You should be able to test the REST endpoint by opening up your browser and hitting http://localhost:8080/hello/World . By default Spring Boot runs as a jar inside with embedded Tomcat (although you can deploy it as a regular WAR). Running with an embedded application server is great, but sometimes you may need to bundle another war with your embedded application. Maybe you have a legacy app you need to include and don't want to set up a regular Tomcat for this

It is because javax/el/ELManager was introduced in el-api 3.0 and tomcat 7 is using el-api 2.2 so this class is not present in it.

Please make sure your dev and prod environment are the same when you are developing.

Or you can add following dependency in your pom.xml

<dependency>
    <groupId>javax.el</groupId>
    <artifactId>javax.el-api</artifactId>
    <version>3.0.0</version>
</dependency>

Deploy a Spring Boot Application into Tomcat, Create a Spring Boot 2.1 app with Java 11 and deploy into Tomcat 9. Extract to a location and inside the bin directory run the startup script - startup.sh for Linux/ Mac and startup.bat for Windows. [karl@m14x bin]$ . You now need to create a WAR file from your Spring Boot application. Contact & Legal. Since spring-boot-starter-web has added Tomcat and Spring MVC, auto-configuration will setup a web based application. Our main() method is the triggering point of our java application, it in-turn calls Spring Boot’s SpringApplication class run() method which bootstrap our HelloWorld application.

Spring Boot - Deploy WAR file to Tomcat, However, tomcat server were running on java 7.0. Thanks though. Vote Up0Vote Down Reply. 2 years ago. Spring-Boot-Classes: BOOT-INF/classes/ Spring-Boot-Lib: BOOT-INF/lib/ Spring-Boot-Version: 2.1.3.RELEASE Main-Class: org.springframework.boot.loader.JarLauncher. Spring-Boot-Classes and Spring-Boot-Lib are particularly interesting, as they tell us where the class loader is going to find classes and external libraries. 5. How to Choose

Spring Boot With External Tomcat, Let's take a closer look at the Spring Boot approach to common problems developers might face when You simply hit the run button, and your web server starts up with your application. The Tomcat needs a .war file. The tutorial is a guide to traditional deployment problem: “How to create a Spring Boot Web App War file with Maven then deploys it on Tomcat server” ContentsI. TechnologiesII. Practice1. Create a War file1.1. Create Spring Boot Web App1.2. Extends SpringBootServletInitializer1.3. Update build configuration2. Deploy War file on TomcatIII.

Spring Boot : Deploying a War file to Tomcat 8 - 2020, Spring Boot, Spring Framework 4 & Maven 3, War file, Tomcat. Now that our tomcat user is set up, let's download and install Tomcat. We can get the Tomcat 8 � The spring-boot-starter-web dependency is starter for building web apps, including RESTful applications, using Spring MVC. It uses Tomcat web server as the default embedded container by including spring-boot-starter-tomcat, but you can use spring-boot-starter-jetty or spring-boot-starter-undertow instead which are starter for using Jetty and Undertow as the embedded servlet container.

Comments
  • You should not be using Tomcat 7. Spring Boot 2.1.2 demands Tomcat 9. Upgrade Tomcat in your pom.xml.
  • Well I tried to downgrade org.springframework.boot to 1.1.12.RELEASE (which appears to be the latest version using tomcat 7) but it is missing vital stuff that came with newer releases. Guess I have to use tomcat 9.
  • I believe this doesn't work since tomcat has the privilege of providing this package.