[Geoserver-devel] REST API no longer working on main?

Hi,
the REST API does not seem to be working anymore on the main branch,
I get the same exception both locally and on other demo servers (using Tomcat and the latest GeoServer nightly build):

javax.servlet.ServletException: Circular view path [rest]: would dispatch back to the current handler URL [/geoserver/rest] 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)
	at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:148)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)
	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1376)
	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1121)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1459)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1631)
	

And here is the equivalent trace from a Tomcat deploy:

javax.servlet.ServletException: Circular view path [rest]: would dispatch back to the current handler URL [/geoserver/rest] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
	org.springframework.web.servlet.view.InternalResourceView.prepareForRendering(InternalResourceView.java:210)
	org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:148)
	org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)
	org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1376)
	org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1121)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:28)
	org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:73)

So it does not seem container dependent…
At first I thought, this may be the Spring upgrade… but turns out, the REST API is working
fine on 2.20.x (again, Tomcat + latest build).

I quickly looked through the latest commits but I don’t see anything obvious that might cause this behavior… and yet, what caused it should be pretty recent, I was using the REST API on main, without issues, one or two days ago…

Is the above error ringing any bell to anyone?

Cheers
Andrea

···

GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 333 8128928

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail

Is there any chance of geowebacache change causing this? I did add a servlet listener to gwc startup to configure logging, but I did not think that would be used when geowebcache is embeded.

···


Jody Garnett

GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 333 8128928

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail

I can’t replicate with latest main so far (running web-app’s Start from eclipse).
What operation are you referring to? and which maven profiles are enabled?

may be unrelated, but the first answer here [1] lead me to search for @Controller annotated classes,
and found that RestConfigurationLockCallback is annotated with @anonymised.com, where it should be just @anonymised.comonent.

In that SO answer they also mention using @anonymised.com instead of @anonymised.com We have 46 of the later,
none of the former. Might be a hint?

[1] https://stackoverflow.com/questions/18813615/how-to-avoid-the-circular-view-path-exception-with-spring-mvc-test

On Fri, 15 Apr 2022 at 12:14, Andrea Aime <andrea.aime@anonymised.com> wrote:

Hi,
the REST API does not seem to be working anymore on the main branch,
I get the same exception both locally and on other demo servers (using Tomcat and the latest GeoServer nightly build):

javax.servlet.ServletException: Circular view path [rest]: would dispatch back to the current handler URL [/geoserver/rest] 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)
	at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:148)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)
	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1376)
	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1121)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1459)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1631)
	

And here is the equivalent trace from a Tomcat deploy:

javax.servlet.ServletException: Circular view path [rest]: would dispatch back to the current handler URL [/geoserver/rest] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
	org.springframework.web.servlet.view.InternalResourceView.prepareForRendering(InternalResourceView.java:210)
	org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:148)
	org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)
	org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1376)
	org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1121)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:28)
	org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:73)

So it does not seem container dependent…
At first I thought, this may be the Spring upgrade… but turns out, the REST API is working
fine on 2.20.x (again, Tomcat + latest build).

I quickly looked through the latest commits but I don’t see anything obvious that might cause this behavior… and yet, what caused it should be pretty recent, I was using the REST API on main, without issues, one or two days ago…

Is the above error ringing any bell to anyone?

Cheers
Andrea

==

GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 333 8128928

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail


Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Gabriel Roldán

Ah, thank you for the hint… indeed does not happen with a vanilla GeoServer, breaks the moment
the OGC API module is plugged in.

The issue is indeed related to the Spring upgrade… right after the upgrade, parts of the OGC APIs would
not work anymore, due to lack of converters set up in the OGC API dispatcher… which in turn was
related to this one liner change:

https://github.com/geoserver/geoserver/pull/5772/files#diff-e2a648d6b8dcdcbc9402cf852d0073bd9953c45cad49c28eb0026f241e799177R134

I’ve found that the handler adapter no longer had the converters wired in, because they are now injected through
a Spring factory method (this is a change that occurred inside Spring)… so I made another change to get those back, here:
https://github.com/geoserver/geoserver/commit/ff21be0b30d94034df6cd5f26d305a6d72dfde1c#diff-e2a648d6b8dcdcbc9402cf852d0073bd9953c45cad49c28eb0026f241e799177R132

(also tried to discuss that change with you in the PR, see https://github.com/geoserver/geoserver/pull/5791, but got no follow up)

This last change is what is causing the REST API to break… I’m guessing the auto-wiring is breaking something
in the REST API, possibly because Spring is not making it easy to have two REST APIs sitting in the same context
(something that is definitely not desirable anyways, OGC API and REST are meant to work in different ways, the
less they share, the better).

Maybe it can be solved by creating a sub-context for the OGC API? But I’m not sure how to go about creating it.
This other avenue seems to work, basically programmatically replicating what the auto-wiring would do,
without apparent interference over in the REST API:

https://github.com/geoserver/geoserver/pull/5817

Cheers
Andrea

···

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 333 8128928

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail