0

I created a spring boot 2 app and when i run it on my IDE (intelliJ) it works perfectly, but when i try to deploy it to an external tomcat (tomcat version 9.0.80) it doesn't work.

When i run it on my IDE and access localhost:8080/projeto it shows me the page its supposed to show and i can navigate from there on to the other pages and do the things the webapp is meant to do. But when it runs on an external tomcat , i get an "java.lang.IllegalStateException" error caused by:

"org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [io.xxx.xxxx.MainApplication]; nested exception is java.lang.ClassCastException: org.springframework.web.context.support.ServletContextResource cannot be cast to org.springframework.core.io.ClassPathResource"

I think this is because the jar package dependency I introduced conflicts with tomcat. But I don't know how to troubleshoot this error. Because another project has introduced the same versions of "org.springframework:spring-web:5.3.3" and "org.springframework:spring-core:5.3.3", it can successfully run on external tomcat. (org.springframework.web.content.support.ServletContextResource from "org.springframework:spring-web:5.3.3", org.springframework.core.io. ClassPathResource from "org.springframework:spring-core:5.3.3").

I want to know how to troubleshoot such problems.

marcel h
  • 742
  • 1
  • 7
  • 20

0 Answers0