ObjectDB ObjectDB

javax.jdo.JDOUserException Failed to locate field field exampleField using reflection (error 363)

#1

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.

edit
delete
#2

The need to restart 5 or 6 times until things work is unknown to us (restarting once may be needed in some cases when enhancing from the application after the original classes have already been loaded to the JVM).

It would help if you can to isolate the issue. Does it happen when no class is enhanced? Does it happen if you enhance all the classes before you start running the application? Do you set the server with access to the classes or not (try both ways and if the classes are provided make sure they are up to date)? Does it happen with a new database? Does it happen when you try to access the server with the Explorer? Can you provide a small test case that demonstrates the issue?

ObjectDB Support
edit
delete
#3

Brief summary:
It does not matter if the classes are enhanced or not, the issue is still happening.
It does not happening when using Explorer

We did't know, that providing classes to the ODB Server will be helpful. We've tried to add classes to the classpath. That way the issue is not happening.

edit
delete

Reply

To post on this website please sign in.