Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication, gradle error while building on Heroku - spring-boot

enter image description here
I am getting this error while building my spring boot application in Heroku, but when I run it locally in my eclipse, then it works fine.

Related

gradle error java.lang.NoClassDefFoundError: org/gradle/api/specs/Spec when trying to run unit-tests

I have a gradle based spring boot project. When I would like to run the tests an error message like this appears:
gradle-resources-test:my-project.my-module.test: java.lang.NoClassDefFoundError: org/gradle/api/specs/Spec
What can I do to find out more about the problem?

Application Running via Spring Boot Run but not via IntelliJ Idea

I am facing the issue where when I am running my spring boot application via Command line
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dspring.profiles.active=dev -Dserver.port=8083"
This works fine, but running as Application in intellij I am getting below errors -
Application run failed,
exc.stack=org.springframework.context.ApplicationContextException:
Unable to start web server; nested exception is org.springframework.context.ApplicationContextException:
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.\n\tat org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:155)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389)\n\tat org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
What can be the possible reasons, and where should I look into configurations fixes?
There are other questions on this pattern, but none of them have mentioned the error -
Spring Boot application runs fine via Maven but not via IDE Intellij IDEA
ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
(For missing servlet bean, but if this is the case, then app should not have started via command line too)
So, I could not find any answer there.
This error could occur when you have Tomcat's dependency scope as "provided", but while running the application, you are not choosing the option "Include dependencies with provided scope".
You could select that option under the Run Configuration for your app.
In some older versions of IntelliJ, you might see a checkbox to enable the same.

Why my spring-boot application is giving "ClassNotFoundException: javax.servlet.Filter" in Intellij but not in STS 3?

While running my spring-boot application I'm getting this exception:
ClassNotFoundException: javax.servlet.Filter
I am getting this in case of IntelliJ only while it is running successfully in STS 3.
Is there any generic reason?

EnvironmentCapable Not available Spring 3.2.3

Am trying to integrate Spring 3.2.3 with JSF 2.2.1 and getting an error like Caused by: java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable The class is available in my classpath (spring-core-3.2.3.RELEASE.jar) but not sure why this error occurs.
It worked fine when I removed the project from the server, clean/build and restarted again. Thanks.

grails 2.3 java.lang.NoClassDefFoundError: org/apache/batik/dom/svg/SVGOMDocument

When i run my grails application in tomcat i get the following error
java.lang.NoClassDefFoundError: org/apache/batik/dom/svg/SVGOMDocument. But the batik-svg-dom.1.7.jar is packaged in the war and in the classpath.
I don't however get this error when i am running the application in debug mode in STS.
I am using Grails 2.3 and building my war using maven. I am using FOP and have excluded the "xml-apis".
I have tried to place the batik-svg-dom.jar in the lib folder of tomcat, that did not work.
Thanks in advance.

Resources