Exceptionally random exceptions randomly appear

Hi there! Newbie here and head-over-heels for Neo4J :heart_eyes:

BUT, I either have a weird bug on my hands, or some sort of stupid configurational/lack of knowledge kind of screw-up from my side. I hope someone can shed some light on my situation.

My stack:
Kotlin + spring-boot-starter-data-neo4j + neo4j inside a Docker container

The situation:
I have an aggregate root which can be described as:

(Identity)--[MADE]-->(Claim)--[HAS]-->(Fact)

Where Claim is a non-nullable property of Identity and Fact is a non-nullable property of Claim.

All seems to be working just fine about 60% of the time, but sometimes when reconstituting an instance of Identity, the constructor of Claim throws an NPE because it is not presented with an instance of Fact. Even though it is present in the database. The craziest thing is that whenever I encounter this exception, the only option I seem to have is to restart my neo4j container, because it will throw the exception on every try. So it seems it might be related to some random configuration which occurs during startup of Neo4J (or my application of course).

I have no actual clue how the reconstitution of related nodes actually takes place, but I'd imagine it tries to traverse the aggregate root until it has reached all leaves and start with those, then work its way back up. (again, I'm just guessing here, have mercy) But if it is close the how it is done, I don't understand how this exception could ever take place.

Making fact nullable shifted the problem, because fact actually became null and threw havoc at other places in my app.

Just some details below, the record seems to have a perfectly fine "Fact" in it:

org.springframework.data.mapping.MappingException: Error mapping Record<{identity: {Identity_MADE_Claim: [{Claim_HAS_Event: [{actor: "No actor", __elementId__: "4:1acc828c-d58e-4ca7-8c19-5ed905752089:18", description: "Added new claim", id: "c6a4cfae-f4cc-4da5-ab6f-bdad00fde9c0", version: 1, timestamp: 2023-09-26T08:45:07.005015+02:00, __nodeLabels__: ["IdNode", "Event"], status: "CREATED"}, {actor: "No actor", __elementId__: "4:1acc828c-d58e-4ca7-8c19-5ed905752089:17", description: "Added aspect to this Claim", id: "a51ebdc6-2e9a-4355-8a91-1e01db74bff0", version: 1, timestamp: 2023-09-26T08:45:07.004989+02:00, __nodeLabels__: ["IdNode", "Event"], status: "MUTATED"}, {actor: "No actor", __elementId__: "4:1acc828c-d58e-4ca7-8c19-5ed905752089:16", description: "Request was created", id: "e9d91f9d-8aae-4183-b546-fa6e17a794bd", version: 1, timestamp: 2023-09-26T08:45:07.004743+02:00, __nodeLabels__: ["IdNode", "Event"], status: "CREATED"}], Claim_HAS_Aspect: [{id: "d41c0778-2bb1-41ca-bdb4-41d77d327c2d", version: 1, __elementId__: "4:1acc828c-d58e-4ca7-8c19-5ed905752089:15", __nodeLabels__: ["IdNode", "Aspect"], aspect: "PUBLIC"}], Claim_HAS_Fact: [{Fact_HAS_Event: [{actor: "No actor", __elementId__: "4:1acc828c-d58e-4ca7-8c19-5ed905752089:13", description: "Added aspect to this Fact", id: "db8cf57b-7331-4411-9213-4277feb53c83", version: 1, timestamp: 2023-09-26T08:45:07.004549+02:00, __nodeLabels__: ["IdNode", "Event"], status: "MUTATED"}, {actor: "No actor", __elementId__: "4:1acc828c-d58e-4ca7-8c19-5ed905752089:12", description: "Fact was created", id: "fb21f0d0-9127-4e80-a560-cdbf690343fe", version: 1, timestamp: 2023-09-26T08:45:07.004282+02:00, __nodeLabels__: ["IdNode", "Event"], status: "CREATED"}], __elementId__: "4:1acc828c-d58e-4ca7-8c19-5ed905752089:10", name: "fact-name", description: "fact-description", id: "2cde1971-e405-4279-97d7-2f2a8adcf171", value: "fact-value", version: 1, Fact_HAS_Aspect: [{id: "b51030d4-4223-4387-b49e-ae67cff82019", version: 1, __elementId__: "4:1acc828c-d58e-4ca7-8c19-5ed905752089:11", __nodeLabels__: ["IdNode", "Aspect"], aspect: "PUBLIC"}], __nodeLabels__: ["IdNode", "Fact", "Topic"]}], __elementId__: "4:1acc828c-d58e-4ca7-8c19-5ed905752089:14", Claim_HAS_Request: [], id: "ab86ae3b-dc02-45f2-8382-335e7a3511d2", version: 1, __nodeLabels__: ["IdNode", "Topic", "Claim"]}], openForRequests: TRUE, __elementId__: "4:1acc828c-d58e-4ca7-8c19-5ed905752089:3", version: 1, username: "User1", __nodeLabels__: ["Identity"]}}>

