← Back to team overview

dhis2-devs team mailing list archive

Re: Error while creating a new user.

 

Hm that means something is wrong with your payload. Could you give the full
payload again?

-- 
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Thu, Dec 29, 2016 at 1:04 PM, Sourabh Bhardwaj <bsourabh191@xxxxxxxxx>
wrote:

> Hi Morten,
>
> Thanks for the reply. I have tried as per your suggestion and now getting
> following error:
>
> Internal server error: 500
> Can not deserialize instance of java.lang.String out of START_ARRAY token↵
> at [Source: org.apache.catalina.connector.CoyoteInputStream@3b6c6ca3;
> line: 1, column: 22] (through reference chain:
> org.hisp.dhis.user.User["id"])
>
> On Thu, Dec 29, 2016 at 4:59 PM, Morten Olav Hansen <morten@xxxxxxxxx>
> wrote:
>
>> Hi
>>
>> Our user model is a bit weird at times (will try to fix for 226). As a
>> workaround you should be able to get this working if you use /api/system/id
>> to get a new uid, then add that to the main user model "id": "your-uid",
>> then inside the userCredentials you would put "userInfo": {"id": "your-id"
>> }
>>
>> --
>> Morten Olav Hansen
>> Senior Engineer, DHIS 2
>> University of Oslo
>> http://www.dhis2.org
>>
>> On Thu, Dec 29, 2016 at 9:16 AM, Sourabh Bhardwaj <bsourabh191@xxxxxxxxx>
>> wrote:
>>
>>> Hi all,
>>>
>>> I am getting an error while creating a new user through web api(using
>>> 2.25 Build revision: edc697d)
>>>
>>> Following is the error:
>>>
>>> *attempted to assign id from null one-to-one property
>>> [org.hisp.dhis.user.UserCredentials.userInfo]"*
>>>
>>>
>>> Following is the payload i am referring to:
>>>
>>> {
>>>   "firstName": "John",
>>>   "surname": "Doe",
>>>   "email": "johndoe@xxxxxxxx",
>>>   "userCredentials": {
>>>     "username": "johndoe",
>>>     "password": "your-password-123",
>>>     "userRoles": [ {
>>>       "id": "Euq3XfEIEbx"
>>>     } ]
>>>   },
>>>   "organisationUnits": [ {
>>>     "id": "ImspTQPwCqd"
>>>   } ],
>>>   "userGroups": [ {
>>>     "id": "vAvEltyXGbD"
>>>   } ]
>>> }
>>>
>>> Complete Logcat:
>>>
>>> *org.hibernate.id
>>> <http://org.hibernate.id>.IdentifierGenerationException: attempted to
>>> assign id from null one-to-one property
>>> [org.hisp.dhis.user.UserCredentials.userInfo]*
>>> *        at org.hibernate.id
>>> <http://org.hibernate.id>.ForeignGenerator.generate(ForeignGenerator.java:83)*
>>> *        at
>>> org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:105)*
>>> *        at
>>> org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:192)*
>>> *        at
>>> org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38)*
>>> *        at
>>> org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:177)*
>>> *        at
>>> org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32)*
>>> *        at
>>> org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:73)*
>>> *        at
>>> org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:682)*
>>> *        at
>>> org.hibernate.internal.SessionImpl.save(SessionImpl.java:674)*
>>> *        at
>>> org.hibernate.internal.SessionImpl.save(SessionImpl.java:669)*
>>> *        at
>>> org.hisp.dhis.dxf2.metadata.objectbundle.hooks.UserObjectBundleHook.postCreate(UserObjectBundleHook.java:76)*
>>> *        at
>>> org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundleService.lambda$handleCreates$4(DefaultObjectBundleService.java:217)*
>>> *        at java.util.ArrayList.forEach(ArrayList.java:1249)*
>>> *        at
>>> org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundleService.handleCreates(DefaultObjectBundleService.java:217)*
>>> *        at
>>> org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundleService.commit(DefaultObjectBundleService.java:149)*
>>> *        at sun.reflect.GeneratedMethodAccessor1007.invoke(Unknown
>>> Source)*
>>> *        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)*
>>> *        at java.lang.reflect.Method.invoke(Method.java:497)*
>>> *        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.$Proxy186.commit(Unknown Source)*
>>> *        at org.hisp.dhis.dxf2.metadata.De
>>> <http://org.hisp.dhis.dxf2.metadata.De>faultMetadataImportService.importMetadata(DefaultMetadataImportService.java:116)*
>>> *        at sun.reflect.GeneratedMethodAccessor935.invoke(Unknown
>>> Source)*
>>> *        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)*
>>> *        at java.lang.reflect.Method.invoke(Method.java:497)*
>>> *        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.$Proxy188.importMetadata(Unknown Source)*
>>> *        at
>>> org.hisp.dhis.webapi.controller.user.UserController.createUser(UserController.java:534)*
>>> *        at
>>> org.hisp.dhis.webapi.controller.user.UserController.postJsonObject(UserController.java:209)*
>>> *        at
>>> org.hisp.dhis.webapi.controller.user.UserController$$FastClassBySpringCGLIB$$e199246.invoke(<generated>)*
>>> *        at
>>> org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)*
>>> *        at
>>> org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651)*
>>> *        at
>>> org.hisp.dhis.webapi.controller.user.UserController$$EnhancerBySpringCGLIB$$317745f.postJsonObject(<generated>)*
>>> *        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:497)*
>>> *        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:648)*
>>> *        at
>>> org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)*
>>> *        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)*
>>> *        at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)*
>>> *        at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)*
>>> *        at org.apache.tomcat.websocket.se
>>> <http://org.apache.tomcat.websocket.se>rver.WsFilter.doFilter(WsFilter.java:52)*
>>> *        at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)*
>>> *        at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)*
>>> *        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:126)*
>>> *        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:240)*
>>> *        at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)*
>>> *        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:240)*
>>> *        at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)*
>>> *        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:240)*
>>> *        at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)*
>>> *        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:240)*
>>> *        at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)*
>>> *        at
>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)*
>>> *        at
>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)*
>>> *        at
>>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)*
>>> *        at
>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)*
>>> *        at
>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)*
>>> *        at
>>> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)*
>>> *        at
>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)*
>>> *        at
>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)*
>>> *        at
>>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)*
>>> *        at
>>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)*
>>> *        at org.apache.tomcat.util.net
>>> <http://org.apache.tomcat.util.net>.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)*
>>> *        at org.apache.tomcat.util.net
>>> <http://org.apache.tomcat.util.net>.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2497)*
>>> *        at
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)*
>>> *        at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)*
>>> *        at
>>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)*
>>>
>>>
>>>
>>> Thanks & Regards,
>>> Bhardwaj Sourabh.
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>

Follow ups

References