[英]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);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.