← Back to team overview

dhis2-devs team mailing list archive

Re: Bugs in DHIS new importer.

 

Hello devs,

I'm getting the "Exception occurred while trying to import the metadata.
object references an unsaved transient instance - save the transient
instance before flushing: org.hisp.dhis.dataelement.DataElement
(MetadataSyncTask.java [taskScheduler-9])" error when using the new
exporter/importer (/api/24/metadata). I'm exporting event charts and event
reports from one DHIS2 instance to another (same version same build: 2.24
and 23522). Metadata is the same in both instances.

Full stack trace attached.
URL: http://localhost:8080/api/24/metadata
Example eventCharts Payload:
{
  "date": "2016-07-27T12:54:31.851+0000",
  "eventCharts": [
    {
      "lastUpdated": "2016-07-26T15:57:08.779+0000",
      "id": "uM4KpocRONz",
      "created": "2016-07-26T15:57:08.779+0000",
      "name": "Acurenam: Mortalidad total: Nº de muertes",
      "showData": true,
      "publicAccess": "rw------",
      "userOrganisationUnitChildren": false,
      "type": "LINE",
      "hideEmptyRows": false,
      "userOrganisationUnit": false,
      "hideNaData": false,
      "completedOnly": false,
      "sortOrder": 0,
      "collapseDataDimensions": false,
      "userOrganisationUnitGrandChildren": false,
      "hideSubtitle": false,
      "outputType": "EVENT",
      "title": "Número de muertes",
      "hideLegend": false,
      "externalAccess": false,
      "hideTitle": false,
      "regression": false,
      "program": {
        "id": "yBICFtJAYFR"
      },
      "relativePeriods": {
        "thisYear": false,
        "quartersLastYear": false,
        "last52Weeks": false,
        "thisWeek": false,
        "lastMonth": false,
        "monthsThisYear": false,
        "last2SixMonths": false,
        "thisQuarter": false,
        "last12Months": false,
        "last5FinancialYears": false,
        "thisSixMonth": false,
        "lastQuarter": false,
        "thisFinancialYear": false,
        "last4Weeks": false,
        "last3Months": false,
        "thisMonth": false,
        "last5Years": false,
        "last6BiMonths": false,
        "lastFinancialYear": false,
        "last6Months": false,
        "quartersThisYear": false,
        "monthsLastYear": false,
        "lastWeek": false,
        "thisBimonth": false,
        "lastBimonth": false,
        "lastSixMonth": false,
        "lastYear": false,
        "last12Weeks": true,
        "last4Quarters": false
      },
      "programStage": {
        "id": "PgGkk7ELhw7"
      },
      "user": {
        "id": "mGMEUNgjTYA"
      },
      "attributeDimensions": [],
      "translations": [],
      "filterDimensions": [
        "ou"
      ],
      "organisationUnitGroups": [],
      "itemOrganisationUnitGroups": [],
      "userGroupAccesses": [],
      "programIndicatorDimensions": [],
      "columnDimensions": [
        "RFGJRT5bFaC"
      ],
      "organisationUnitLevels": [],
      "dataElementDimensions": [
        {
          "filter": "IN:O28",
          "dataElement": {
            "id": "RFGJRT5bFaC"
          }
        }
      ],
      "periods": [],
      "organisationUnits": [
        {
          "id": "JnEJ2mR2WlB"
        }
      ],
      "rowDimensions": [
        "pe"
      ]
    }
  ]
}

Hope you can help me out with this.

Best regards!



*Sergio Valenzuela*
Fundación EHAS
Telemedicina para países en desarrollo -* www.ehas.org
<http://www.ehas.org/>*
E.T.S.I. de Telecomunicación A.101-9L. Ciudad Universitaria 30, 28040
Madrid - España
Tlfno. (+34) 91 488 87 41: (+34) 687 67 17 62



2016-06-29 5:18 GMT+02:00 Morten Olav Hansen <morten@xxxxxxxxx>:

