Reputation: 13
hello i have made an webapp based this course
but it gives error when creating a beans of TilesConfig.java
also it is my app source app file
and my log file
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.708 s <<< FAILURE! - in com.cafe2.webapp.WebappApplicationTests
contextLoads Time elapsed: 0.002 s <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tilesConfigurer' defined in class path resource [com/cafe2/webapp/config/TilesConfig.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No URL for ServletContext resource [/WEB-INF/tiles.xml]
Caused by: java.lang.IllegalArgumentException: No URL for ServletContext resource [/WEB-INF/tiles.xml]
Caused by: java.io.FileNotFoundException: ServletContext resource [/WEB-INF/tiles.xml] cannot be resolved to URL because it does not exist
Upvotes: 0
Views: 273
Reputation: 1
It seems your config package and controller package at same level.
ice package org.o7planning.sbtiles.*;
. Reduce the package level for SpringBootJspTilesApplication class OR increase the package level for TilesConfig and MainController classes. Because class annotated with @SpringBootApplication start scanning base packages from this level only.
Please consider defining controller and config package as below:
limit SpringBootJspTilesApplication be in package org.o7planning.sbtiles;
TilesConfig be in package org.o7planning.sbtiles.config;
MainController be in package org.o7planning.sbtiles.controller;
Upvotes: 0