[Staging Schema V2] Erro de parse JSON está impedindo a persistência do record na tabela staging_schema do PG

Description

Problema:

Exception java.lang.IllegalArgumentException: The given Json object value: com.totvslabs.framework.core.common.entity.SchemaMapping@794b1b17 cannot be transformed to a String; nested exception is org.hibernate.HibernateException: java.lang.IllegalArgumentException: The given Json object value: com.totvslabs.framework.core.common.entity.SchemaMapping@794b1b17 cannot be transformed to a String sendo lançado na plataforma ao persistir um registro de staging_schema com valor JSON na coluna schema_mapping:

org.springframework.orm.jpa.JpaSystemException: java.lang.IllegalArgumentException: The given Json object value: com.totvslabs.framework.core.common.entity.SchemaMapping@794b1b17 cannot be transformed to a String; nested exception is org.hibernate.HibernateException: java.lang.IllegalArgumentException: The given Json object value: com.totvslabs.framework.core.common.entity.SchemaMapping@794b1b17 cannot be transformed to a String
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:331)
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:233)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:551)
	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:152)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:174)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
	at com.sun.proxy.$Proxy294.save(Unknown Source)
	at com.totvslabs.mdm.services.impl.StagingSchemaServiceImplV2.saveEntity(StagingSchemaServiceImplV2.java:2826)
	at com.totvslabs.mdm.services.impl.StagingSchemaServiceImplV2.updateEntity(StagingSchemaServiceImplV2.java:2821)
	at com.totvslabs.mdm.services.impl.StagingSchemaServiceProxy.updateEntity(StagingSchemaServiceProxy.java:491)
	at com.totvslabs.mdm.services.impl.StagingSchemaServiceImpl.updateStagingSchema(StagingSchemaServiceImpl.java:1543)
	at com.totvslabs.mdm.services.impl.StagingSchemaServiceImpl.updateStagingSchemaExternally(StagingSchemaServiceImpl.java:1068)
	at com.totvslabs.mdm.services.impl.StagingSchemaServiceProxy.updateStagingSchemaExternally(StagingSchemaServiceProxy.java:253)
	at com.totvslabs.mdm.app.rest.resources.v3.StagingResourceV3.updateStagingTableSchema_aroundBody18(StagingResourceV3.java:877)
	at com.totvslabs.mdm.app.rest.resources.v3.StagingResourceV3.updateStagingTableSchema_aroundBody19$advice(StagingResourceV3.java:94)
	at com.totvslabs.mdm.app.rest.resources.v3.StagingResourceV3.updateStagingTableSchema(StagingResourceV3.java:1)
	at com.totvslabs.mdm.app.rest.resources.staging.StagingResource.updateEntityTypeSchema_aroundBody18(StagingResource.java:531)
	at com.totvslabs.mdm.app.rest.resources.staging.StagingResource.updateEntityTypeSchema_aroundBody19$advice(StagingResource.java:94)
	at com.totvslabs.mdm.app.rest.resources.staging.StagingResource.updateEntityTypeSchema(StagingResource.java:1)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:475)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:397)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)
	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:255)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680)
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)
	at org.glassfish.jersey.servlet.ServletContainer.serviceImpl(ServletContainer.java:386)
	at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:561)
	at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:502)
	at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:439)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at com.totvslabs.mdm.app.filters.AuditFilter.doFilter(AuditFilter.java:145)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.springframework.cloud.sleuth.instrument.web.servlet.TracingFilter.doFilter(TracingFilter.java:89)
	at org.springframework.cloud.sleuth.autoconfig.instrument.web.TraceWebServletConfiguration$LazyTracingFilter.doFilter(TraceWebServletConfiguration.java:131)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at com.totvslabs.mdm.app.filters.CorsFilter.doFilter(CorsFilter.java:48)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at com.totvslabs.mdm.app.filters.HttpsForwardFilter.doFilter(HttpsForwardFilter.java:384)
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:179)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:516)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.hibernate.HibernateException: java.lang.IllegalArgumentException: The given Json object value: com.totvslabs.framework.core.common.entity.SchemaMapping@794b1b17 cannot be transformed to a String
	at io.hypersistence.utils.hibernate.type.util.ObjectMapperWrapper.toString(ObjectMapperWrapper.java:118)
	at io.hypersistence.utils.hibernate.type.json.internal.JsonTypeDescriptor.areEqual(JsonTypeDescriptor.java:93)
	at org.hibernate.type.AbstractStandardBasicType.isEqual(AbstractStandardBasicType.java:194)
	at org.hibernate.type.AbstractStandardBasicType.getReplacement(AbstractStandardBasicType.java:74)
	at org.hibernate.type.AbstractStandardBasicType.replace(AbstractStandardBasicType.java:354)
	at org.hibernate.type.TypeHelper.replace(TypeHelper.java:167)
	at org.hibernate.event.internal.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:450)
	at org.hibernate.event.internal.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:347)
	at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:172)
	at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:70)
	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
	at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:829)
	at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:816)
	at jdk.internal.reflect.GeneratedMethodAccessor340.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:311)
	at com.sun.proxy.$Proxy210.merge(Unknown Source)
	at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:650)
	at jdk.internal.reflect.GeneratedMethodAccessor333.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:289)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)
	at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:529)
	at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:639)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:163)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:138)
	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.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)

