I always get a "NoSuchMethodError" in my Spring Boot application when I try to redirect to a html-file and I don't understand where this is coming from. Hope someone can help.
Background: An external server is sending some information to my server by calling a method via url /resolce. This method processed the information and shall deliver the information to a html-file via redirecting. The processing of the information works fine, but when it comes to the redirect I get an NoSuchMethodError. I thought the template engine can't find the view, but the configuration seems fine.
Here is the stacktrace:
Exception Processing ErrorPage[errorCode=0, location=/error]
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;
at org.apache.catalina.core.ApplicationHttpRequest.setRequest(ApplicationHttpRequest.java:708)
at org.apache.catalina.core.ApplicationHttpRequest.<init>(ApplicationHttpRequest.java:114)
at org.apache.catalina.core.ApplicationDispatcher.wrapRequest(ApplicationDispatcher.java:917)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:358)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:394)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:175)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
The method:
@PostMapping ( "response" )
public ModelAndView postResponse ( ..., UriComponentsBuilder ucb, HttpServletRequest request ) {
byte [ ] samlResponseAsBytes = DatatypeConverter.parseBase64Binary ( samlResponse );
...
return new ModelAndView ( "redirect:" + ucb.path ( "/delivery" ).build ( ).toString ( ) );
}
Application.properties
...
spring.thymeleaf.prefix = classpath:views/
spring.thymeleaf.suffix = .html
spring.thymeleaf.check-template-location = true
spring.thymeleaf.cache = false
spring.resources.static-locations = classpath:resources/
spring.resources.cache.period = 0
I've tried several locations for the delivery.html but as it is configured it should be under resources/views.
I can upload more informations, if neccessary.
Can someone help me please?