2011-10-29 45 views
2

我嘗試了Spring MVC 3.1集成了Apache的Tile2.2但我發現這個錯誤TilesConfigurer已被棄用?我如何在Spring MVC 3.1中使用tile2.2?

Error creating bean with name 'tilesConfigurer' defined in ServletContext resource [/WEB-INF/tiles-context.xml]: Invocation of init method failed 

所以我尋找它在谷歌和我的Apache Tile2結構中發現有更改或棄用,但Spring MVC的3.1仍然使用舊結構體。 (有人說,我們必須修改類或等)

這些都是我的lib我使用:

tiles-api-2.2.2.jar 
tiles-core-2.2.2.jar 
tiles-el-2.2.2.jar 
tiles-jsp-2.2.2.jar 
tiles-servlet-2.2.2.jar 
tiles-template-2.2.2.jar 

ADN Spring MVC的

org.springframework.aop-3.1.0.M1.jar 
org.springframework.asm-3.1.0.M1.jar 
org.springframework.aspects-3.1.0.M1.jar 
org.springframework.beans-3.1.0.M1.jar 
org.springframework.context.support-3.1.0.M1.jar 
org.springframework.context-3.1.0.M1.jar 
org.springframework.core-3.1.0.M1.jar 
org.springframework.expression-3.1.0.M1.jar 
org.springframework.instrument.tomcat-3.1.0.M1.jar 
org.springframework.instrument-3.1.0.M1.jar 
org.springframework.jdbc-3.1.0.M1.jar 
org.springframework.jms-3.1.0.M1.jar 
org.springframework.orm-3.1.0.M1.jar 
org.springframework.oxm-3.1.0.M1.jar 
org.springframework.test-3.1.0.M1.jar 
org.springframework.transaction-3.1.0.M1.jar 
org.springframework.web.portlet-3.1.0.M1.jar 
org.springframework.web.servlet-3.1.0.M1.jar 
org.springframework.web.struts-3.1.0.M1.jar 
org.springframework.web-3.1.0.M1.jar 

任何人都知道我是如何解決這一問題?這對我有用。

回答

0

(可以通過在一個問題編輯OP回答轉換爲一個社區維基答案見Question with no answers, but issue solved in the comments (or extended in chat)

的OP寫道:

解決方案:

這不是錯誤被棄用它是關於沒有正確版本的jar文件。

我通過找到正確的罐子到我的web應用程序

解決了,這是我的罐子

commons-beanutils-1.8.3.jar 
commons-beanutils-bean-collections-1.8.3.jar 
commons-beanutils-core-1.8.3.jar 
commons-digester-2.1.jar 
jcl-over-slf4j-1.6.3.jar 
slf4j-api-1.6.3.jar 
slf4j-log4j12-1.6.3.jar 
tiles-api-2.2.2.jar 
tiles-core-2.2.2.jar 
tiles-jsp-2.2.2.jar 
tiles-servlet-2.2.2.jar 

對於一些人迷失和我一樣,沃爾瑪

3

如果您從org.springframework.web.servlet.view.tiles3包導入,您將不會得到任何明確的問題,但是如果從org.s導入pringframework.web.servlet.view.tiles2它被折舊。我通過更改導入來解決問題。 配置類

package mum.waa; 

import org.springframework.context.annotation.Bean; 
import org.springframework.context.annotation.Configuration; 
import org.springframework.web.servlet.view.tiles3.TilesConfigurer; 
import org.springframework.web.servlet.view.tiles3.TilesView; 
import org.springframework.web.servlet.view.tiles3.TilesViewResolver; 

@Configuration 
public class TilesConfiguration{ 

public TilesConfigurer tilesConfigurer() 
{ 
    final TilesConfigurer configurer = new TilesConfigurer(); 
    configurer.setDefinitions(new String[] { "WEB-INF/tiles.xml" }); 
    configurer.setCheckRefresh(true); 
    return configurer; 
} 

@Bean 
public TilesViewResolver tilesViewResolver() { 
    final TilesViewResolver resolver = new TilesViewResolver(); 
    resolver.setViewClass(TilesView.class); 
    return resolver; 
} 

} 

依賴

 <!-- Apache Tiles --> 
    <dependency> 
     <groupId>org.apache.tiles</groupId> 
     <artifactId>tiles-extras</artifactId> 
     <version>3.0.7</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.tiles</groupId> 
     <artifactId>tiles-jsp</artifactId> 
     <version>3.0.7</version> 
    </dependency> 
    <!-- Apache Tiles --> 
相關問題