user9862184
user9862184

Reputation: 1

Error while deploying the spring boot app in tomcat server

I am trying to deploy spring boot app on tomcat server but getting error as SEVERE [http-nio-8080-exec-5] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive

Here is the POM file

<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>
<groupId>com.springboot</groupId>
<artifactId>spring-boot-web-application-example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
    <java.version>1.8</java.version>
    <start-class>com.springboot.MainApp</start-class>
</properties>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.8.RELEASE</version>
</parent>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.2.1.Final</version>
    </dependency>

    <!-- JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) -->
    <!--<dependency>-->
    <!--<groupId>org.hibernate.javax.persistence</groupId>-->
    <!--<artifactId>hibernate-core</artifactId>-->
    <!--<version>1.0.1.Final</version>-->
    <!--</dependency>-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
        <!--        <exclusions>
                    <exclusion>
                        <artifactId>hibernate-entitymanager</artifactId>
                        <groupId>org.hibernate</groupId>
                    </exclusion>
                </exclusions>  -->
    </dependency>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.0</version>
    </dependency>
    <!-- Use MySQL Connector-J -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.4.185</version>
        <!-- $NO-MVN-MAN-VER$ -->
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework/spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring</artifactId>
        <version>2.5.6</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>5.3.0.Final</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.3.0.Final</version>
    </dependency>


    <!-- JSTL tag lib -->
    <dependency>
        <groupId>javax.servlet.jsp.jstl</groupId>
        <artifactId>javax.servlet.jsp.jstl-api</artifactId>
        <version>1.2.1</version>
    </dependency>

    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
    </dependency>

    <!-- Tomcat for JSP rendering -->
    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <!--<scope>provided</scope>-->
    </dependency>


    <!--<dependency>-->
        <!--<groupId>org.springframework.boot</groupId>-->
        <!--<artifactId>spring-boot-starter-tomcat</artifactId>-->
        <!--<scope>provided</scope>-->
    <!--</dependency>-->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>

    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>bootstrap</artifactId>
        <version>3.3.7</version>
    </dependency>
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>jquery</artifactId>
        <version>3.1.1</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
<packaging>war</packaging>

Upvotes: 0

Views: 1573

Answers (3)

Anurag
Anurag

Reputation: 901

I think, you are trying to run your application on local. Spring boot application has inbuilt tomcat server. In order to run your application in eclipse, 1) Right click on your project --> 2) Go to Run as --> 3) Java application Your application will start.

Add dependency of devTools as well in your pom, so that if you make any changes in your code the server will be restarted automatically.

Upvotes: 0

Anju
Anju

Reputation: 33

Use https://start.spring.io/ to create your initial POM / Spring Boot application.

You can add dependencies later as required.

Upvotes: 2

Nitin Jangid
Nitin Jangid

Reputation: 164

you do not need to deploy spring-boot project in tomcat, spring-boot is having is own server to run the application. so when you deploy application on server, with the help of maven we can build and run the spring-boot application. here is the command to run build and run the application in linux.

nohup mvn clean spring-boot:run

if you want to restart server you need to kill port id

lsof -i : appPortNumber 

kill -9 processIdOfPort

Upvotes: -1

Related Questions