struts2 restful支持

http://mvnrepository.com/

因为没有使用maven,直接下载jar

struts2的restplugin必须依赖xstream和convention plugin

下载 

struts2-convention-plugin-2.3.4.jar

xstream-1.4.9.jar

struts2-rest-plugin-2.3.4.jar

注意不能一味追求最新版本。我使用的struts2是2.3.4版的,当时下载了rest plugin的版本是最新的2.5.5版的。

结果启动tomcat的时候,一直报错。后来下载了和struts2一样的版本的convention plugin和rest plugin之后

启动tomcat就没问题了。

Jan 18, 2013 9:16:44 AM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/C:/Users/John/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HitPlay/WEB-INF/lib/struts2-rest-plugin-2.3.7.jar!/struts-plugin.xml:36:138
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:483)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: Unable to load configuration. - bean - jar:file:/C:/Users/John/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HitPlay/WEB-INF/lib/struts2-rest-plugin-2.3.7.jar!/struts-plugin.xml:36:138
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:71)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:471)

相关推荐