Azure-Samples/azure-spring-boot-samples

[BUG] Circular view path [home]: would dispatch back to the current handler URL [/home]

aldosilva6 opened this issue · 3 comments

When I try to use the aad-b2c-web-application sample I'm getting the error: Circular view path [home]: would dispatch back to the current handler URL [/home] again

javax.servlet.ServletException: Circular view path [home]: would dispatch back to the current handler URL [/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
at org.springframework.web.servlet.view.InternalResourceView.prepareForRendering(InternalResourceView.java:210) [spring-webmvc-5.3.30-20230914.073922-31.jar:5.3.30-SNAPSHOT]
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:148) [spring-webmvc-5.3.30-20230914.073922-31.jar:5.3.30-SNAPSHOT]
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316) [spring-webmvc-5.3.30-20230914.073922-31.jar:5.3.30-SNAPSHOT]
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1406) [spring-webmvc-5.3.30-20230914.073922-31.jar:5.3.30-SNAPSHOT]
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1150) [spring-webmvc-5.3.30-20230914.073922-31.jar:5.3.30-SNAPSHOT]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089) [spring-webmvc-5.3.30-20230914.073922-31.jar:5.3.30-SNAPSHOT]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965) [spring-webmvc-5.3.30-20230914.073922-31.jar:5.3.30-SNAPSHOT]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) [spring-webmvc-5.3.30-20230914.073922-31.jar:5.3.30-SNAPSHOT]

Put in the browser: http://localhost:8080/

The code bellow causes this:

@GetMapping(value = { "/", "/home" }) 
public String index(Model model, OAuth2AuthenticationToken token) {
        initializeModel(model, token);
        return "home";
}

I expected going to the login page, but get into loop

image

Hi @aldosilva6 , sorry for the late reply.
Could you try with spring-cloud-azure-starter-active-directory-b2c:4.11.0, refer to https://github.com/Azure/azure-sdk-for-java/wiki/Spring-Versions-Mapping .

Thanks @Netyyyy

Using Spring-Boot:2.7.11 and spring-cloud-azure-starter-active-directory-b2c:4.11.0 it worked.

           <dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-thymeleaf</artifactId>
	</dependency>
       to add home.html first line <html xmlns:th="http://www.thymeleaf.org"> and  clean and update project