我想運行一個彈簧應用程序。我的web.xml看起來java.lang.IllegalStateException:在啓動彈簧應用程序時沒有名爲encodingFilter的過濾器
<?xml version="1.0" encoding="utf-8"?>
<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/beans.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/version/2.0/*</url-pattern>
</servlet-mapping>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/version/2.0/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
,我得到錯誤
java.lang.IllegalStateException:在org.eclipse.jetty.servlet.ServletHandler.updateMappings無過濾器命名爲encodingFilter (ServletHandler的.java:1148) 在org.eclipse.jetty.servlet.ServletHandler.setFilterMappings(ServletHandler.java:1249) 在org.eclipse.jetty.servlet.ServletHandler.addFilterMapping(ServletHandler.java:1079)
和我創建一個碼頭,PKG爲jar文件並運行它作爲 的Java
我剛跑了你的代碼在碼頭7個作品的魅力 – ant