0

基本的なスプリング ブート アプリケーションから war ファイルを作成しようとしています。アプリケーションは を使用して WAR を正常にビルドしますがmvn package、それを Tomcat 9 サーバーにデプロイしようとすると、次のメッセージが表示されます。

FAIL - Application at context path [/kevthedev] could not be started
FAIL - Encountered exception [org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/kevthedev]]]

目的は、基本的なスプリング ブート アプリケーションを構築し、それを Tomcat 9 サーバーにデプロイすることです。スプリング ブート アプリケーションには組み込みの Tomcat サーバーがなく、代わりに私が構築した外部 Tomcat サーバー 9 を使用します。

以下は私のPOM.xml

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.kev.developer</groupId>
    <artifactId>kevthedev</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>kevthedev</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</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>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>${artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

メイン アプリのクラス ファイルは次のとおりです。

package com.kev.developer;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

@SpringBootApplication
public class KevthedevApplication extends SpringBootServletInitializer {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(KevthedevApplication.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(KevthedevApplication.class);
    }
}

添付は私のログです

2018-10-09 16:03:51.353  INFO 798 --- [o-8080-exec-114] com.zaxxer.hikari.HikariDataSource       : HikariPool-12 - Starting...
2018-10-09 16:03:51.566  INFO 798 --- [o-8080-exec-114] com.zaxxer.hikari.HikariDataSource       : HikariPool-12 - Start completed.
2018-10-09 16:03:51.627  INFO 798 --- [o-8080-exec-114] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-10-09 16:03:51.652  INFO 798 --- [o-8080-exec-114] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
2018-10-09 16:03:51.813  INFO 798 --- [o-8080-exec-114] org.hibernate.Version                    : HHH000412: Hibernate Core {5.2.17.Final}
2018-10-09 16:03:51.814  INFO 798 --- [o-8080-exec-114] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2018-10-09 16:03:51.842  WARN 798 --- [o-8080-exec-114] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
2018-10-09 16:03:51.842  INFO 798 --- [o-8080-exec-114] com.zaxxer.hikari.HikariDataSource       : HikariPool-12 - Shutdown initiated...
2018-10-09 16:03:51.869  INFO 798 --- [o-8080-exec-114] com.zaxxer.hikari.HikariDataSource       : HikariPool-12 - Shutdown completed.
2018-10-09 16:03:51.921  INFO 798 --- [o-8080-exec-114] ConditionEvaluationReportLoggingListener :
2018-10-09 16:03:51.926 ERROR 798 --- [o-8080-exec-114] o.s.boot.SpringApplication               : Application run failed
4

2 に答える 2