← Back to team overview

dhis2-devs team mailing list archive

Re: Error POSTing programs metadata

 

Could you please try again with rev 18738

--
Morten

On Sat, Mar 28, 2015 at 12:42 AM, Mahendra Kariya <
mahendra.kariya@xxxxxxxxxxxxxxxx> wrote:

> Hi,
>
> I was just wondering if someone got time to take a look at this.
>
> On Tue, Mar 24, 2015 at 11:59 AM, Mahendra Kariya <
> mahendra.kariya@xxxxxxxxxxxxxxxx> wrote:
>
>> Hi,
>>
>> When we are trying to POST program details to /api/metadata, we are
>> getting a 500 error.
>> Payload and stack track are below. We are on rev 18625.
>>
>> *Payload:*
>>
>> {
>>   "programs": [
>>     {
>>       "id": "a035cb4b0f4",
>>       "name": "Prg1",
>>       "type": 3,
>>       "kind": "SINGLE_EVENT_WITHOUT_REGISTRATION",
>>       "version": 1,
>>       "onlyEnrollOnce": false,
>>       "description": "Prg1",
>>       "externalAccess": false,
>>       "displayIncidentDate": true,
>>       "dateOfIncidentDescription": "Incident Date",
>>       "publicAccess": "rw------",
>>       "registration": false,
>>       "selectEnrollmentDatesInFuture": false,
>>       "dataEntryMethod": false,
>>       "singleEvent": true,
>>       "ignoreOverdueEvents": false,
>>       "relationshipFromA": false,
>>       "displayName": "Prg1",
>>       "selectIncidentDatesInFuture": false,
>>       "user": {
>>         "id": "ywxZNP6osqa",
>>         "name": "admin admin"
>>       },
>>       "validationCriterias": [],
>>       "programStages": [
>>         {
>>           "name": "Prg1 stage",
>>           "externalAccess": false,
>>           "description": "Prg1 stage",
>>           "minDaysFromStart": 0,
>>           "program": {
>>             "name": "Prg1",
>>             "externalAccess": false,
>>             "id": "a035cb4b0f4"
>>           },
>>           "programStageDataElements": [
>>             {
>>               "programStage": {
>>                 "name": "Prg1 stage",
>>                 "externalAccess": false,
>>                 "id": "a6121090489"
>>               },
>>               "dataElement": {
>>                 "name": "Case Number - Prg1",
>>                 "externalAccess": false,
>>                 "publicAccess": "rw------",
>>                 "user": {
>>                   "name": "admin admin",
>>                   "externalAccess": false,
>>                   "id": "ywxZNP6osqa"
>>                 },
>>                 "id": "addab15d13e"
>>               },
>>               "compulsory": true,
>>               "allowProvidedElsewhere": false,
>>               "displayInReports": true,
>>               "allowFutureDate": false
>>             }
>>           ],
>>           "reportDateDescription": "Report date",
>>           "autoGenerateEvent": true,
>>           "validCompleteOnly": false,
>>           "displayGenerateEventBox": true,
>>           "captureCoordinates": false,
>>           "blockEntryForm": false,
>>           "preGenerateUID": false,
>>           "remindCompleted": false,
>>           "generatedByEnrollmentDate": false,
>>           "allowGenerateNextVisit": false,
>>           "openAfterEnrollment": false,
>>           "sortOrder": 1,
>>           "dataEntryType": "section",
>>           "defaultTemplateMessage": "Dear {person-name}, please come to
>> your appointment on {program-stage-name} at {due-date}",
>>           "id": "a6121090489",
>>           "repeatable": false,
>>           "programStageSections": [
>>             {
>>               "name": "Cholera - Prg1",
>>               "externalAccess": false,
>>               "programStage": {
>>                 "name": "Prg1 stage",
>>                 "externalAccess": false,
>>                 "id": "a6121090489"
>>               },
>>               "programStageDataElements": [
>>                 {
>>                   "programStage": {
>>                     "name": "Prg1 stage",
>>                     "externalAccess": false,
>>                     "id": "a6121090489"
>>                   },
>>                   "dataElement": {
>>                     "name": "Case Number - Prg1",
>>                     "externalAccess": false,
>>                     "publicAccess": "rw------",
>>                     "user": {
>>                       "name": "admin admin",
>>                       "externalAccess": false,
>>                       "id": "ywxZNP6osqa"
>>                     },
>>                     "shortName": "Case Number",
>>                     "description": "Case Number",
>>                     "dataDimension": true,
>>                     "formName": "Case Number",
>>                     "domainType": "TRACKER",
>>                     "type": "string",
>>                     "textType": "text",
>>                     "aggregationOperator": "sum",
>>                     "categoryCombo": {
>>                       "name": "default",
>>                       "externalAccess": false,
>>                       "id": "TEZ1Jnbxzy0"
>>                     },
>>                     "zeroIsSignificant": false,
>>                     "id": "addab15d13e",
>>                     "isIncluded": true
>>                   },
>>                   "compulsory": true,
>>                   "allowProvidedElsewhere": false,
>>                   "displayInReports": true,
>>                   "allowFutureDate": false
>>                 }
>>               ],
>>               "sortOrder": 1,
>>               "id": "arRnhwC8gy0"
>>             }
>>           ]
>>         }
>>       ],
>>       "instanceReminders": [],
>>       "organisationUnits": [
>>         {
>>           "id": "a16475f1e69",
>>           "name": "LL1"
>>         }
>>       ],
>>       "attributeValues": [
>>         {
>>           "value": "true",
>>           "attribute": {
>>             "id": "wFC6joy3I8Q",
>>             "name": "Is New Data Model",
>>             "code": "isNewDataModel"
>>           }
>>         },
>>         {
>>           "value": "a0ea5ac6f18",
>>           "attribute": {
>>             "id": "e3711943998",
>>             "name": "Associated DataSet",
>>             "code": "associatedDataSet"
>>           }
>>         }
>>       ],
>>       "programTrackedEntityAttributes": [],
>>       "userRoles": [
>>         {
>>           "id": "N3f8TR7HAZS",
>>           "name": "Superuser"
>>         }
>>       ],
>>       "userGroupAccesses": [],
>>       "orgUnitIds": [
>>         {
>>           "0": "a",
>>           "1": "2",
>>           "2": "c",
>>           "3": "f",
>>           "4": "7",
>>           "5": "9",
>>           "6": "e",
>>           "7": "8",
>>           "8": "f",
>>           "9": "1",
>>           "10": "3"
>>         },
>>         {
>>           "0": "a",
>>           "1": "1",
>>           "2": "6",
>>           "3": "4",
>>           "4": "7",
>>           "5": "5",
>>           "6": "f",
>>           "7": "1",
>>           "8": "e",
>>           "9": "6",
>>           "10": "9"
>>         }
>>       ],
>>       "clientLastUpdated": "2015-03-24T06:19:08.366Z"
>>     }
>>   ]
>> }
>>
>> *StackTrace:*
>>
>> org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.hibernate4.HibernateSystemException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.hisp.dhis.program.Program.programAttributes; nested exception is org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.hisp.dhis.program.Program.programAttributes
>> 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
>> 	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
>> 	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
>> 	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:800)
>> 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
>> 	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:150)
>> 	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>> 	at org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:100)
>> 	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.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:344)
>> 	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
>> 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>> 	at org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82)
>> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
>> 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>> 	at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
>> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
>> 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>> 	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
>> 	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
>> 	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
>> 	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
>> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
>> 	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
>> 	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
>> 	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
>> 	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
>> 	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
>> 	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
>> 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
>> 	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
>> 	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
>> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
>> 	at org.eclipse.jetty.server.Server.handle(Server.java:497)
>> 	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
>> 	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:245)
>> 	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
>> 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
>> 	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
>> 	at java.lang.Thread.run(Thread.java:724)
>> Caused by: org.springframework.orm.hibernate4.HibernateSystemException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.hisp.dhis.program.Program.programAttributes; nested exception is org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.hisp.dhis.program.Program.programAttributes
>> 	at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:218)
>> 	at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:730)
>> 	at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:592)
>> 	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)
>> 	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)
>> 	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)
>> 	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
>> 	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:207)
>> 	at com.sun.proxy.$Proxy135.importMetaData(Unknown Source)
>> 	at org.hisp.dhis.webapi.controller.MetaDataController.startSyncImportJson(MetaDataController.java:382)
>> 	at org.hisp.dhis.webapi.controller.MetaDataController.importJson(MetaDataController.java:257)
>> 	at sun.reflect.GeneratedMethodAccessor1424.invoke(Unknown Source)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:606)
>> 	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
>> 	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
>> 	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
>> 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777)
>> 	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706)
>> 	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
>> 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
>> 	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
>> 	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
>> 	... 75 more
>> Caused by: org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.hisp.dhis.program.Program.programAttributes
>> 	at org.hibernate.engine.internal.Collections.processDereferencedCollection(Collections.java:113)
>> 	at org.hibernate.engine.internal.Collections.processUnreachableCollection(Collections.java:66)
>> 	at org.hibernate.event.internal.AbstractFlushingEventListener.flushCollections(AbstractFlushingEventListener.java:247)
>> 	at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:100)
>> 	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
>> 	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1233)
>> 	at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:403)
>> 	at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
>> 	at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
>> 	at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:584)
>> 	... 97 more
>>
>>
>>
>