i´ve switched spring mvc configuration xml javaconfig , integrated websocket sockjs.
my issue is, application websocket , configuration works fine on "localhost" (tomcat 8.0.36). when upload war package server (tomcat 8.0.32) websocket connection fails following error code:
failed open session; nested exception java.lang.illegalargumentexception: async support must enabled on servlet , filters involved in async request processing. done in java code using servlet api or adding "true" servlet , filter declarations in web.xml. must use servlet 3.0+ container] root cause java.lang.illegalargumentexception: async support must enabled on servlet , filters involved in async request processing. done in java code using servlet api or adding "true" servlet , filter declarations in web.xml. must use servlet 3.0+ container
i´am not sure reason situation.
see below initializer:
public class appinitializer extends abstractannotationconfigdispatcherservletinitializer { @override protected void customizeregistration(servletregistration.dynamic registration) { registration.setinitparameter("dispatchoptionsrequest", "true"); registration.setasyncsupported(true); } protected class<?>[] getrootconfigclasses() { return new class[] { myappconfiguration.class, myappsecurityconfiguration.class }; } protected class<?>[] getservletconfigclasses() { return null; } protected string[] getservletmappings() { return new string[]{"/"}; } protected filter[] getservletfilters() { characterencodingfilter characterencodingfilter = new characterencodingfilter(); characterencodingfilter.setencoding("utf-8"); return new filter[] { characterencodingfilter, new delegatingfilterproxy("springsecurityfilterchain").s}; }
}
in myappconfiguration.class async enabled "@enableasync":
@enablewebmvc @enablescheduling @enableasync @enablecaching @componentscan(basepackages="...") @configuration public class myappconfiguration extends webmvcconfigureradapter {
in pom.xml load javax.servlet-api
<dependency> <groupid>javax.servlet</groupid> <artifactid>javax.servlet-api</artifactid> <version>3.1.0</version> <scope>provided</scope> </dependency>
i checked spring docs didn´t find reason, why application doesn´t work on server, on localhost :-(
on localhost access tomcat directly , on server ajp connector. maybe must enabled within ajp connector support async request? ajp connector , apache webserver temporary disabled , accessed project direct tomcat url (:8080) .. same error :-/
i fixed issue ;-)
after upgrading apache tomcat vom version 8.0.32 8.5.4, works now. ´am able communicate websockets , use ajp .. so, please don´t use 8.0.32 , choose instead >= 8.5.4.
Comments
Post a Comment