With the root cause:

Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method core.domain.model.identity.Claim.<init>, parameter fact
	at core.domain.model.identity.Claim.<init>(Claim.kt) ~[classes/:na]
	at core.domain.model.identity.Claim.<init>(Claim.kt:18) ~[classes/:na]
	at core.domain.model.identity.Claim_Instantiator_2virpl.newInstance(Unknown Source) ~[classes/:na]
	at org.springframework.data.mapping.model.KotlinClassGeneratingEntityInstantiator$DefaultingKotlinClassInstantiatorAdapter.createInstance(KotlinClassGeneratingEntityInstantiator.java:199) ~[spring-data-commons-3.1.4.jar:3.1.4]
	... 168 common frames omitted
1 Like

Welcome to the Neo4j community :wave:
You are right on point, Spring Data Neo4j tries to solve the dependent objects (and the dependent objects of the dependent object,...) first to ensure that the chain can get instantiated.
The returned data on top of the exception looks good, that's true.
The randomization of the error could be based on the fact that SDN works on an unordered set of properties defined in the entity class.
Would be helpful to get the

  • a copy / reproducer of your defined entities in the chain mentioned above
  • the code that loads the entity and fails
  • optional (full error message)

This needs some more investigation from my side.

Hi Gerrit (fellow dutchee??),

Thanks for your help!

I've created a "minimal" setup to reproduce the issue: GitHub - harveytherabbit/neo4j-issue. Just run the "IssueReproducer" test a bunch of times and eventually you'll run into the issue described. Sorry that I cannot pin-point it any further. Usually 5-10 times is enough to encounter it.

For good measure, here is the entire stack trace:

org.springframework.data.mapping.MappingException: Error mapping Record<{identity: {Identity_MADE_Claim: [{Claim_HAS_Event: [{actor: "No actor", __elementId__: "4:d1818498-5bce-44bb-aefa-fdbe8e044983:18", description: "Added new claim", id: "dd82e664-7761-40fc-a249-7aa3423c1bf9", version: 1, timestamp: 2023-09-26T13:02:32.213884+02:00, __nodeLabels__: ["Event", "IdNode"], status: "CREATED"}, {actor: "No actor", __elementId__: "4:d1818498-5bce-44bb-aefa-fdbe8e044983:17", description: "Added aspect to this Claim", id: "2613126c-f3fc-488a-9f50-8e3328539666", version: 1, timestamp: 2023-09-26T13:02:32.213864+02:00, __nodeLabels__: ["Event", "IdNode"], status: "MUTATED"}, {actor: "No actor", __elementId__: "4:d1818498-5bce-44bb-aefa-fdbe8e044983:16", description: "Request was created", id: "d51dbf5a-2f37-46a0-9ac0-d1241135417a", version: 1, timestamp: 2023-09-26T13:02:32.213630+02:00, __nodeLabels__: ["Event", "IdNode"], status: "CREATED"}], Claim_HAS_Aspect: [{id: "902d2c20-3a9c-4fa5-9a5c-daba15d408a4", version: 1, __elementId__: "4:d1818498-5bce-44bb-aefa-fdbe8e044983:15", __nodeLabels__: ["IdNode", "Aspect"], aspect: "PUBLIC"}], __elementId__: "4:d1818498-5bce-44bb-aefa-fdbe8e044983:14", Claim_HAS_Request: [], id: "3b1e7344-8c55-457f-a523-faf27b28199e", Claim_IS_ABOUT_Fact: [{Fact_HAS_Event: [{actor: "No actor", __elementId__: "4:d1818498-5bce-44bb-aefa-fdbe8e044983:12", description: "Added aspect to this Fact", id: "a4bd3c37-e3fe-4c52-88db-ac9fcf65cb06", version: 1, timestamp: 2023-09-26T13:02:32.213461+02:00, __nodeLabels__: ["Event", "IdNode"], status: "MUTATED"}, {actor: "No actor", __elementId__: "4:d1818498-5bce-44bb-aefa-fdbe8e044983:11", description: "Fact was created", id: "76126265-c4bc-483e-9713-eb7bb613871b", version: 1, timestamp: 2023-09-26T13:02:32.213179+02:00, __nodeLabels__: ["Event", "IdNode"], status: "CREATED"}], __elementId__: "4:d1818498-5bce-44bb-aefa-fdbe8e044983:10", name: "fact-name", description: "fact-description", id: "459e3bdd-cf44-4cfb-93c1-9758130bfa23", value: "fact-value", version: 1, Fact_HAS_Aspect: [{id: "7a7f504f-1b45-4948-b819-eeaf18b3e66d", version: 1, __elementId__: "4:d1818498-5bce-44bb-aefa-fdbe8e044983:13", __nodeLabels__: ["IdNode", "Aspect"], aspect: "PUBLIC"}], __nodeLabels__: ["IdNode", "Fact", "Topic"]}], version: 1, __nodeLabels__: ["IdNode", "Topic", "Claim"]}], openForRequests: TRUE, __elementId__: "4:d1818498-5bce-44bb-aefa-fdbe8e044983:3", version: 1, username: "User1", __nodeLabels__: ["Identity"]}}>
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:123) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:71) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.mapping.Schema.lambda$getRequiredMappingFunctionFor$0(Schema.java:96) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:246) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.PreparedQuery$AggregatingMappingFunction.apply(PreparedQuery.java:158) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.DefaultNeo4jClient$DefaultRecordFetchSpec.one(DefaultNeo4jClient.java:434) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at java.base/java.util.Optional.flatMap(Optional.java:289) ~[na:na]
	at org.springframework.data.neo4j.core.Neo4jTemplate$DefaultExecutableQuery.getSingleResult(Neo4jTemplate.java:1119) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.Neo4jTemplate.findById(Neo4jTemplate.java:305) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.repository.support.SimpleNeo4jRepository.findById(SimpleNeo4jRepository.java:71) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:288) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:136) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:120) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:516) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:628) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:168) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:72) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) ~[spring-tx-6.0.12.jar:6.0.12]
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:391) ~[spring-tx-6.0.12.jar:6.0.12]
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-6.0.12.jar:6.0.12]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) ~[spring-tx-6.0.12.jar:6.0.12]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.data.repository.core.support.MethodInvocationValidator.invoke(MethodInvocationValidator.java:94) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:244) ~[spring-aop-6.0.12.jar:6.0.12]
	at jdk.proxy2/jdk.proxy2.$Proxy123.findById(Unknown Source) ~[na:na]
	at core.application.security.CurrentPrincipleContext.currentIdentity(CurrentPrincipleContext.kt:34) ~[classes/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:751) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:751) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:703) ~[spring-aop-6.0.12.jar:6.0.12]
	at core.application.security.CurrentPrincipleContext$$SpringCGLIB$$0.currentIdentity(<generated>) ~[classes/:na]
	at core.application.services.request.IdentityService.view(IdentityService.kt:34) ~[classes/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-6.0.12.jar:6.0.12]
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:699) ~[spring-aop-6.0.12.jar:6.0.12]
	at core.application.services.request.IdentityService$$SpringCGLIB$$0.view(<generated>) ~[classes/:na]
	at network.controllers.IdentityController.viewUser(IdentityController.kt:21) ~[classes/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-6.0.12.jar:6.0.12]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-6.0.12.jar:6.0.12]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118) ~[spring-webmvc-6.0.12.jar:6.0.12]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:884) ~[spring-webmvc-6.0.12.jar:6.0.12]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-6.0.12.jar:6.0.12]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-6.0.12.jar:6.0.12]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1081) ~[spring-webmvc-6.0.12.jar:6.0.12]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:974) ~[spring-webmvc-6.0.12.jar:6.0.12]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1011) ~[spring-webmvc-6.0.12.jar:6.0.12]
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903) ~[spring-webmvc-6.0.12.jar:6.0.12]
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:564) ~[tomcat-embed-core-10.1.13.jar:6.0]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) ~[spring-webmvc-6.0.12.jar:6.0.12]
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) ~[tomcat-embed-core-10.1.13.jar:6.0]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) ~[tomcat-embed-websocket-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at network.security.RateLimitFilter.doFilter(RateLimitFilter.kt:27) ~[classes/:na]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.springframework.security.web.FilterChainProxy.lambda$doFilterInternal$3(FilterChainProxy.java:231) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:365) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.access.intercept.AuthorizationFilter.doFilter(AuthorizationFilter.java:100) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:179) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter.doFilterInternal(DefaultLogoutPageGeneratingFilter.java:58) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.12.jar:6.0.12]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:188) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:174) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:107) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:93) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.12.jar:6.0.12]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:82) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.context.SecurityContextHolderFilter.doFilter(SecurityContextHolderFilter.java:69) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.12.jar:6.0.12]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.12.jar:6.0.12]
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:374) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:233) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:191) ~[spring-security-web-6.1.4.jar:6.1.4]
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:352) ~[spring-web-6.0.12.jar:6.0.12]
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:268) ~[spring-web-6.0.12.jar:6.0.12]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-6.0.12.jar:6.0.12]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.12.jar:6.0.12]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-6.0.12.jar:6.0.12]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.12.jar:6.0.12]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-6.0.12.jar:6.0.12]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.12.jar:6.0.12]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at network.security.ClientAuthenticationFilter.doFilter(ClientAuthenticationFilter.kt:54) ~[classes/:na]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:894) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1740) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-10.1.13.jar:10.1.13]
	at java.base/java.lang.Thread.run(Thread.java:1623) ~[na:na]
Caused by: org.springframework.data.mapping.model.MappingInstantiationException: Failed to instantiate core.domain.model.identity.Claim using constructor fun `<init>`(core.domain.model.identity.Fact, kotlin.collections.MutableList<core.domain.model.identity.Request>, kotlin.collections.MutableList<core.domain.model.identity.Aspect>, java.util.UUID, kotlin.Long?, kotlin.collections.MutableList<core.domain.model.common.Event>): core.domain.model.identity.Claim with arguments null,[],[],3b1e7344-8c55-457f-a523-faf27b28199e,1,[],0,null
	at org.springframework.data.mapping.model.KotlinClassGeneratingEntityInstantiator$DefaultingKotlinClassInstantiatorAdapter.createInstance(KotlinClassGeneratingEntityInstantiator.java:201) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.data.mapping.model.ClassGeneratingEntityInstantiator.createInstance(ClassGeneratingEntityInstantiator.java:98) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.instantiate(DefaultNeo4jEntityConverter.java:491) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.lambda$map$2(DefaultNeo4jEntityConverter.java:324) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:343) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.createInstanceOfRelationships(DefaultNeo4jEntityConverter.java:749) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.createInstanceOfRelationships(DefaultNeo4jEntityConverter.java:613) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter$1.getParameterValue(DefaultNeo4jEntityConverter.java:466) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.mapping.model.KotlinClassGeneratingEntityInstantiator$DefaultingKotlinClassInstantiatorAdapter.extractInvocationArguments(KotlinClassGeneratingEntityInstantiator.java:222) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.data.mapping.model.KotlinClassGeneratingEntityInstantiator$DefaultingKotlinClassInstantiatorAdapter.createInstance(KotlinClassGeneratingEntityInstantiator.java:196) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.data.mapping.model.ClassGeneratingEntityInstantiator.createInstance(ClassGeneratingEntityInstantiator.java:98) ~[spring-data-commons-3.1.4.jar:3.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.instantiate(DefaultNeo4jEntityConverter.java:491) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.lambda$map$2(DefaultNeo4jEntityConverter.java:324) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:343) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.map(DefaultNeo4jEntityConverter.java:301) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	at org.springframework.data.neo4j.core.mapping.DefaultNeo4jEntityConverter.read(DefaultNeo4jEntityConverter.java:121) ~[spring-data-neo4j-7.1.4.jar:7.1.4]
	... 153 common frames omitted
Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method core.domain.model.identity.Claim.<init>, parameter fact
	at core.domain.model.identity.Claim.<init>(Claim.kt) ~[classes/:na]
	at core.domain.model.identity.Claim.<init>(Claim.kt:18) ~[classes/:na]
	at core.domain.model.identity.Claim_Instantiator_7qlino.newInstance(Unknown Source) ~[classes/:na]
	at org.springframework.data.mapping.model.KotlinClassGeneratingEntityInstantiator$DefaultingKotlinClassInstantiatorAdapter.createInstance(KotlinClassGeneratingEntityInstantiator.java:199) ~[spring-data-commons-3.1.4.jar:3.1.4]
	... 168 common frames omitted
1 Like

I unflagged this ;)
Also, I tried your reproducer but cannot make it fail :frowning:
Did no changes to the code and ran it now multiple times.

And sorry, not a Dutch but German ;)

Ah, neighbors then!

That’s so strange, it does not happen most of the time though… I’ll see if I can figure out a way to make it fail all the time. I have a workaround, so it’s nothing directly blocking for me. If you might think of some way or something I could try, don’t hesitate to suggest it!

I am not sure if related to your problem but you could give 7.1.5-SNAPSHOT a try.
There was an issue in SDN that did not correctly handle changed objects during initialization/property setting. But this was mostly property-setting based and not constructor related. I cleaned up some other parts in the mapping process and might have accidentally fixed your problem :crossed_fingers:

I'm cautiously optimistic version 7.1.5-SNAPSHOT fixed my issue, I've ran test the entire morning and still have not encountered the issue. Nice!

Again, thanks for the help.

Cheers, Bastiën