Skip to content

Save as causes an error of constraint violation #12801

Description

@offtherailz

Description

Probably an issue of GeoStore itself, reproduced only on master, so probably this can be caused by recent change here

geosolutions-it/geostore#577

@axl8713 need to apply scripts to dev, right? If so, need to create a PR for migration guidelines contextually to these changes, or introduce flyway

Screencast.from.2026-08-14.12-09-40.webm

How to reproduce

Expected Result

  • A new resource is created

Current Result

  • A save notification appears. (with wrong message).

  • Not browser related

Browser info (use this site: https://www.whatsmybrowser.org/ for non expert users)
Browser Affected Version
Internet Explorer
Edge
Chrome
Firefox
Safari

Other useful information

Log:

14-Aug-2026 10:06:26.972 WARNING [ajp-nio-0.0.0.0-8009-exec-6] org.apache.cxf.phase.PhaseInterceptorChain.doDefaultLogging Application {http://impl.rest.services.geostore.geosolutions.it/}RESTResourceServiceImpl has thrown exception, unwinding now
	org.apache.cxf.interceptor.Fault: could not execute statement [ERROR: null value in column "resource_id" of relation "gs_stored_data" violates not-null constraint
  Detail: Failing row contains (68588, {"widgets":[{"id":"6df30870-53c8-11ea-bc50-9931c4e30b1f","layer"..., null).] [insert into geostore.gs_stored_data (stored_data,id) values (?,?)]; SQL [insert into geostore.gs_stored_data (stored_data,id) values (?,?)]; constraint [resource_id]
		at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
		at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
		at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:217)
		at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:105)
		at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
		at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96)
		at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
		at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
		at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
		at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:233)
		at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:207)
		at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:159)
		at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:224)
		at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:312)
		at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:217)
		at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:590)
		at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:279)
		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197)
		at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142)
		at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:57)
		at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166)
		at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:142)
		at org.springframework.security.web.FilterChainProxy.lambda$doFilterInternal$2(FilterChainProxy.java:235)
		at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:376)
		at org.springframework.security.web.access.intercept.AuthorizationFilter.doFilter(AuthorizationFilter.java:101)
		at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:385)
		at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)
		at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)
		at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:385)
		at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)
		at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:385)
		at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:181)
		at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:385)
		at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
		at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:385)
		at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:198)
		at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
		at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:385)
		at it.geosolutions.geostore.services.rest.security.oauth2.openid_connect.CompositeOpenIdConnectFilter.doFilter(CompositeOpenIdConnectFilter.java:283)
		at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:385)
		at org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter.doFilterInternal(DefaultLogoutPageGeneratingFilter.java:60)
		at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
		at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:385)
		at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:246)
		at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:232)
		at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:385)
		at org.springframework.security.web.authentication.ui.DefaultResourcesFilter.doFilter(DefaultResourcesFilter.

Security vulnerabilities

Do not report security vulnerabilities in public issues.

If you believe you have found a vulnerability in MapStore, please use GitHub private vulnerability reporting or contact the security address listed in SECURITY.md.

Activity

  1. added this to the 2026.03.00 milestone on Aug 14, 2026
  2. assigned and unassigned on Aug 14, 2026
  3. added theissue type on Aug 14, 2026
  4. tdipisa commented on Aug 14, 2026

    @tdipisa
    Member

    @offtherailz due to geosolutions-it/geostore#580 can you confirm 2026.02.xx (current QA) is not affected?

  5. offtherailz commented on Aug 14, 2026

    @offtherailz
    MemberAuthor

    Yes @tdipisa the backport conflicted and so it was not applied to 2.6.x yet. It affect only master (dev) at the moment.

  6. modified the milestones: 2026.03.00, 2026.02.01 on Aug 17, 2026
  7. tdipisa commented on Aug 17, 2026

    @tdipisa
    Member

    @axl8713 the migration guidelines simply need to be updated for this to inform about the migration guidelines:
    geosolutions-it/geostore#577

  8. axl8713 commented on Aug 21, 2026

    @axl8713
    Collaborator
  9. 1 remaining item

  10. self-assigned this
    on Aug 27, 2026
  11. ElenaGallo commented on Aug 31, 2026

    @ElenaGallo
    Contributor

    @offtherailz The issue still seems to be present in MS QA even though it was backported here: #12832

  12. tdipisa commented on Aug 31, 2026

    @tdipisa
    Member

    @offtherailz The issue still seems to be present in MS QA even though it was backported here: #12832

    @ElenaGallo that's probably because the migration script documented with this still need to be executed in QA DB. @mahesh-wor can you please have a look?

  13. mahesh-wor commented on Aug 31, 2026

    @mahesh-wor
    Contributor

    @tdipisa i have applied the migration script to QA db, and the Save As is working as expected.

    geostore_mapstore2_qa=> SELECT
        r.id,
        r.name,
        r.stored_data_id
    FROM geostore.gs_resource r
    WHERE r.stored_data_id IS NOT NULL
    ORDER BY r.id DESC
    LIMIT 10;
      id   |                 name                  | stored_data_id
    -------+---------------------------------------+----------------
     50617 | geostore-db-migration                 |          50617
    
    
    Image Image
  14. tdipisa commented on Aug 31, 2026

    @tdipisa
    Member

    Thanks @mahesh-wor
    @ElenaGallo I kindly ask you to retest in QA. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions