I am trying to add a Spring fox Swagger UI to my existing Spring Boot project.
My issue is that all the paths are working normally like "/v2/api".. except for "/swagger-ui.html".
The error I get everytime is :
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Oct 30 11:11:37 CET 2019
There was an unexpected error (type=Not Acceptable, status=406).
Could not find acceptable representation
and the error in debut :
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
When I tried to handle the exception on my Exception Handler, I found that the acceptable type is "application/json" as I use Spring MVC.
Any idea how to resolve that ?
cheers.
Related
I was building spring security web application using "https://spring.io/guides/gs/securing-web/" but im getting error as " Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Tue Dec 20 11:47:42 IST 2022
There was an unexpected error (type=Internal Server Error, status=500). "pls help!!
i tried to add some jsp dependencies / to use # configuration but still same error and i am expecting the message to be displayed
I followed steps given in https://spring.io/guides/gs/spring-boot/ for building a springboot application. I am using intellij & Maven, Application started without any errors but when i tried to access hpp://localhost:8080. I am getting an error as below
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Mon Aug 21 08:01:16 IST 2017
There was an unexpected error (type=Not Found, status=404).
No message available
It's mostly likely that either the #RestController or #RequestMapping annotations are missing from your controller class.
You can compare you code to the completed example here, to see if there's anything missing:
https://github.com/spring-guides/gs-spring-boot/blob/master/complete/src/main/java/hello/HelloController.java
I am working on a project with Thymeleaf, Spring and Angular. I have a span in my html file which is as follows:
<span ng-if="isFurious == '1'" th:text="#{furious-message(${furious_bdate}, ${furious.edate)}" style="color:red;font-weight:bold;"></span>
And the relevent message property as follows:
furious-message=Object was from {0} till {1} in furious
I get the following error when page is loaded
**Whitelabel Error Page**
This application has no explicit mapping for /error, so you are seeing this as a fallback.
There was an unexpected error (type=Internal Server Error, status=500).
Exception evaluating SpringEL expression: "document.begin_date" (units:205)
In my Java console I have the following error:
Property or field 'bdate' cannot be found on null
'bdate' and 'edate' are coming from angular controller.
Kindly let me know if what am I doing wrong.
Thanks and Regards.
How do I force Spring to always convert uncaught exception to JSON instead of HTML page?
This is what I get when request is made from Chrome's REST client plugin:
{
timestamp: 1425041457798
status: 404
error: "Not Found"
exception: "com.some.my.Exception"
message: "/rrr does not exist"
path: "/test/rrr"
}
But this is what I get when I access it from browser or from Jersey API (you see parsed HTML):
Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.Fri Feb 27 13:37:27 CET 2015There was an unexpected error (type=Not Found, status=404).No message available
I know this can be done somehow by setting the request headers but I want JSON response to be the only variant.
First we need add some exception resolver for exception that trows inside controllers. I prefer extend ResponseEntityExceptionHandler and add own method, but there is a great article on spring.io: http://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc
After that if you still get following page you can override org.springframework.boot.autoconfigure.web.ErrorController. There are an example: BasicErrorController. But this works only if you use spring boot application with embedded container. For example, if you will create war file form spring boot project and will deploy under tomcat, you will get standard tomcat error page.
So this mean that ErrorController is not common solution.
In my case i throws exceptions inside filters, that why /error page shown. So solution will be write own filter that converts exceptions to JSON representation. This solution should work for every container/server, and you can get more information about exception.
I am getting error as provided below:
Jul 06, 2014 3:52:02 PM org.apache.cxf.ws.addressing.soap.MAPCodec restoreExchange WARNING: Response message does not contain WS-Addressing properties. Not correlating response.
Jul 06, 2014 3:52:02 PM org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor handleMessage
WARNING: Request does not contain Security header, but it's a fault.
Jul 06, 2014 3:52:03 PM org.apache.cxf.ws.addressing.ContextUtils retrieveMAPs
WARNING: WS-Addressing - failed to retrieve Message Addressing Properties from context
Exception in thread "main" org.apache.cxf.binding.soap.SoapFault: The signature or decryption was invalid
at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84)
I have some complete example at https://github.com/sampleref/CXFSecurity Please suggest some inputs as it is important for me. Also full details can be found at CXF STS client throws Request does not contain Security header/Response message does not contain WS-Addressing properties
Thanks
I'll put this answer for anyone else who Googles this error and arrives here.
I had the same problem with a JSF2 maven web application running on JBoss Applicatoin server, but I imagine it might happen for many other types of web apps using servlet containers for token-based security (i.e. SAML).
Simply make sure that any passwords you store in configuration files (mine was in standalone.xml) to utilise token-based security are not changed or updated, otherwise this error will occur.