1

我确实有 spring 4.1.7 的所有罐子和瓷砖 3.0.5 版本的罐子,请在下面找到错误。

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)
4

1 回答 1

1

确保您已定义以下 bean:

@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;
}

并具有以下依赖项:

    <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>

希望能帮助到你。

于 2017-05-17T16:58:21.663 回答