Hi, I have a problem with a NullPointerException at org.datanucleus.ExecutionContextImpl.performDetachAllOnTxnEndPreparation(ExecutionContextImpl.java:4402).
It occurs randomly, if I set the L1Cache to WEAK.
It looks like there is no problem, if the L1Cache is SOFT.
I use datanucleus-api-jdo 5.1.9 with datanucleus-core 5.1.12, datanucleus-rdbms 5.1.11.
My relevant properties are
The stack trace is:
Before the NPE occures there are ">> EC.close L1Cache op IS NULL!" and ">> EC.preCommit L1Cache op IS NULL!" messages in the log.
My guess is the garbage collector removes the objects from the weak cache and the ObjectProvider becomes null.
I tried to call System.gc() before commit() but this does not cause the NPE to occure always (only sometimes).
What can I do to to find out what's going on?
Any idea, how to fix the NPE or how to avoid null values in the L1Cache?
[main] INFO org.flywaydb.core.internal.command.DbValidate - Successfully validated 2 migrations (execution time 00:00.013s) [main] INFO org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory - Creating Schema History table: "public"."flyway_schema_history" [main] INFO org.flywaydb.core.internal.command.DbMigrate - Current version of schema "public": << Empty Schema >> [main] INFO org.flywaydb.core.internal.command.DbMigrate - Migrating schema "public" to version 1 - create database [main] INFO org.flywaydb.core.internal.command.DbMigrate - Migrating schema "public" to version 2 - insert test data [main] INFO org.flywaydb.core.internal.command.DbMigrate - Successfully applied 2 migrations to schema "public" (execution time 00:00.031s) Mar 04, 2019 2:55:39 PM org.datanucleus.store.rdbms.query.JPQLQuery compileQueryFull WARNING: Query for candidates of com.example.datanucleus.entity.Bucket and subclasses resulted in no possible candidates : Required table missing : ""BUCKET"" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables"
java.util.Datefield. In older versions (we are coming from 4.1) the field is populated with a plain
java.util.Dateobject and in 5.1.2 it is a
org.datanucleus.store.types.wrappers.Dateobject. It looks like the getValue is not used on the wrapper somewhere in the code. Other objects (at least the ones we use) are okay so far. Is this change intended and we have to adapt to it?
@andyjefferson is there any plans to integrate DataNucleus with Micronaut Data (https://github.com/micronaut-projects/micronaut-data) other name Predator. You can read about https://objectcomputing.com/news/2019/07/18/unleashing-predator-precomputed-data-repositories
Micronaut is a new good replacement for de-facto standard in the current Java world Spring Boot. Micronaut is similar to Spring but it completely eliminates reflection, runtime proxies, and dynamic classloading. So you can get significant performance gains, small footprint and startup time.
Especially it is very interested with GraalVM Substrate native images to build efficient native cloud microservices and even FaaS.
Currently they support just JDBC and JPA based on Hibernate. And of course due to the proxy nature of Hibernate they could not get all benefits of AoT on their platform when using JPA.
I believe that is so exited opportunity for DataNucleus which is using compile time code enhancements instead of proxy and reflection API to become the primary JPA solution for Micronaut.
@andyjefferson I decompiled the class with 'javap -c', I could see the getValue and setValue method.
Also the notice the comments for dnGet/Set as well
30: invokevirtual #408 // Method dnGetValue:()Ljava/lang/String;
33: invokevirtual #390 // Method dnSetValue:(Ljava/lang/String;)V
Debugged and noticed the AbstractClassMetaData.class, getManagedMembers () returns 2 FieldMetadata and 1 PropertiesMetaData (corresponds to the field tagged using <property> tag in jdo) for this case.
could there be any difference in using the Field and Properties in jdo mapping with respect to latest version of datanucleus.