georchestra / geonetwork

The official GeoNetwork fork for geOrchestra
GNU General Public License v2.0
9 stars 21 forks source link

not helpful exception message from ldap user sync errors #273

Open landryb opened 11 months ago

landryb commented 11 months ago

Describe the bug on 4.2.2, on a dev database i might have inconsistencies in the ldap, so the GN user<->ldap sync fails, but gives a totally meaningless message:

2024-01-05T10:15:09,067 INFO  [org.geonetwork.security.external.integration] - Reconciling existing GN User aaa.bbb with canonical user (id: 9afcf8fe-a43f-494c-a681-57f77774328f)
2024-01-05T10:15:09,086 INFO  [org.geonetwork.security.external.integration] - Adding profile Editor to group CD_03 for user aaa.bbb
2024-01-05T10:15:09,104 INFO  [org.geonetwork.security.external.integration] - Reconciling existing GN User aaa.ccc with canonical user (id: 4adffd47-a270-471f-890e-5b9c9c8cd24f)
2024-01-05T10:15:09,123 INFO  [org.geonetwork.security.external.integration] - Adding profile Editor to group GRENOBLE_ALPES_METRO for user aaa.ccc
2024-01-05T10:15:09,136 ERROR [org.geonetwork.security.external.integration] - Error synchronizing users
org.springframework.dao.InvalidDataAccessApiUsageException: The given id must not be null!; nested exception is java.lang.IllegalArgumentException: The given id must not be null!
        at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:374) ~[spring-orm-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:257) ~[spring-orm-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:531) ~[spring-orm-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:154) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:178) ~[spring-data-jpa-2.2.13.RELEASE.jar:2.2.13.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at jdk.proxy4.$Proxy255.findById(Unknown Source) ~[?:?]
        at org.geonetwork.security.external.repository.UserLinkRepository.findById(UserLinkRepository.java:60) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.geonetwork.security.external.repository.UserLinkRepository$$FastClassBySpringCGLIB$$c81aef77.invoke(<generated>) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:367) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.geonetwork.security.external.repository.UserLinkRepository$$EnhancerBySpringCGLIB$$e63a0089.findById(<generated>) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.geonetwork.security.external.integration.UserSynchronizer.findUserLink(UserSynchronizer.java:93) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.geonetwork.security.external.integration.UserSynchronizer.resolveLink(UserSynchronizer.java:173) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.geonetwork.security.external.integration.UserSynchronizer.synchronize(UserSynchronizer.java:135) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
        at org.geonetwork.security.external.integration.UserSynchronizer.synchronizeAll(UserSynchronizer.java:117) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.geonetwork.security.external.integration.UserSynchronizer.synchronizeAll(UserSynchronizer.java:101) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.geonetwork.security.external.integration.UserSynchronizer$$FastClassBySpringCGLIB$$88a22663.invoke(<generated>) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:367) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.geonetwork.security.external.integration.UserSynchronizer$$EnhancerBySpringCGLIB$$166358cd.synchronizeAll(<generated>) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.geonetwork.security.external.integration.AccountsReconcilingService.synchronize(AccountsReconcilingService.java:190) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.geonetwork.security.external.integration.AccountsReconcilingService$$FastClassBySpringCGLIB$$7d978086.invoke(<generated>) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:367) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.geonetwork.security.external.integration.AccountsReconcilingService$$EnhancerBySpringCGLIB$$92af5516.synchronize(<generated>) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at org.geonetwork.security.external.integration.ScheduledAccountsSynchronizationService.synchronize(ScheduledAccountsSynchronizationService.java:109) ~[gn-externalized-accounts-4.2.2-georchestra.jar:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]
Caused by: java.lang.IllegalArgumentException: The given id must not be null!
        at org.springframework.util.Assert.notNull(Assert.java:201) ~[spring-core-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findById(SimpleJpaRepository.java:269) ~[spring-data-jpa-2.2.13.RELEASE.jar:2.2.13.RELEASE]
        at jdk.internal.reflect.GeneratedMethodAccessor241.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
        at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:371) ~[spring-data-commons-2.2.13.RELEASE.jar:2.2.13.RELEASE]
        at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:204) ~[spring-data-commons-2.2.13.RELEASE.jar:2.2.13.RELEASE]
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:658) ~[spring-data-commons-2.2.13.RELEASE.jar:2.2.13.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:622) ~[spring-data-commons-2.2.13.RELEASE.jar:2.2.13.RELEASE]
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:606) ~[spring-data-commons-2.2.13.RELEASE.jar:2.2.13.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:367) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) ~[spring-tx-5.2.20.RELEASE.jar:5.2.20.RELEASE]
        ... 55 more

itd be much more helpful if it gave a clue on which username there's an inconsistent/missing id ? i'm going to guess that the problematic user is the one after aaa.ccc in the ldap DIT but who knows ?

ping @groldan

landryb commented 11 months ago

in my case, that'd help find that a user entry in the DIT indeed had a missing georchestraObjectIdentifier attribute but it would have help much more if the code said which one in the exception ;)

good thing i know how to grep|cut an ldif....