1

I do have all jars of spring 4.1.7 and tiles 3.0.5 version jars, Please find below error .

SCHWERWIEGEND: Servlet.service() for servlet [mccstore] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'standard_welcome': Invocation of init method failed; nested exceptio
n is java.lang.NullPointerException] with root cause
java.lang.NullPointerException
        at org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:124)
        at org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:107)
        at org.springframework.web.servlet.view.tiles3.TilesView.afterPropertiesSet(TilesView.java:97)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
Jens
  • 67,715
  • 15
  • 98
  • 113
  • 2
    Possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it) – Jens Dec 08 '15 at 09:56
  • Why do you even have a bean of the type `TilesView` defined as a bean? You shouldn't do or have that... – M. Deinum Dec 08 '15 at 10:51
  • I have commented out tilesView .. – PArth Patel Dec 08 '15 at 10:57
  • the same question and exception: http://stackoverflow.com/questions/31944451/spring-mvc-with-tiles-3-nullpointerexception – Si mo Dec 08 '15 at 11:58

1 Answers1

1

Make sure you have defined the following beans:

@Bean
public TilesConfigurer tilesConfigurer() {
    TilesConfigurer tiles = new TilesConfigurer();
    tiles.setDefinitions("/WEB-INF/definitions.xml");
    return tiles;
}

@Bean
public UrlBasedViewResolver viewResolver() {
    UrlBasedViewResolver tilesViewResolver = new UrlBasedViewResolver();
    tilesViewResolver.setViewClass(TilesView.class);
    return tilesViewResolver;
}

and have the following dependencies:

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>

Hope it helps.

Eugene Maysyuk
  • 2,977
  • 25
  • 24