简体   繁体   English

线程主 NoClassDefFoundError 中的异常:org/springframework/boot/SpringApplication

[英]Exception in thread main NoClassDefFoundError: org/springframework/boot/SpringApplication

during deploing my Spring Boot App on heroku i got this error在 heroku 上部署我的 Spring 引导应用程序时,出现此错误


Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication

My Pom.xml build part:我的 Pom.xml 构建部分:


    <build>
        <plugins>
            <plugin>
                <groupId>com.heroku.sdk</groupId>
                <artifactId>heroku-maven-plugin</artifactId>
                <version>1.1.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>

                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.github.jsimone</groupId>
                                    <artifactId>webapp-runner</artifactId>
                                    <version>8.5.11.3</version>
                                    <destFileName>webapp-runner.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

I only found some solutions for running application localy but i have this problem only on Heroku side.我只找到了一些在本地运行应用程序的解决方案,但我只在 Heroku 端遇到这个问题。 In other solutions it is solved by updating dependencies.在其他解决方案中,它是通过更新依赖项来解决的。 Problem is i have no idea how can i deploy my dependencies to HerokuApp.问题是我不知道如何将依赖项部署到 HerokuApp。

This error is Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.如果 Java 虚拟机或 ClassLoader 实例尝试加载 class 的定义(作为正常方法调用的一部分或作为使用 new 表达式创建新实例的一部分)并且 class 的定义无法加载,则会抛出此错误被发现。 The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.编译当前执行的class时,搜索到的class定义存在,但找不到了。 According to official source: Check this根据官方消息来源: 检查这个

Check if your application Spring boot class like this:检查您的应用程序 Spring 是否像这样启动 class:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

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

Can you publish your project tree?你能发布你的项目树吗?

sorry for that late answer but i was busy.抱歉回答晚了,但我很忙。 So this is my main method which i want to run.所以这是我要运行的主要方法。

package com.wiktor.ecommerce;

import com.wiktor.ecommerce.Service.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;


@SpringBootApplication(exclude = {SecurityAutoConfiguration.class })
public class EcommerceApplication {

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

}

This is my project tree:这是我的项目树: 项目树

暂无
暂无

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

相关问题 Spring 启动 docker 线程“主”中的异常 java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication - Spring boot docker Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication 线程“main”中的异常java.lang.NoClassDefFoundError:org / springframework / boot / SpringApplication - Exception in thread “main” java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication 线程“ main”中的异常java.lang.NoClassDefFoundError:org / springframework / boot / SpringApplication。尝试了所有解决方案,但仍然没有 - Exception in thread “main” java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication.Tried all the solution but still not 线程“主”中的异常 java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication at com.javacourse.springBootDemo - Exception in thread “main” java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication at com.javacourse.springBootDemo AWS EC2 Java Spring Boot-线程“ main”中的异常java.lang.NoClassDefFoundError:org / springframework / boot / SpringApplication - AWS EC2 Java Spring Boot - Exception in thread “main” java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication Rest 模板中的异常:线程“主”java.lang.NoClassDefFoundError 中的异常:org/springframework/core/log/LogDelegateFactory - Exception in Rest Template : Exception in thread “main” java.lang.NoClassDefFoundError: org/springframework/core/log/LogDelegateFactory Eclipse STS Gradle 错误 - java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication - Eclipse STS Gradle Error - java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication org.springframework.boot.SpringApplication无法解析 - org.springframework.boot.SpringApplication can not be resolved 线程“ main”中的异常java.lang.NoClassDefFoundError:org / springframework / core / env / EnvironmentCapable - Exception in thread “main” java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable 线程“main”中的异常 java.lang.NoClassDefFoundError: org/springframework/context/support/ClassPathXmlApplicationContext - Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/support/ClassPathXmlApplicationContext
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM