sleeplessman / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

Rest call to non existing resource on Jboos Wildfly/Undertow with Javamelody returns status 500 instead of 404 #468

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Without JavaMelody GET on https://localhost:8443/test/rest/InvalidResource 
returns correct status 404
2. With JavaMelody returns wrong status 500 with exception

"java.lang.IllegalStateException: UT010006: Cannot call getWriter(), 
getOutputStream() already called"

The reason seems to be that 

1. Javamelody in FilterServletResponseWrapper.getWriter() calls 
HttpServletResponseImpl.getOutputStream().
2. After it WildFly calls HttpServletResponseImpl.doErrorDispatch() in which 
there is call HttpServletResponseImpl.getWriter()

So firstly getOutputStream() (from javamelody is called) then getWriter() from 
undertow - which causes java.lang.IllegalStateException.

I think, that method from javamelody - FilterServletResponseWrapper.getWriter() 
- shouldn't call getOutputStream() but getWriter().

This defect was found by our Test Automation suite and prevents us to use 
JavaMelody in production

Original issue reported on code.google.com by tomas.ba...@gmail.com on 20 Mar 2015 at 7:40

GoogleCodeExporter commented 9 years ago
I can reproduce an issue like this in WildFly 8.0.0 but not in WildFly 8.2.0 
and neither in Tomcat or Jetty. (To reproduce this issue in WildFly I have used 
the attached test project.)

So this is probably a WildFly issue.
Which version of WildFly do you use?
If you reproduce the issue with WildFly 8.2, can you give the source of a test 
project to reproduce the issue?

Original comment by evernat@free.fr on 21 Mar 2015 at 11:37

Attachments: