Problems to approve items with relations to other items
When trying today to approve suggested items we run into different problems where it seems, that there is wrong handling with relatedItems.
I try to explain the problems:
We had an item with three relations where I tried to use PUT as administrator to approve an item (see #64 (closed)). It didn't work and in the log it told me:
19-03-2021 15:28:58.105 [http-nio-8080-exec-5] INFO e.s.m.f.a.JwtTokenAuthenticationFilter.doFilterInternal - Valid Bearer JWT found for username: 'Administrator', 19-03-2021 15:28:58.117 [http-nio-8080-exec-5] WARN o.h.e.i.StatefulPersistenceContext.narrowProxy - HHH000179: Narrowing proxy to class eu.sshopencloud.marketplace.model.tools.Tool - this operation breaks ==, 19-03-2021 15:28:58.152 [http-nio-8080-exec-5] WARN o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions - SQL Error: 0, SQLState: 23505, 19-03-2021 15:28:58.153 [http-nio-8080-exec-5] ERROR o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions - ERROR: duplicate key value violates unique constraint "item_prev_version_item_id_uq", Detail: Key (prev_version_id)=(31237) already exists., 19-03-2021 15:28:58.156 [http-nio-8080-exec-5] ERROR e.s.m.c.MarketplaceExceptionHandler.handleServerError - Runtime exception, org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [item_prev_version_item_id_uq]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement, at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:298), at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:255), at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:528), at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61), at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242), at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:153), at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:149), at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95), at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212), at com.sun.proxy.$Proxy213.findAllBySubjectId(Unknown Source), at eu.sshopencloud.marketplace.services.items.ItemRelatedItemService.copyItemRelations(ItemRelatedItemService.java:270), at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method), at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source), at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source), at java.base/java.lang.reflect.Method.invoke(Unknown Source), at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344), at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198), at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:772), at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163), at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747), at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689), at eu.sshopencloud.marketplace.services.items.ItemRelatedItemService
EnhancerBySpringCGLIB
e906e6f9.copyItemRelations(), at eu.sshopencloud.marketplace.services.items.ItemCrudService.copyVersionRelations(ItemCrudService.java:230), at eu.sshopencloud.marketplace.services.items.ItemCrudService.revertItemVersion(ItemCrudService.java:300), at eu.sshopencloud.marketplace.services.items.ToolService.revertTool(ToolService.java:70), at eu.sshopencloud.marketplace.services.items.ToolServiceFastClassBySpringCGLIB
99f858f.invoke(), at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218), at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769), at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163), at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747), at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:366), at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99), at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747), at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689), at eu.sshopencloud.marketplace.services.items.ToolServiceEnhancerBySpringCGLIB
ec38f03e.revertTool(), at eu.sshopencloud.marketplace.controllers.tools.ToolController.revertTool(ToolController.java:61), at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method), at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source), at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source), at java.base/java.lang.reflect.Method.invoke(Unknown Source), at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190), at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138), at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106), at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:888), at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793), at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87), at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040), 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.doPut(FrameworkServlet.java:920), at javax.servlet.http.HttpServlet.service(HttpServlet.java:663), at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883), at javax.servlet.http.HttpServlet.service(HttpServlet.java:741), at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231), at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166), at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53), at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193), at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166), at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200), at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193), at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166), at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113), at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193), at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320), at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126), at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at eu.sshopencloud.marketplace.filters.auth.JwtTokenAuthenticationFilter.doFilterInternal(JwtTokenAuthenticationFilter.java:45), at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter.doFilterInternal(OAuth2AuthorizationRequestRedirectFilter.java:160), at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:92), at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92), at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77), at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56), at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119), at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334), at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215), at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178), at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358), at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271), at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193), at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166), at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100), at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119), at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193), at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166), at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93), at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119), at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193), at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166), at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201), at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119), at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193), at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166), at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202), at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96), at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541), at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139), at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92), at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74), at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:747), at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343), at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367), at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65), at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860), at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598), at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49), at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source), at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source), at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61), at java.base/java.lang.Thread.run(Unknown Source),Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement, at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:109), at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42), at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113), at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99), at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:200), at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3226), at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3751), at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:91), at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604), at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478), at java.base/java.util.LinkedHashMap.forEach(Unknown Source), at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475), at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:348), at org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:57), at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:108), at org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1309), at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1389), at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1558), at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1526), at org.hibernate.query.Query.getResultList(Query.java:165), at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:76), at org.springframework.data.jpa.repository.query.JpaQueryExecution$CollectionExecution.doExecute(JpaQueryExecution.java:126), at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:88), at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:154), at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:142), at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:618), at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:605), at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:80), at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:366), at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99), at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139), ... 133 common frames omitted, Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "item_prev_version_item_id_uq", Detail: Key (prev_version_id)=(31237) already exists., at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2505), at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2241), at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:310), at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:447), at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:368), at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:158), at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:124), at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61), at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java), at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197), ... 162 common frames omitted,
Using instead the revert-API call it allowed me to APPROVE this item.
The second example is a kind of lock. We took the former approved item and edited it as a contributor, saving it as draft. In the database it looks like this:
category | persistent_id | status | id | label | last_info_update | info_contributor_id | prev_version_id |
---|---|---|---|---|---|---|---|
TOOL_OR_SERVICE | wDDeLu | SUGGESTED | 31204 | Ethnic and Migrant Minorities (EMM) Survey Registry | 2021-03-17 11:12:33.469129 | 452 | |
TOOL_OR_SERVICE | wDDeLu | DEPRECATED | 31205 | Ethnic and Migrant Minorities (EMM) Survey Registry | 2021-03-17 11:31:05.381712 | 1 | 31204 |
TOOL_OR_SERVICE | wDDeLu | SUGGESTED | 31208 | Ethnic and Migrant Minorities (EMM) Survey Registry | 2021-03-17 14:17:36.722169 | 452 | 31205 |
TOOL_OR_SERVICE | wDDeLu | SUGGESTED | 31210 | Ethnic and Migrant Minorities (EMM) Survey Registry | 2021-03-17 14:23:12.464806 | 452 | 31208 |
TOOL_OR_SERVICE | wDDeLu | SUGGESTED | 31212 | Ethnic and Migrant Minorities (EMM) Survey Registry | 2021-03-17 14:32:36.724191 | 452 | 31210 |
TOOL_OR_SERVICE | wDDeLu | SUGGESTED | 31214 | Ethnic and Migrant Minorities (EMM) Survey Registry | 2021-03-17 14:43:27.772587 | 452 | 31212 |
TOOL_OR_SERVICE | wDDeLu | APPROVED | 31237 | Ethnic and Migrant Minorities (EMM) Survey Registry | 2021-03-19 14:27:10.554653 | 1 | 31214 |
TOOL_OR_SERVICE | wDDeLu | DRAFT | 31240 | Ethnic and Migrant Minorities (EMM) Survey Registry | 2021-03-19 15:11:35.936289 | 452 | 31237 |
If approving the last version we get an error trying it either with PUT or with /revert, here the error:
19-03-2021 16:54:59.117 [http-nio-8080-exec-2] INFO e.s.m.f.a.JwtTokenAuthenticationFilter.doFilterInternal - Valid Bearer JWT found for username: 'Administrator' 19-03-2021 16:54:59.191 [http-nio-8080-exec-2] ERROR e.s.m.c.MarketplaceExceptionHandler.handleServerError - Runtime exception java.lang.IllegalStateException: Duplicate key wDDeLu (attempted merging values RelatedItemDto(id=31210, persistentId=wDDeLu, category=tool-or-service, label=Ethnic and Migrant Minorities (EMM) Survey Registry, description=The EMM Survey Registry—which has been co-created by COST Action 16111 - ETHMIGSURVEYDATA, the H2020 SSHOC project, and the ANR project FAIRETHMIGQUANT—is a free online tool for discovering and learning about existing quantitative surveys undertaken with EMM (sub)populations in Europe and beyond. This tool not only brings together previously scattered information about these surveys but also offers detailed and structured metadata for each of the surveys. Designed with the end-users in mind, this tool can also easily be leveraged by anyone interested in doing research or policy-related work using quantitative surveys on EMMs' integration and inclusion. The EMM Survey Registry is currently live and available in beta version. This version is fully functional and displays metadata about 870+ surveys from 21 different countries. In the coming months, the tool will not only expand its metadata offerings (to cover at least an additional 100-200 surveys from roughly 10 additional countries), but also enrich its various user-friendly features and functionalities. , relation=ItemRelationDto(code=relates-to, label=Relates to)) and RelatedItemDto(id=31212, persistentId=wDDeLu, category=tool-or-service, label=Ethnic and Migrant Minorities (EMM) Survey Registry, description=The EMM Survey Registry—which has been co-created by COST Action 16111 - ETHMIGSURVEYDATA, the H2020 SSHOC project, and the ANR project FAIRETHMIGQUANT—is a free online tool for discovering and learning about existing quantitative surveys undertaken with EMM (sub)populations in Europe and beyond. This tool not only brings together previously scattered information about these surveys but also offers detailed and structured metadata for each of the surveys. Designed with the end-users in mind, this tool can also easily be leveraged by anyone interested in doing research or policy-related work using quantitative surveys on EMMs' integration and inclusion. The EMM Survey Registry is currently live and available in beta version. This version is fully functional and displays metadata about 870+ surveys from 21 different countries. In the coming months, the tool will not only expand its metadata offerings (to cover at least an additional 100-200 surveys from roughly 10 additional countries), but also enrich its various user-friendly features and functionalities. , relation=ItemRelationDto(code=relates-to, label=Relates to))) at java.base/java.util.stream.Collectors.duplicateKeyException(Unknown Source) at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Unknown Source) at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(Unknown Source) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source) at eu.sshopencloud.marketplace.services.items.ItemRelatedItemService.updateRelatedItems(ItemRelatedItemService.java:97) at eu.sshopencloud.marketplace.services.items.ItemRelatedItemService.updateRelatedItems(ItemRelatedItemService.java:82) at eu.sshopencloud.marketplace.services.items.ItemRelatedItemService
FastClassBySpringCGLIB
b3764898.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:366) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) at eu.sshopencloud.marketplace.services.items.ItemRelatedItemServiceEnhancerBySpringCGLIB
e906e6f9.updateRelatedItems() at eu.sshopencloud.marketplace.services.items.ItemCrudService.prepareAndPushItemVersion(ItemCrudService.java:153) at eu.sshopencloud.marketplace.services.items.ItemCrudService.createOrUpdateItemVersion(ItemCrudService.java:132) at eu.sshopencloud.marketplace.services.items.ItemCrudService.updateItem(ItemCrudService.java:128) at eu.sshopencloud.marketplace.services.items.TrainingMaterialService.updateTrainingMaterial(TrainingMaterialService.java:70) at eu.sshopencloud.marketplace.services.items.TrainingMaterialServiceFastClassBySpringCGLIB
1b740fe6.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:366) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) at eu.sshopencloud.marketplace.services.items.TrainingMaterialServiceEnhancerBySpringCGLIB
67b83da3.updateTrainingMaterial() at eu.sshopencloud.marketplace.controllers.trainings.TrainingMaterialController.updateTrainingMaterial(TrainingMaterialController.java:59) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:888) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) 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.doPut(FrameworkServlet.java:920) at javax.servlet.http.HttpServlet.service(HttpServlet.java:663) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at eu.sshopencloud.marketplace.filters.auth.JwtTokenAuthenticationFilter.doFilterInternal(JwtTokenAuthenticationFilter.java:45) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter.doFilterInternal(OAuth2AuthorizationRequestRedirectFilter.java:160) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:92) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:747) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Unknown Source)
Not sure if the reason is the draft state or the changes.
And the last example is one where there is already an approved version and where editing this approved version as contributor (adding relations) leads to this error in the API:
{ "timestamp": "2021-03-19 14:24:56", "status": 500, "error": "Duplicate key UZGTCS (attempted merging values RelatedItemDto(id=31209, persistentId=UZGTCS, category=training-material, label=COST Action 16111 - ETHMIGSURVEYDATA Youtube Channel, description=COST Action 16111 - ETHMIGSURVEYDATA’s Youtube channel offers videos aimed at improving the access, usability, and dissemination of survey data on the economic, social and political integration of ethnic and migrant minorities (EMMs). The videos are recordings of trainings, webinars, etc. where members of ETHMIGSURVEYDATA-- a research network and COST Action working with quantitative surveys on EMMs’ integration--presented or are content created by members of ETHMIGSURVEYDATA., relation=ItemRelationDto(code=is-related-to, label=Is related to)) and RelatedItemDto(id=31215, persistentId=UZGTCS, category=training-material, label=COST Action 16111 - ETHMIGSURVEYDATA Youtube Channel, description=COST Action 16111 - ETHMIGSURVEYDATA’s Youtube channel offers videos aimed at improving the access, usability, and dissemination of survey data on the economic, social and political integration of ethnic and migrant minorities (EMMs). The videos are recordings of trainings, webinars, etc. where members of ETHMIGSURVEYDATA-- a research network and COST Action working with quantitative surveys on EMMs’ integration--presented or are content created by members of ETHMIGSURVEYDATA., relation=ItemRelationDto(code=is-related-to, label=Is related to)))" }
In the database the situation looks like this:
category | persistent_id | status | id | label | last_info_update | info_contributor_id | prev_version_id |
---|---|---|---|---|---|---|---|
TRAINING_MATERIAL | UZGTCS | SUGGESTED | 31209 | COST Action 16111 - ETHMIGSURVEYDATA Youtube Channel | 2021-03-17 14:23:12.328288 | 452 | |
TRAINING_MATERIAL | UZGTCS | APPROVED | 31215 | COST Action 16111 - ETHMIGSURVEYDATA Youtube Channel | 2021-03-17 14:50:16.890934 | 1 | 31209 |
I know that you may need some more information and that the format is not very well in this issue, but it is late Friday night ;) - just tell me what more information you need.