← Back to team overview

dhis2-users team mailing list archive

Error while creating a new user.

 

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.IdentifierGenerationException: attempted to assign id
from null one-to-one property [org.hisp.dhis.user.UserCredentials.userInfo]*
*        at
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.DefaultMetadataImportService.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.server.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.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2508)*
*        at
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.

Follow ups