我試圖在web.xml中爲彈出應用程序啓用<async-supported>true</async-supported>
。但無法這樣做。請檢查以下錯誤。任何想法如何解決它?@Async支持不能與glassfish 3.1.2和Spring 3.1.2一起工作
Glassfish的3.1.2
春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: Invalid content was found starting with element 'mvc:async-support'. One of '{" http://www.springframework.org/schema/mvc ":message-converters, " http://www.springframework.org/schema/mvc ":argument-resolvers, " http://www.springframework.org/schema/mvc ":return-value-handlers}' is expected. at org.apache.catalina.core.StandardContext.start(StandardContext.java:5389) at com.sun.enterprise.web.WebModule.start(WebModule.java:498) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2019) at 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>
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>
請分享你的spring配置,這是問題所在。你不能在你的web.xml中定義這個。這純粹是一件春天的事情。 –
Essex,它在web.xml中完全合法。我有在web.xml中使用async進行javamedly監控的配置。它的工作沒有任何問題。但是,對於我的spring servlet,使用過濾或servlet標記的異步標記無法正常工作...請參閱更新後的問題 – Kenshin
它只是引入異步支持的標記會停止所有操作。春季配置文件是有效的,我沒有改變這些文件。如果我刪除這個標籤,一切正常 – Kenshin