2015-09-10 73 views
0

在休息-servlet.xml中的配置之下作出..無法創建內部bean 'org.springframework.web.servlet.view.xml.MarshallingView#1e9ad27'

<property name="defaultViews">   
    <list>   
     <!-- JSON View -->   
     <bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView">   
     </bean> 

     <!-- XML view -->    
     <bean class="org.springframework.web.servlet.view.xml.MarshallingView">    
      <constructor-arg>     
       <bean class="org.springframework.oxm.castor.CastorMarshaller">     
       </bean>    
      </constructor-arg>   
     </bean>   

     <!-- PDF view -->   
     <bean class="com.hmkcode.view.PDFView">    
     </bean> 

     <!-- XLSX "Excel" view -->   
     <bean class="com.hmkcode.view.ExcelView">    
     </bean> 
    </list>  
</property> 

下面的錯誤發生..可以爲任何人提供解決方案。 在此先感謝

SEVERE: StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in ServletContext resource [/WEB-INF/rest-servlet.xml]: Cannot create inner bean 'org.springframework.web.servlet.view.xml.MarshallingView#1e9ad27' of type [org.springframework.web.servlet.view.xml.MarshallingView] while setting bean property 'defaultViews' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.view.xml.MarshallingView#1e9ad27' defined in ServletContext resource [/WEB-INF/rest-servlet.xml]: Cannot create inner bean 'org.springframework.oxm.castor.CastorMarshaller#10651e1' of type [org.springframework.oxm.castor.CastorMarshaller] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.oxm.castor.CastorMarshaller#10651e1' defined in ServletContext resource [/WEB-INF/rest-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/castor/core/util/AbstractProperties at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:290)

回答

1

看起來你在你的classpath錯過castor-core.jar。請添加它。

如果你用maven您可以添加

<dependency> 
    <groupId>org.codehaus.castor</groupId> 
    <artifactId>castor-core</artifactId> 
    <version>1.3.3</version> 
</dependency> 

到你的pom.xml重建項目,並重新部署它。

相關問題