Online backup problem

#1

Hi,

We are trying to create a servlet that performs database online backup. Unfortunately, even though no exception is thrown, backup files aren't created.

When I turn on DEBUG logging in ODB, I get multiple ClassNotFoundExceptions like :

[2011-06-04 05:34:14 #2 type.loader]
java.lang.ClassNotFoundException: org.springframework.security.userdetails.UserDetails
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at com.objectdb.o.RCL.j(RCL.java:299)
at com.objectdb.o.ACL.loadClass(ACL.java:106)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at com.objectdb.o.TYM.aw(TYM.java:979)
at com.objectdb.o.UTY.initSysType(UTY.java:324)
at com.objectdb.o.TYS.l(TYS.java:163)
at com.objectdb.o.TYM.ac(TYM.java:485)
at com.objectdb.o.TYM.<init>(TYM.java:232)
at com.objectdb.o.MST.aI(MST.java:181)
at com.objectdb.o.SHN.X(SHN.java:287)
at com.objectdb.o.SHN.W(SHN.java:245)
at com.objectdb.o.SHN.J(SHN.java:113)
at com.objectdb.o.HND.run(HND.java:133)
at java.lang.Thread.run(Thread.java:636)

[2011-06-04 05:34:14 #3 type.loader]
java.lang.ClassNotFoundException: java.lang.org.springframework.security.userdetails.UserDetails
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at com.objectdb.o.RCL.j(RCL.java:329)
at com.objectdb.o.ACL.loadClass(ACL.java:106)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at com.objectdb.o.TYM.aw(TYM.java:979)
at com.objectdb.o.UTY.initSysType(UTY.java:324)
at com.objectdb.o.TYS.l(TYS.java:163)
at com.objectdb.o.TYM.ac(TYM.java:485)
at com.objectdb.o.TYM.<init>(TYM.java:232)
at com.objectdb.o.MST.aI(MST.java:181)
at com.objectdb.o.SHN.X(SHN.java:287)
at com.objectdb.o.SHN.W(SHN.java:245)
at com.objectdb.o.SHN.J(SHN.java:113)
at com.objectdb.o.HND.run(HND.java:133)
at java.lang.Thread.run(Thread.java:636)

[2011-06-04 05:34:14 #4 type.loader]
Building a synthetic Class for org.springframework.security.userdetails.UserDetails

I get this exception for every class / interface that I used in my entities.

Should I put a jar somewhere in odb directory with my entities?

#2

Any ClassNotFoundException that is shown only in logging at DEBUG level is normal (part of the class searching process) and it doesn't seem to be related to the online backup.

Please post the code that you are using to run the backup.

ObjectDB Support
#3

This is the code I used in my servlet :

EntityManagerFactory emf = null;
  EntityManager em = null;
  String result = "OK";
  try {
   emf = Persistence.createEntityManagerFactory("HomplexServicesUnit");
   em = emf.createEntityManager();

   TypedQuery<Thread> backupQuery = em.createQuery("objectdb backup", Thread.class);
   Thread backupThread = backupQuery.getSingleResult();
   backupThread.join(); 
  } catch (Exception e) {
   e.printStackTrace();
   result = "FAIL";
  } finally {
   em.close();
   emf.close();
  }

EntityManager is created succesfully, I can query database without any problems. The code runs, result is "OK", but no files are created in ObjectDB home directory on db server.

 

I also tried to perform backup from standalone application - with the same result.

  EntityManagerFactory emf = Persistence.createEntityManagerFactory("HomplexServicesUnit");
  EntityManager em = emf.createEntityManager();

  Query query = em.createQuery("objectdb backup");
  query.getSingleResult();
 
  em.close();
  emf.close();
#4

Your code is ok but it seems that there is a problem with running the backup with no arguments.

You may try:

    Query query = em.createQuery("objectdb backup");
    query.setParameter("dummy", "dummy");
    query.getSingleResult();

or the new build (2.2.7_07) that should fix it.

Thank you for this report.

ObjectDB Support
#5

The "dummy" parameter works with my version (2.2.5_04) - thanks!

Reply