Fatih AKSOY
Fatih AKSOY

Reputation: 106

Heroku Spring Boot Application Start Problem

I created a Java Spring Boot Application.

I want to publish on Heroku but I have a problem.

I used ModelMapper on my project.

I published my app and then I wrote heroku ps:scale web=1

But my exception is:

2020-12-06T22:30:02.017002+00:00 app[web.1]: Error: Unable to initialize main class com.faksoy.stocktracking.StockTrackingApplication 2020-12-06T22:30:02.017004+00:00 app[web.1]: Caused by: java.lang.NoClassDefFoundError: org/modelmapper/ModelMapper

My StockTrackingApplication class is:

@SpringBootApplication
public class StockTrackingApplication {

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

@Bean
public ModelMapper getModelMapper() {
    ModelMapper modelMapper = new ModelMapper();
    modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
    return modelMapper;
 }
}

And last my Heroku JDK version is 15.0.1.

Thanks

Upvotes: 0

Views: 269

Answers (1)

Fatih AKSOY
Fatih AKSOY

Reputation: 106

I found my problem.

My problem is my pom.xml is not correct for maven plugin.

I changed my pom.xml like this

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

and deleted other maven tools.

My problem solved.

Upvotes: 1

Related Questions