> @vanyas: Yes this was caught during the validation phase itself. The point
>> here would be to catch such issues during configuring metadata itself. The
>> use case was: We created some data set at HQ, synced to local. Then we
>> created a custom attribute for data set and made it mandatory. Then when
>> this version (with custom attribute info) syncs to local, we get this
>> validation issues with the importer. Any general guideline for such cases.
>>
>
> I don't disagree on that, but it's not really related to the importer. Not
> sure we have any guidelines for that, in general you would never actually
> change an attribute like that I think (I wouldn't mind it being blocked),
> of course.. people make mistakes.. and we don't really want to block edits
> either..
>
>
>> We do not support any data approval types at this point (at least nothing
>>> has been done to try and support them, it's untested)
>>>
>> @vanyas: Whats the plan for this in that case? If its part of metadata
>> this association should get synced.
>>
>
> We have a blueprint for adding support for this:
> https://blueprints.launchpad.net/dhis2/+spec/exchange-data-approval
>
> It's currently set to 2.25, but nobody is assigned..
>
> --
> Morten
>
> - when we updated the existing program with adding combination of
>>>> categories and synched.
>>>>
>>>
>>> This should be fixed now
>>>
>>> - while updating attributes in the program with registration.
>>>> * ERROR 2016-06-21 21:23:24,325 ERROR: duplicate key value violates
>>>> unique constraint ""programtrackedentityattribute_unique_key""
>>>>   Detail: Key (programid, trackedentityattributeid)=(255, 240) already
>>>> exists. (SqlExceptionHelper.java [taskScheduler-6])
>>>> * ERROR 2016-06-21 21:23:24,385 Exception occurred while trying to
>>>> import the metadata. could not execute statement
>>>> (MetadataImportHandler.java [taskScheduler-6])
>>>> org.hibernate.exception.ConstraintViolationException: could not execute
>>>> statement at
>>>> org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112)"Error
>>>> on Edit Program Stage page. Press cancel and exception is thrown. Analytics
>>>> Export Error. Process failed. null.
>>>>
>>>
>>> Please try again, I have done several fixes related to issues like this
>>> (at least similar issues)
>>>
>> @vanyas : Thanks. Sure will check.
>>
>>>
>>> - Charts, pivot tables, Report Table/ Pivot Table, Event Report, Event
>>>> Chart, Validation Rule
>>>> Metadata Sync failed for the above metadata With the below runtime
>>>> exception.
>>>> --- Exception occurred while trying to import the metadata. object
>>>> references an unsaved transient instance - save the transient instance
>>>> before flushing: org.hisp.dhis.dataelement.DataElement
>>>> (MetadataSyncTask.java [taskScheduler-9])
>>>>
>>>
>>> This should be fixed
>>>
>>> - Admin user when added to dashboard item is not syncing with metadat
>>>> sync.
>>>>
>>>
>>> Will look into it
>>>
>>> - When deleted a legend at HQ and synced to local. The legend at Local
>>>> also is deleted on UI (exists in DB). Also, legend is getting duplicated
>>>> with a different UID in DB.
>>>>
>>>
>>> Will look into it
>>>
>>>
>>>> - Metadata Filter (Import-Export --> Metadata Detailed Export)
>>>> modification to properties like name, description is successfully
>>>> synced but the selection is not synced, the payload also have the details
>>>> of the updated data when synced.
>>>>
>>>
>>> Not sure how much time we should spend on this, the metadata filter
>>> functionality should be replaced in future releases (it's not very stable,
>>> and has not been updated to support new types etc)
>>>
>>> - custom forms are synced properly when created, but while Updation of
>>>> custom form not reflecting on UI. However, payload has the full information
>>>> of updates.
>>>>
>>>
>>> Will look into it, is the issue present for both data set and program
>>> stages?
>>>
>> @vanya: This was tested with data sets only.
>>
>>>
>>> --
>>> Morten
>>>
>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Thanks & Regards,
>>>> Nalinikanth M
>>>> Quality Analyst
>>>> Email nalinim@xxxxxxxxxxxxxxxx
>>>> Telephone +91 9052234588 <+91+9052234588>
>>>> [image: ThoughtWorks]
>>>> <http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator>
>>>>
>>>
>>>
>>
>>
>> --
>> With Regards
>> ThoughtWorks Technologies
>> Hyderabad
>>
>> --Stay Hungry Stay Foolish!!
>>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>
* INFO  2016-07-27 15:59:44,447 (admin) Creating 1 object(s) of type EventChart (DefaultObjectBundleService.java [http-bio-8080-exec-1])
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.hisp.dhis.dataelement.DataElement
	at org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:279)
	at org.hibernate.type.EntityType.getIdentifier(EntityType.java:455)
	at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:281)
	at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:291)
	at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:296)
	at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:4126)
	at org.hibernate.event.internal.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:528)
	at org.hibernate.event.internal.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:215)
	at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:142)
	at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:216)
	at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:85)
	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:38)
	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1295)
	at org.hisp.dhis.dxf2.metadata2.objectbundle.DefaultObjectBundleService.commit(DefaultObjectBundleService.java:155)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
	at com.sun.proxy.$Proxy189.commit(Unknown Source)
	at org.hisp.dhis.dxf2.metadata2.DefaultMetadataImportService.importMetadata(DefaultMetadataImportService.java:101)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
	at com.sun.proxy.$Proxy191.importMetadata(Unknown Source)
	at org.hisp.dhis.webapi.controller.metadata.MetadataImportController.postJsonMetadata(MetadataImportController.java:87)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:817)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:731)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:870)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:98)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:87)
	at org.hisp.dhis.servlet.filter.ExcludableShallowEtagHeaderFilter.doFilterInternal(ExcludableShallowEtagHeaderFilter.java:102)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Follow ups

References