ObjectDB ObjectDB

Catching exceptions from client-server mode online backup

#1

We're using the following to trigger an online backup and we're trying to implement server-side online backup (as discussed in https://www.objectdb.com/forum/2737).

EntityManager em = database.createEntityManager();
TypedQuery<Thread> backupQuery = em.createQuery("objectdb backup", Thread.class);
backupQuery.setParameter("target", "relative-path");
backupQuery.setParameter("name", backupSubdir);

In case the relative-path is not writable we've get:


com.objectdb.o.UserException: Failed to create a new file '/absolute-path/relative-path/database.odb'
    at com.objectdb.o.MSG.a(MSG.java:77)
    at com.objectdb.o.LFL.m(LFL.java:870)
    at com.objectdb.o.LFL.x(LFL.java:810)
    at com.objectdb.o.LFL.x(LFL.java:779)
    at com.objectdb.o.LFL.ZW(LFL.java:518)
    at com.objectdb.o.BAC.f(BAC.java:121)
    at com.objectdb.o.TOL.run(TOL.java:117)
    at com.objectdb.o.DTT.run(DTT.java:77)
    at com.objectdb.o.STD.run(STD.java:75)
Caused by: java.io.FileNotFoundException: /absolute-path/relative-path/database.odb (No such file or directory)
    at java.base/java.io.RandomAccessFile.open0(Native Method)
    at java.base/java.io.RandomAccessFile.open(RandomAccessFile.java:344)
    at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:259)
    at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:213)
    at com.objectdb.o.LFL.m(LFL.java:857)
    ... 7 more

But we can't handle it anyway. We would need to be able to report this error via our reporting tool.

edit
delete
#2

It is unclear if this is currently possible.

Where did you find this stack trace, in the log file? on the server, client or both?

If you get the stack trace also on the client side then you may try using Thread's setDefaultUncaughtExceptionHandler on the the Thread object that is returned by executing the backup query.

 

 

ObjectDB Support
edit
delete
#3

We are getting the log only on client-side. You're right setDefaultUncaughtExceptionHandler works for this I just did not realised that we have the reporting disabled for local environments.

edit
delete

Reply

To post on this website please sign in.