Reputation: 21
during deploing my Spring Boot App on heroku i got this error
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
My Pom.xml build part:
<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. In other solutions it is solved by updating dependencies. Problem is i have no idea how can i deploy my dependencies to HerokuApp.
Upvotes: 1
Views: 641
Reputation: 21
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);
}
}
Upvotes: 0
Reputation: 217
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. The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found. According to official source: Check this
Check if your application Spring boot class like this:
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 ?
Upvotes: 1