在spring mvc中配置了tiles后,启动服务器会报以下错误
spring-servlet.xml中配置tiles的语句<!--tiles页面解析器--><beanid="tilesResolver"class="org.sprin...
spring-servlet.xml中配置tiles的语句
<!-- tiles页面解析器 -->
<bean id="tilesResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.tiles2.TilesView</value>
</property>
<property name="order">
<value>1</value>
</property>
</bean>
<!-- tiles配置器 -->
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<!-- 添加tiles页面配置文件 -->
<value>/WEB-INF/tiles-defs/tiles-defs.xml</value>
</list>
</property>
<!-- <property name="preparerFactoryClass"
value="org.springframework.web.servlet.view.tiles2.SpringBeanPreparerFactory" /> -->
</bean>
报的错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tilesConfigurer' defined in class path resource [spring-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/tiles/servlet/context/ServletTilesApplicationContext
Caused by: java.lang.NoClassDefFoundError: org/apache/tiles/servlet/context/ServletTilesApplicationContext 展开
<!-- tiles页面解析器 -->
<bean id="tilesResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.tiles2.TilesView</value>
</property>
<property name="order">
<value>1</value>
</property>
</bean>
<!-- tiles配置器 -->
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<!-- 添加tiles页面配置文件 -->
<value>/WEB-INF/tiles-defs/tiles-defs.xml</value>
</list>
</property>
<!-- <property name="preparerFactoryClass"
value="org.springframework.web.servlet.view.tiles2.SpringBeanPreparerFactory" /> -->
</bean>
报的错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tilesConfigurer' defined in class path resource [spring-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/tiles/servlet/context/ServletTilesApplicationContext
Caused by: java.lang.NoClassDefFoundError: org/apache/tiles/servlet/context/ServletTilesApplicationContext 展开
展开全部
你的错误原因是这样的:创建bean tilesConfigurer时找不到对应的class,
因此应该三缺少jar包的缘故,试着导入tiles-servlet.jar看看
因此应该三缺少jar包的缘故,试着导入tiles-servlet.jar看看
追问
我引入了三个架包:tiles-servlet.jar tiles-core.jar tiles-jsp.jar,还是会报这样的错误,太不解了。。。完全不知道为什么呀
追答
titles和struts很多扯不清的关系,你把struts得jar包也全导进去,
最笨的方法就是这样了:所有jar包一网打尽,毕竟多导jar包也不会报错。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询