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

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?

Related

Spring Boot Jersey Starter (2.7.x) App fails when running java -jar but works with mvn spring-boot:run

I have a Spring Boot Jersey Starter based App which was working fine until 2.6.11 of SpringBoot.
From 2.7.0 I have noticed that mvn spring-boot:run works fine but java -jar target/my_jar fails with this exception
***************************
APPLICATION FAILED TO START
***************************
Description:
Web application could not be started as there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context.
Action:
Check your application's dependencies for a supported servlet web server.
Check the configured web application type.
I read the release notes and wasn't helpful. Any pointers?

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?

spring boot application with JDK 14 fails to start. no error either

I am upgrading
(JDK 8 + spring boot application (2.1.0.RELEASE)) TO
(JDK 14 + spring boot application (2.3.3.RELEASE))
I am using --enable-preview as part of java command but it silently fails. can't see any logger stmts either. --verbose option is not throwing any error nor warning.
any help?
Thanks for responses. Here are more details.
I use maven to compile and use java directly to run it (thru a shell script) java -jar ./target/fat_00.1.jar
Why I am doing both (spring FM + JDK) at same time?
upgrading JDK kind of forced me to upgrade SFM 2.1 to 2.3 (latest)
what else I tried?
I tried "--enable-preview" while compiling (by changing maven pom maven-compiler-plugin plugin) and adding to "java" command prompt
** java -verbose --enable-preview -jar ./target/fat_00.1.jar**
But none of them give any clue. biggest problem is my spring application exits without any error.
IF I upgrade ONLY spring FW keeping JDK1.8 I get following error:
findById(java.lang.Long) in com.model.repository.MyRepository clashes with findById(ID) in org.springframework.data.repository.CrudRepository
I understand the error its throwing, but does it mean it has no backward compatibility?
How do I find what's going on? without any error thrown anywhere, it is really frustrating.

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