我正在尝试在web.xml中为spring应用程序启用<async-supported>true</async-supported>
。但无法这样做。请检查以下错误。知道怎么解决吗?
Glassfish 3.1.2
Spring 3.1.2
JDK 1.7
<web-app version="3.0"
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/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/app/servlet-context.xml</param-value>
</init-param>
<async-supported>true</async-supported>
<load-on-startup>1</load-on-startup>
</servlet>
错误:
SEVERE:ContainerBase.addChild:start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException:org.xml.sax.SAXParseException; lineNumber:21; columnNumber:82; cvc-complex-type.2.4.a:无效 发现内容以元素&#39; mvc:async-support&#39;开头。之一 &#39; {&#34; http://www.springframework.org/schema/mvc&#34;:消息转换器, &#34; http://www.springframework.org/schema/mvc&#34;:参数-解析器 &#34; http://www.springframework.org/schema/mvc&#34;:返回值-处理}&#39;是 预期。在 org.apache.catalina.core.StandardContext.start(StandardContext.java:5389) 在com.sun.enterprise.web.WebModule.start(WebModule.java:498)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917) 在 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901) 在 org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733) 在 com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2019) 在 com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
更新1:
不工作
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ASYNC</dispatcher>
</filter-mapping>
ASYNC支持的JAVA MELODY工作过滤器
<filter>
<filter-name>javamelody</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>javamelody</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ASYNC</dispatcher>
</filter-mapping>
答案 0 :(得分:-1)
错误消息似乎来自Spring,而不是GlassFish。
元素&#39; mvc:async-support
&#39;在某个文件的lineNumber: 21
,columnNumber: 82
上(可能是您的beans.xml
?我不确定,我不是Spring专家)并且它无效。
该特定元素可能不在您的Spring版本中,或者XML可能格式不正确。该错误消息为您提供了3个其他选项供您选择。