我想解決我的項目能夠使用瓷磚。但是當我按照說明操作時,我得到了這個錯誤。鑑於視圖類[org.springframework.web.servlet.view.tiles3.TilesView]是不是類型[org.springframework.web.servlet.view.AbstractUrlBasedView]
彈簧servlet.xml中
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
">
<!-- <mvc:resources mapping="/resources/**" location="/resources/mytheme/"
/> <mvc:annotation-driven /> -->
<context:annotation-config />
<context:component-scan base-package="com" />
<context:annotation-config />
<mvc:annotation-driven />
<!-- To prevent browser's back button on displaying secured resource after
logout -->
<bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="cacheSeconds" value="0" />
</bean>
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
p:location="/WEB-INF/jdbc.properties" />
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close" p:driverClassName="${jdbc.driverClassName}"
p:url="${jdbc.databaseurl}" p:username="${jdbc.username}" />
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>com.musicstore.model</value>
</list>
</property>
<property name="configurationClass">
<value>org.hibernate.cfg.AnnotationConfiguration</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${jdbc.dialect}</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!-- spring tiles -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass">
<value>
org.springframework.web.servlet.view.tiles3.TilesView
</value>
</property>
</bean>
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tile/general.xml</value>
</list>
</property>
</bean>
<!-- <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"
/> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix"
value=".jsp" /> </bean> -->
<tx:annotation-driven />
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- Spring Internationalizations -->
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:messages" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="defaultLocale" value="en" />
</bean>
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="language" />
</bean>
<bean id="handlerMapping"
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="interceptors">
<ref bean="localeChangeInterceptor" />
</property>
</bean>
</beans
例外:
嚴重:異常發送上下文初始化事件監聽器 類org.springframework.web.context.ContextLoaderListener 組織的 實例。 springframework.beans.factory.BeanCreationException:錯誤 在ServletContext中定義名爲'viewResolver'的Bean創建資源[/ WEB-INF/spring-s ervlet.xml]:設置屬性值時出錯; 嵌套的異常是 org.springframework.beans.PropertyBatchUpdateException;嵌套0PropertyAccessExceptions(1):PropertyAccessException 1: org.springframework.beans.MethodInvocationException:屬性 'viewClass'引發異常;嵌套異常是 java.lang.IllegalArgumentException:給定視圖類 [org.springframework.web.servlet.view.tiles3.TilesView]不是 [org.springframework.web.servlet.view.AbstractUrlBasedView] org .springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) 在 org.springframework.beans .factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.Abstr actAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 在 org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:294) 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:225) 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java :193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) 在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) 在 org.springframework.web .context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384) 在 org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) 在 org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener的.java:111) at org.apache.catalina.core.StandardContext.listenerStart (StandardContext.java:4772) at org.apache.catalina.core.StandardContext.startInternal(StandardContext。Java的:5196) 在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 在 org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1409) 在 org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1399) at java.util.concurrent.FutureTask.run(Unknown Source)at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source )at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source)at java.lang.Thread.run(Unknown Source)引起者: org.springframework.beans.PropertyBatchUpdateException;嵌套0PropertyAccessExceptions(1):PropertyAccessException 1: org.springframework.beans.MethodInvocationException:屬性 'viewClass'引發異常;嵌套的異常是 java.lang.IllegalArgumentException異常: [org.springframework.web.servlet.view.tiles3.TilesView給定視圖類是 [org.springframework.web.servlet.view.AbstractUrlBasedView]類型的不 組織.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102) 在 org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues (AbstractAutowireCapableBeanFactory.java:1393) ... 22更多
謝謝!
什麼是您的項目中的你的Spring模塊的版本? – erhun 2015-04-05 21:15:23