319 words

Online backup problem

#1
2011-06-28 09:33

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?

kborkowski
kborkowski's picture
Joined on 2011-04-05
User Post #4
#2
2011-06-28 12:46

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
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #382
#3
2011-06-28 12:54

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();
kborkowski
kborkowski's picture
Joined on 2011-04-05
User Post #5
#4
2011-06-28 14:16

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
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #383
#5
2011-06-28 14:25

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

kborkowski
kborkowski's picture
Joined on 2011-04-05
User Post #6

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel