简体   繁体   English

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

[英]Application failed to start with classpath:

I have an issue regarding the Application failed to start with classpath. 我有一个关于应用程序无法启动类路径的问题。 And i'm using springboot version 1.5.10, and im trying to deploy as an independent jar on jboss. 我正在使用springboot版本1.5.10,我试图在jboss上作为一个独立的jar部署。 Im getting the below classNotFound 我得到以下classNotFound

java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/source/ConfigurationPropertySources
    at org.springframework.cloud.client.HostInfoEnvironmentPostProcessor.getFirstNonLoopbackHostInfo(HostInfoEnvironmentPostProcessor.java:46)
    at org.springframework.cloud.client.HostInfoEnvironmentPostProcessor.postProcessEnvironment(HostInfoEnvironmentPostProcessor.java:35)
    at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.java:182)
    at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:168)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:296)
2019-03-26 17:35:33,919 DEBUG [o.s.b.l.ClasspathLoggingApplicationListener] [main] Application failed to start with classpath: [file:/C:/Program%20Files%20(x86)/Java/jdk1.8.0_60/jre/lib/resources.jar, file:/C:/Program%20Files%20(x86)/Java/jdk1.8.0_60/jre/lib/rt.jar, file:/C:/Program%20Files%20(x86)/Java/jdk1.8.0_60/jre/lib/jsse.jar, file:/C:/Program%20Files%20(x86)/Java/jdk1.8.0_60/jre/lib/jce.jar, file:/C:/Program%20Files%20(x86)/Java/jdk1.8.0_60/jre/lib/charsets.jar, file:/C:/Program%20Files%20(x86)/Java/jdk1.8.0_60/jre/lib/jfr.jar, file:/C:/Program%20Files%20(x86)/Java/jdk1.8.0_60/jre/lib/ext/access-bridge-32.jar,

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.properties.source.ConfigurationPropertySources
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 27 common frames omitted

I can see spring-context is present in my maven dependencies, still i see the NoClassDefFoundError, as Above and please find Below is my pom.xml 我可以看到spring-context存在于我的maven依赖项中,我仍然看到NoClassDefFoundError,如上所示,请查找下面是我的pom.xml

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

can someone help me with the solution. 有人可以帮我解决这个问题。 Appreciated for the help. 感谢您的帮助。

The error which you have pointed out is " ConfigurationPropertySources Missing. 您指出的错误是“ ConfigurationPropertySources Missing。

Cofig files must be always built again if any changes are made to it. 如果对Cofig文件进行任何更改,则必须始终再次构建Cofig文件。

Simply head to folder where configuration file is located. 只需前往配置文件所在的文件夹即可。

  1. Press Shift+Right_Click Shift+Right_Click
  2. CMD will open , Write gradle gAC CMD将打开,写入gradle gAC

Now build your project again, ie DTO ( if there )*and all other Java files, Now your program should run properly. 现在再次构建您的项目,即DTO( 如果有 )*和所有其他Java文件,现在您的程序应该正常运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 协议处理程序启动失败 Spring 启动 SSL 应用程序 - Protocol handler start failed Spring Boot SSL application 无法启动场景构建器 - Failed to start scene builder “ Chrome无法启动:异常退出” - “Chrome failed to start: exited abnormally” Java应用程序的类路径指定执行均返回:“错误:找不到或加载主类” - No matter classpath designation execution of java application returns: “Error: Could not find or load main class” org.apache.catalina.LifecycleException: 无法启动组件 [StandardServer[8005]] 子容器在启动过程中失败 - org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]A child container failed during start 迁移到Websphere 9后无法启动应用程序 - Unable to start application after migrating to Websphere 9 Spring 启动 2 与 apache 骆驼应用程序启动错误 - Spring boot 2 with apache camel application start error Java Web 启动应用程序中的 JVM Args - JVM Args in java web start application CDI Beans模块部署失败:无法启动owb上下文 - CDI Beans module deployment failed: couldn't start owb context Java 8 Update 91 Web Start应用程序具有长启动延迟 - Java 8 Update 91 Web Start Application Has Long Startup Delay
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM