tranjith / 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

Closed GoogleCodeExporter closed 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:

GoogleCodeExporter commented 9 years ago
Any news?

Original comment by evernat@free.fr on 3 Apr 2015 at 10:26

GoogleCodeExporter commented 9 years ago
No response from the reporter, so resolving as invalid/incomplete.

Original comment by evernat@free.fr on 12 Apr 2015 at 2:52

GoogleCodeExporter commented 9 years ago
Sorry for delayed response. We have postponed this 'issue' due to more urgent 
problems. We have found that only old REST API,written in Spring MVC, has this 
issue. The new ones, build on RESTEasy, behave correctly. We have solved this 
'issue' by url-exclude-pattern parameter in web.xml to avoid failing test. So 
this could be resolved as invalid

Original comment by tomas.ba...@gmail.com on 4 May 2015 at 10:29

GoogleCodeExporter commented 9 years ago
ok, thanks

Original comment by evernat@free.fr on 4 May 2015 at 3:06