Project with SpringBoot and TilesConfigurer

Answered

Hello, I have an Spring boot app that runs in Maven without any problem but not in IntelliJ:

https://github.com/skpavlenko/shopizer-2.0.5 

This project has a multi-pom.xml and TilesConfigurer with standart structure "\src\main\webapp\WEB-INF\tiles", "src\main\webapp\WEB-INF\views", etc. Also the project have directory "src\main\resources". If I run project under Maven with command prompt: 

mvn clean install

cd sm-shop

mvn spring-boot:run

it work properly, but when I try to run it in IntelliJ IDEA 2016.3.4 I have an error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tilesConfigurer' defined in class path resource [com/salesmanager/shop/application/ShopApplicationConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No URL for ServletContext resource [/WEB-INF/tiles/tiles-admin.xml]

 

Solutions from topics about TilesConfigurer:

1. https://intellij-support.jetbrains.com/hc/en-us/community/posts/206881925-spring-mvc-tests-do-not-run-from-IDEA
2. https://intellij-support.jetbrains.com/hc/en-us/community/posts/206885555-Spring-MVC-and-Tiles-3-views-resolve

doesn't work for me. Please help run the project.

Thanks, Sergey.

0
3 comments

Please describe in detail what "try to run it in IntelliJ IDEA 2016.3.4" means. What run configuration do you use? What parameters are set? Are you sure the classpath/working directory is set correctly? Please attach full console output log if it still doesn't work.

0

We've managed to get it working by doing 2 changes.

1. Use the following run/debug configuration with the working directory specified like on the screenshot (the same working directory you are using from Maven):

2. You have to change Tomcat dependency scope in the root pom.xml from provided to compile:

 

This is needed because of the known bug: https://youtrack.jetbrains.com/issue/IDEA-107048.

Reimport the project from Maven and it should start working.

0
Avatar
Permanently deleted user

Serge Baranov, many thanks, all right working

Yann Cebron, I started as advised Serge Baranov, thank for your attention

0

Please sign in to leave a comment.