dsollen
dsollen

Reputation: 6459

!asyncSupported exception when switch from Jetty 7 to Jetty 9

we recently upgraded our jetty version. when we did this both of our legacy gui war files, which no one has modified in some time, stopped working correctly. I believe I hunted the root cause to the proxy (used to proxy to a restful interface on another port), any call to the proxy throws the exception:

 IllegalStateException: !asyncSupported

I'm not sure why this would occure with 1.9 but not with the old jetty. I can't build the war file currently, it was a mess that only one developer could ever build, but I trid unzipping it with jetty -x and ading to the servlet section of the web.xml file this:

<async-supported>true</async-supported>

and then rezipping it with jar c command. that didn't seem to help, though now i get exceptions in my jetty log fhile while before they would only show in the browser.

can anyone tell me what to do to activate async support and/or why the switch in jetty would cause this?

Upvotes: 6

Views: 5537

Answers (4)

user1889970
user1889970

Reputation: 736

For Java based config you may use

@javax.servlet.annotation.WebServlet(name = "HelloWorld",urlPatterns = { "/MyServlet" },asyncSupported =true)

Upvotes: 1

Changel
Changel

Reputation: 81

My exception is the same to you. then I put "<async-supported>true</async-supported>" append to every servlet and filter. it work well. For excample

<filter>
    <filter-name>continuation</filter-name>
    <filter-class>org.eclipse.jetty.continuation.ContinuationFilter</filter-class>
    <async-supported>true</async-supported>
</filter>

<servlet>
    <servlet-name>cometd</servlet-name>
    <servlet-class>org.cometd.annotation.AnnotationCometdServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
</servlet>

the other hand. if you used jetty9.x. you'd better update your comet jar to version 3.0.x or later. I hope it will help you.

Upvotes: 7

Keilaron
Keilaron

Reputation: 467

I can't (yet) put this as a comment, but I'd like to add: If you are having this trouble and have added the async-supported tag as appropriate (or are using Jetty 8), make sure your filters also support async or are not used with the servlet in question.

Upvotes: 1

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49515

Ah, the evolution of the spec ...

  • Jetty 7 was Servlet 2.5 (no async there)
  • Jetty 8 was Servlet 3.0 (async introduced) - spec was vague on what was default, so Jetty defaulted to async-supported == true
  • Jetty 9 is Servlet 3.1 (even more async) - the spec was clarified, and jetty chose its default poorly. The default according to the spec is async-supported == false

That's why you didn't have to specify async-supported in the past, but now you do.

Bug about this bugs.eclipse.org/410893

Commit: 9bf7870c7c8a209f2660f63c14dd4acb62b07533

Upvotes: 9

Related Questions