Hello, we have similar issue as it is described here: https://www.objectdb.com/forum/2132, but I can't post there.
The difference is, that it started happening to us after switch to client-server mode.
The exception we get is following:
[ObjectDB 2.8.3_05] javax.jdo.JDOUserException Failed to locate field field com.example.db.BDO.testField using reflection (error 363) at java.base/java.lang.Thread.run(Thread.java:833) com.example.db_utils.jdo.exception.ConnectionException at com.example.db_utils.jdo.BasicJDOConnection.persistenceManagerInit(BasicJDOConnection.java:438) at com.example.db_utils.jdo.BasicJDOConnection.<init>(BasicJDOConnection.java:34) at com.example.serverImpl.jdo.JDOConnection.<init>(JDOConnection.java:18) at com.example.db_utils.jdo.JDODatabase.createConnection(JDODatabase.java:20) at com.example.serverImpl.QuantServerImpl.getConnection(QuantServerImpl.java:503) at com.example.serverImpl.QuantServerImpl.getConnection(QuantServerImpl.java:499) at com.example.serverImpl.QuantServerImpl.getConnection(QuantServerImpl.java:495) at com.example.serverImpl.ServerLauncher.waitForIndexActivation(ServerLauncher.java:448) at com.example.serverImpl.ServerLauncher.initFromCompany(ServerLauncher.java:431) at com.example.serverImpl.ServerLauncher.launch(ServerLauncher.java:300) at com.example.serverImpl.ConsoleLoggingServerLauncher.main(ConsoleLoggingServerLauncher.java:12) Caused by: com.objectdb.o._JdoUserException: Failed to locate field field com.example.db.BDO.testField using reflection NestedThrowables: java.lang.NoSuchFieldException: testField at com.objectdb.o.JDE.d(JDE.java:128) at com.objectdb.o.ERR.h(ERR.java:56) at com.objectdb.o.JDE.h(JDE.java:54) at com.objectdb.o.OST.onObjectDBError(OST.java:601) at com.objectdb.jdo.PMF.getPersistenceManager(PMF.java:564) at com.example.db_utils.jdo.BasicJDOConnection.persistenceManagerInit(BasicJDOConnection.java:434) ... 10 more Caused by: java.lang.NoSuchFieldException: testField at java.base/java.lang.Class.getDeclaredField(Class.java:2610) at com.objectdb.o.UMR$b.y(UMR.java:1067) at com.objectdb.o.MMM.<init>(MMM.java:306) at com.objectdb.o.UTY.g(UTY.java:653) at com.objectdb.o.UTY.C(UTY.java:426) at com.objectdb.o.TYS.k(TYS.java:178) at com.objectdb.o.TYM.Z(TYM.java:546) at com.objectdb.o.MST.YZ(MST.java:1194) at com.objectdb.o.WRA.YZ(WRA.java:215) at com.objectdb.o.WRA.YZ(WRA.java:215) at com.objectdb.o.WSN.YZ(WSN.java:194) at com.objectdb.o.STC.g(STC.java:341) at com.objectdb.o.SHN.H(SHN.java:390) at com.objectdb.o.SHN.w(SHN.java:135) at com.objectdb.o.HND.run(HND.java:134) at java.base/java.lang.Thread.run(Thread.java:833) java.lang.RuntimeException: com.example.db_utils.jdo.exception.ConnectionException at com.example.serverImpl.QuantServerImpl.getConnection(QuantServerImpl.java:509) at com.example.serverImpl.QuantServerImpl.getConnection(QuantServerImpl.java:499) at com.example.serverImpl.QuantServerImpl.getConnection(QuantServerImpl.java:495) at com.example.serverImpl.ServerLauncher.waitForIndexActivation(ServerLauncher.java:448) at com.example.serverImpl.ServerLauncher.initFromCompany(ServerLauncher.java:431) at com.example.serverImpl.ServerLauncher.launch(ServerLauncher.java:300) at com.example.serverImpl.ConsoleLoggingServerLauncher.main(ConsoleLoggingServerLauncher.java:12) Caused by: com.example.db_utils.jdo.exception.ConnectionException at com.example.db_utils.jdo.BasicJDOConnection.persistenceManagerInit(BasicJDOConnection.java:438) at com.example.db_utils.jdo.BasicJDOConnection.<init>(BasicJDOConnection.java:34) at com.example.serverImpl.jdo.JDOConnection.<init>(JDOConnection.java:18) at com.example.db_utils.jdo.JDODatabase.createConnection(JDODatabase.java:20) at com.example.serverImpl.QuantServerImpl.getConnection(QuantServerImpl.java:503) ... 6 more Caused by: com.objectdb.o._JdoUserException: Failed to locate field field com.example.db.BDO.testField using reflection NestedThrowables: java.lang.NoSuchFieldException: testField at com.objectdb.o.JDE.d(JDE.java:128) at com.objectdb.o.ERR.h(ERR.java:56) at com.objectdb.o.JDE.h(JDE.java:54) at com.objectdb.o.OST.onObjectDBError(OST.java:601) at com.objectdb.jdo.PMF.getPersistenceManager(PMF.java:564) at com.example.db_utils.jdo.BasicJDOConnection.persistenceManagerInit(BasicJDOConnection.java:434) ... 10 more Caused by: java.lang.NoSuchFieldException: testField at java.base/java.lang.Class.getDeclaredField(Class.java:2610) at com.objectdb.o.UMR$b.y(UMR.java:1067) at com.objectdb.o.MMM.<init>(MMM.java:306) at com.objectdb.o.UTY.g(UTY.java:653) at com.objectdb.o.UTY.C(UTY.java:426) at com.objectdb.o.TYS.k(TYS.java:178) at com.objectdb.o.TYM.Z(TYM.java:546) at com.objectdb.o.MST.YZ(MST.java:1194) at com.objectdb.o.WRA.YZ(WRA.java:215) at com.objectdb.o.WRA.YZ(WRA.java:215) at com.objectdb.o.WSN.YZ(WSN.java:194) at com.objectdb.o.STC.g(STC.java:341) at com.objectdb.o.SHN.H(SHN.java:390) at com.objectdb.o.SHN.w(SHN.java:135) at com.objectdb.o.HND.run(HND.java:134) at java.base/java.lang.Thread.run(Thread.java:833) 2022-04-19 13:28:08,255 | ERROR | Exception generated by connected from null with clientID: null 2022-04-19 13:28:08,255 | ERROR | com.example.db_utils.jdo.exception.ConnectionException 2022-04-19 13:28:08,255 | ERROR | Exception generated by connected from null with clientID: null 2022-04-19 13:28:08,255 | ERROR | com.example.db_utils.jdo.exception.ConnectionException Process finished with exit code 1
We think, that we have properly enhanced classes although it seems to me, that we aren't using a best practise solution.
We are using standalone launcher, which is called from ant in production builds using:
<java fork="true" classname="com.example.jdo.MWJDOEnhance" classpath="${classpath}" />
In it we are using following code:
String allString = getAllPackagesAsString(); Enhancer.enhance(allString);
Output of enhancement before running the test was:
[ObjectDB 2.8.3_05 Enhancer] 553 persistable types have been enhanced: com.example.db.BDO
Usually it was sufficient to restart the Application (ODB Client), and we have client-server mode only in testing environment now, so we just configured the services to restart automatically up to 5 times and we lived with that.
But now we added a field to BDO class which is parent class for many others, and now it needed 6 restarts. So we think, it is caused by the heredity or because it is used in 6 separate DB files.
We would like to resolve this issue somehow now.