Problem with disabling stacktrace
See original GitHub issueMy code is:
@Configuration
public class ProblemJsonConfiguration {
@Bean
public ObjectMapper objectMapper() {
return new ObjectMapper().registerModule(new ProblemModule().withStackTraces(false));
}
}
@ControllerAdvice
public class ExceptionHandler implements ProblemHandling { ... }
and response always contains field stackTrace
:
{
"cause": null,
"stackTrace": [
{
"methodName": "resolveArgument",
"fileName": "AbstractNamedValueMethodArgumentResolver.java",
"lineNumber": 123,
"className": "org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver",
"nativeMethod": false
},...
],
"type": "about:blank",
"title": "Bad Request",
"status": "BAD_REQUEST",
"detail": "Failed to convert value of type [java.lang.String] to required type ...",
"instance": null,
"parameters": {},
"message": "Bad Request: Failed to convert value of type [java.lang.String] to required type ...",
"localizedMessage": "Bad Request: Failed to convert value of type [java.lang.String] to required type ...",
"suppressed": []
}
I followed steps on https://github.com/zalando/problem-spring-web/blob/master/README.md#stack-traces-and-causal-chains
Tried this:
@ControllerAdvice
class ExceptionHandling implements ProblemHandling {
@Override
public boolean isCausalChainsEnabled() {
return false;
}
}
and this: server.error.include-stacktrace=NEVER
There is no way to disable stactTrace. Am I doing something wrong?
BTW, Is there possibility to rename and disable some fields?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Disable the default stacktrace error response in Jetty
We received a PenTest finding stating that the stack trace given from the 400 "Unable to Parse" Jetty error (below) gives the attacker...
Read more >Disable stacktraces in Tomcat's error pages to make it ready ...
Disable stacktraces in Tomcat's error pages to make it ready for production ... I am running a Tomcat on AWS. The problem is...
Read more >How to avoid the detailed stack trace from showing up ... - IBM
For some security consideration, customer usually asks to hide detailed stack trace to avoid sensitive information to be showed. For example, customer wants...
Read more >How to Enable/Disable the Stack Trace - Mura Docs v7.0
If you wish to disable this feature, simply append /?showtrace=0 to the URL, and the stack trace should disappear after reloading your browser....
Read more >Hide stack trace thrown by Tomcat while deploying ...
Hide the stack trace thrown by Tomcat (Application Server) when something goes wrong or there is an error in some configuration file while...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FWIW, I just encountered the same issue (using spring boot 2 M6). Ended up with registering modules like this::
I was also facing the same issue with Spring boot(2.0.2.RELEASE) MVC based application. If you are extending WebMvcConfigurerAdapter or implementing WebMvcConfigurer interface to customize the default behaviour just override the configureMessageConverters method of the same by adding the following code.
It worked for me.
Thanks