运行Maven打包项目时出错,ApplicationRunner失败

时间:2019-07-12 06:15:32

标签: java spring maven

我尝试了所有找到的相应职位解决方案,但没有成功。

这是我的错误:

  

2019-07-12 07:59:42.713错误3304 --- [main]   o.s.boot.SpringApplication:应用程序启动失败

     

java.lang.IllegalStateException:无法执行ApplicationRunner           在org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:726)   [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]           在org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:713)   [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]           在org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:703)   [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]           在org.springframework.boot.SpringApplication.run(SpringApplication.java:304)   [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]           在org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)   [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]           在org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)   [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]           在de.opentiming.feigWS.FeigWsApplication.main(FeigWsApplication.java:12)   [课程!/:0.2-SNAPSHOT]           在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)〜[na:1.8.0_211]           在sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)〜[na:1.8.0_211]           在sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)〜[na:1.8.0_211]           在java.lang.reflect.Method.invoke(未知来源)〜[na:1.8.0_211]           在org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)   [feigWS-0.2-SNAPSHOT.jar:0.2-SNAPSHOT]           在org.springframework.boot.loader.Launcher.launch(Launcher.java:87)   [feigWS-0.2-SNAPSHOT.jar:0.2-SNAPSHOT]           在org.springframework.boot.loader.Launcher.launch(Launcher.java:50)   [feigWS-0.2-SNAPSHOT.jar:0.2-SNAPSHOT]           在org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)   [feigWS-0.2-SNAPSHOT.jar:0.2-SNAPSHOT]原因:   java.lang.NullPointerException:空           在de.opentiming.feigWS.FeigWsApplicationRunner.run(FeigWsApplicationRunner.java:32)   〜[课程!/:0.2-SNAPSHOT]           在org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:723)   [spring-boot-1.5.6.RELEASE.jar!/:1.5.6.RELEASE]           ...省略了14个共同的框架

我用mvn软件包将我的maven项目打包了。 建立成功!

但是当我启动java -jar时,我从应用程序启动器中收到错误消息。

我的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>

    <groupId>de.opentiming.feigws</groupId>
    <artifactId>feigWS</artifactId>
    <version>0.2-SNAPSHOT</version>
    <packaging>jar</packaging>

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

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.6.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>

    <repositories>
        <repository>
            <id>maven-repository</id>
            <url>file:///${project.basedir}/maven-repository</url>
        </repository>
    </repositories>
    <dependencies>
        <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.hibernate</groupId>
          <artifactId>hibernate-core</artifactId>
          <version>5.0.11.Final</version>
          <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>de.feig</groupId>
            <artifactId>OBIDISC4J</artifactId>
            <version>4.7.0</version>
        </dependency>

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>jquery</artifactId>
            <version>3.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>4.0.0-2</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>webjars-locator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>font-awesome</artifactId>
            <version>4.7.0</version>
        </dependency>
    </dependencies>

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

</project>

我的ApplicationRunner:

    package de.opentiming.feigWS;

    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.context.annotation.ComponentScan;
    import org.springframework.boot.autoconfigure.*;
    import org.springframework.boot.autoconfigure.jdbc.*;
    import org.springframework.boot.autoconfigure.web.*;
    import org.springframework.boot.autoconfigure.info.*;
    import org.springframework.context.annotation.*;


    @SpringBootApplication
    //@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class, WebClientAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class, ProjectInfoAutoConfiguration.class})
    @ComponentScan
    @Configuration


    public class FeigWsApplication {

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

0 个答案:

没有答案