应用程序无法以类路径启动:

时间:2019-03-26 22:49:46

标签: java-8 properties configuration runtime-error

我有一个关于应用程序无法从类路径启动的问题。而且我正在使用springboot版本1.5.10,并且我试图在jboss上部署为独立的jar。我正在获取以下classNotFound

<parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.10.RELEASE</version>
        </parent>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>                    </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
             <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
           <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-consul-all</artifactId>
                <version>${consul-starter.version}</version>
             </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-consul-dependencies</artifactId>
                <version>${cloud-consul.version}</version>
                <type>pom</type>
                <scope>import</scope>
             </dependency>     
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${springfox-version}</version>
                <scope>${dep.scope}</scope>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${springfox-version}</version>
                <scope>${dep.scope}</scope>
            </dependency>   

            <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>resteasy-jaxrs</artifactId>
                <version>2.2.1.GA</version>
            </dependency>
            <!-- JAXB support -->
            <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>resteasy-jaxb-provider</artifactId>
                <version>2.2.1.GA</version>
            </dependency>
            <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>jaxrs-api</artifactId>
                <version>2.2.1.GA</version>
            </dependency>
            <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>resteasy-jackson-provider</artifactId>
                <version>2.2.1.GA</version>
            </dependency>

            <dependency>
                <groupId>org.kie.remote</groupId>
                <artifactId>kie-remote-client</artifactId>                  
                <version>${version.org.kie}</version>
            <!--    <version>6.5.0.Final</version>  -->
                <scope>compile</scope>              
            </dependency>   

            <dependency>
                 <groupId>org.kie.server</groupId>
                <artifactId>kie-server-client</artifactId>
                <version>${version.org.kie}</version>
                </dependency>                   
            <dependency>
                <groupId>org.kie</groupId>
                <artifactId>kie-api</artifactId>
                <version>${version.org.kie}</version>
                <!-- <version>6.5.0.Final-redhat-17</version> -->
            </dependency>

            <dependency>
                <groupId>org.kie.server</groupId>
                <artifactId>kie-server-api</artifactId>
                <version>${version.org.kie}</version>
                <!-- <version>6.5.0.Final</version> -->
            </dependency>

            <dependency>
              <groupId>org.apache.logging.log4j</groupId>
              <artifactId>log4j-slf4j-impl</artifactId>
              <version>2.7</version>
              <scope>provided</scope>
            </dependency>

        </dependencies>
        <properties>
            <java.version>1.8</java.version>
            <consul-starter.version>1.3.0.RELEASE</consul-starter.version>
            <cloud-consul.version>1.3.0.RELEASE</cloud-consul.version>
            <dep.scope>compile</dep.scope>
            <springfox-version>2.5.0</springfox-version>
            <!-- <version.org.kie>6.5.0.Final-redhat-16</version.org.kie> -->
            <version.org.kie>6.5.0.Final-redhat-17</version.org.kie>
         </properties>  

我可以看到我的Maven依赖项中存在spring-context,但仍然可以看到NoClassDefFoundError,如上所示,请找到下面的是我的pom.xml

|Configuring classpath
|Downloading: org/forgerock/forgerock-parent/1.2.1/forgerock-parent-1.2.1.pom

有人可以帮助我解决问题吗?感谢帮助。

1 个答案:

答案 0 :(得分:0)

您指出的错误是“ ConfigurationPropertySources 丢失。

如果对Cofig文件进行了任何更改,则必须始终再次对其进行构建。

只需转到配置文件所在的文件夹。

  1. Shift+Right_Click
  2. CMD将打开,写入gradle gAC

现在再次构建您的项目,即DTO(如果)*和所有其他Java文件,现在您的程序应该可以正常运行了。