在类路径资源[META-INF / spring / app-context.xml]中定义名称为“tilesConfigurer”的bean时出错

时间:2015-07-07 07:50:43

标签: java spring spring-mvc

我收到此错误“org.springframework.beans.factory.BeanCreationException:在类路径资源[META-INF / spring / app-context.xml]中定义名称为'tilesConfigurer'的bean创建错误:调用init方法失败;嵌套异常是java.lang.NullPointerException“当我在eclipse中创建maven安装但在本地运行eclipse时正常运行。 “tiles-definition.xml”在WEB-INF / tiles中,“app-context.xml”在

a = [1, 2, 3]
b = [2, 3, 4]
c = a + b

这是堆栈跟踪:

<!-- Mapping for reading tiles xml configuration -->
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer" > 
    <property name="definitions">
        <list>
            <value>/WEB-INF/tiles/tiles-definitions.xml</value>
        </list>
    </property>
</bean>

1 个答案:

答案 0 :(得分:0)

我有一个使用Tiles3的项目,这就是我配置它的方式:

<!-- Tiles -->
<bean id="tilesViewResolver"
    class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass"
        value="org.springframework.web.servlet.view.tiles3.TilesView" />
</bean>
<bean id="tilesConfigurer"
    class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
    <property name="definitions">
        <list>
            <value>/WEB-INF/tiles/tiles-definitions.xml</value>
        </list>
    </property>
</bean>

在你的pom.xml中:

<dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-extras</artifactId>
        <version>3.0.5</version>
    </dependency>