Caso haja alguma intercorrência na persistência dos dados na entidade Staging Schema, pode afetar o processo rollout na migração das tenants para ler da tabela staging_schema do banco Postgres em vez do Elasticsearch.

Logging: https://cloudlogging.app.goo.gl/U6Jn8E3t5VFoZqGe8

Critério de aceite:

  • O fluxo de persistência da entidade Staging Schema no Postgres não deve ser afetado por nenhum tipo de dados específico, especificamente dentro das colunas do tipo jsonb (staging_mapping, schema_mapping, duplicate_fields_from_join, type_to_crosswalk_tables, retention_definition, cluster_and_partitioning_bq_options).
  • Deploy em produção.

Activity

Automation for Jira 20 August 2024, 21:13 Jira Internal Users

Foi realizado o commit.

Automation for Jira 14 August 2024, 14:45 Jira Internal Users

Valor anterior do campo deployment date era 2024-08-12T19:19:00.0+0000. Parece ter ocorrido um novo deploy nesta issue - deploy.

Automation for Jira 14 August 2024, 14:45 Jira Internal Users

Ocorreu o deploy em Produção.

Automation for Jira 12 August 2024, 21:19 Jira Internal Users

Ocorreu o deploy em Produção. Issue movimentada para Done.

Nenhuma issue associada no Jira Produção.

Automation for Jira 12 August 2024, 21:19 Jira Internal Users

Foi aprovado o PR.

Automation for Jira 12 August 2024, 21:18 Jira Internal Users

Foi realizado o commit.

Automation for Jira 12 August 2024, 17:00 Jira Internal Users

Esta issue teve o seu status alterado, pois ocorreu o merge da branch CAPL-6405-JSON-parse-error-staging-schema na branch develop.

Automation for Jira 12 August 2024, 16:46 Jira Internal Users

Foi realizado o commit.

Automation for Jira 12 August 2024, 16:46 Jira Internal Users

Foi aprovado o PR.

Automation for Jira 9 August 2024, 21:09 Jira Internal Users

Esta issue teve o seu status alterado, pois foi aprovado o PR.

Automation for Jira 9 August 2024, 03:12 Jira Internal Users

Foi realizado o commit.

Automation for Jira 9 August 2024, 00:24 Jira Internal Users

Foi realizado o commit.

Automation for Jira 8 August 2024, 19:09 Jira Internal Users

Foi aprovado o PR.

Automation for Jira 8 August 2024, 19:09 Jira Internal Users

Foi aprovado o PR.

Automation for Jira 8 August 2024, 19:09 Jira Internal Users

Foi aprovado o PR.

Automation for Jira 8 August 2024, 19:09 Jira Internal Users

Foi aprovado o PR.

Automation for Jira 8 August 2024, 15:29 Jira Internal Users

Foi aprovado o PR.

Automation for Jira 8 August 2024, 15:14 Jira Internal Users

Foi realizado o commit.

Automation for Jira 8 August 2024, 15:14 Jira Internal Users

Foi aprovado o PR.

Automation for Jira 8 August 2024, 06:56 Jira Internal Users

Foi realizado o commit.

Automation for Jira 8 August 2024, 06:56 Jira Internal Users

Foi aprovado o PR.

Automation for Jira 7 August 2024, 20:03 Jira Internal Users

Foi aprovado o PR.

Automation for Jira 7 August 2024, 20:03 Jira Internal Users

Esta issue teve o seu status alterado, pois foi criado o PR sem a sigla WIP no título.

Automation for Jira 7 August 2024, 18:42 Jira Internal Users

Foi aprovado o PR.

Automation for Jira 7 August 2024, 18:41 Jira Internal Users

Foi realizado o commit.

Automation for Jira 7 August 2024, 18:41 Jira Internal Users

Foi criada a branch.

Automation for Jira 2 August 2024, 22:33 Jira Internal Users

@Renan Fernando Schroeder ,
@Rodrigo Bechtold ,

Este issue foi planejada para ser entregue até 2024-09-27. Você pode confirmar consultando o campo Due Date desta issue.

Data já planejadas para esta issue: 2024-09-27

Se o campo External Issue Link estiver preenchido com o link de uma issue válida no Jira Produção o cliente também será notificado no Jira Produção.