Reputation: 153
I am trying to configure Spring Boot 1.4.3
and Apache tiles 3
. Using the configuration below I am getting:
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/beanutils/MethodUtils
When I look at the MavenDependencis the jar file commons-beanutils-1.9.3
containing MethodUtils class is there !
but why embedded tomcat8.5.6
can not see it?
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.boot.spring</groupId>
<artifactId>Spring-Boot-RSSReader</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Spring-Boot-RSSReader</name>
<description></description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
ConfigForTiles:
@Configuration
public class ConfigForTiles {
@Bean
public TilesConfigurer tilesConfigurer(){
final TilesConfigurer configurer = new TilesConfigurer();
configurer.setDefinitions(new String [] {"WEB-INF/tiles/tiles.xml"});
configurer.setCheckRefresh(true);
return configurer;
}
@Bean
public TilesViewResolver tilesViewResolver(){
final TilesViewResolver resolver = new TilesViewResolver();
resolver.setViewClass(TilesView.class);
return resolver;
}
}
Controller:
@Controller
public class IndexController {
@RequestMapping("/")
public String index(){
return "index";
}
}
application.properties:
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
mvn dependency:tree
[INFO] Scanning for projects...
[INFO] +- org.apache.tiles:tiles-jsp:jar:3.0.5:compile
[INFO] | | | +- commons-digester:commons-digester:jar:2.1:compile
[INFO] | | | | \- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO] | | | | \- commons-collections:commons-collections:jar:3.2.2:compile
Upvotes: 2
Views: 3661
Reputation: 29276
Seems you have multiple versions of commons-beanutils
in your classpath.
In your IDE you can search for commons-beanutils
- you should be able to find multiple versions of commons-beanutils
.
Maven commands that can help you debugging this:
mvn dependency:tree
mvn help:effective-pom
Try excluding commons-beanutils
from org.apache.tiles
, as follows:
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>3.0.5</version>
<exclusions>
<exclusion>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</exclusion>
</exclusions>
</dependency>
Upvotes: 1