Gabriel Vince
unread,May 4, 2012, 9:36:56 AM5/4/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to orient-...@googlegroups.com
Hello,
I see a new way of handling object database was added, using build 5481, good work :)
but there's a little problem in OSGi to load classes when trying to serialize the saved object.. Even setting the class loader did not help :(
the bundle contains all refered classes, OrientDB client libraries and javassist library as well
Anybody with an idea?
Gabriel
code:
There are simple POJO Entity object Dimension referencing a list of categories
ClassLoader originalClassLoader = null;
try {
String uri = this.getDatabaseUri(database);
db = this.getDatabase(uri, LOGIN, PASSWORD);// aquire from pool
db.setSaveOnlyDirty(true);
originalClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(javassist.util.proxy.ProxyObject.class.getClassLoader());
db.begin();
for (Category c : dimension.getCategories()) {
// seems this back reference creates problems (loops) fetching
// an object :(
c.setDimension(dimension);
// .. deleted.. setting property values
db.save(c);
}
db.save(dimension);
db.commit();
} catch (Exception ex) {
logger.log(Level.SEVERE, "defineDimension", ex);
if (db != null) {
db.rollback();
}
exx = ex;
} finally {
if(originalClassLoader!=null)
Thread.currentThread().setContextClassLoader(originalClassLoader);
if (db != null) {
db.close();
}
}
Caused by: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject
at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:514)[909:com.apogado.ste.datastore:0.1.0]
at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:491)[909:com.apogado.ste.datastore:0.1.0]
at javassist.util.proxy.ProxyFactory.createClass1(ProxyFactory.java:427)[909:com.apogado.ste.datastore:0.1.0]
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:399)[909:com.apogado.ste.datastore:0.1.0]
at com.orientechnologies.orient.object.enhancement.OObjectEntityEnhancer.getProxiedInstance(OObjectEntityEnhancer.java:104)[909:com.apogado.ste.datastore:0.1.0]
at com.orientechnologies.orient.object.db.OObjectDatabaseTx.newInstance(OObjectDatabaseTx.java:111)[909:com.apogado.ste.datastore:0.1.0]
... 56 more
Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:170)[909:com.apogado.ste.datastore:0.1.0]
at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:506)[909:com.apogado.ste.datastore:0.1.0]
... 61 more
Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/ProxyObject
at java.lang.ClassLoader.defineClass1(Native Method)[:1.6.0_29]
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)[:1.6.0_29]
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)[:1.6.0_29]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_29]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_29]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_29]
at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:182)[909:com.apogado.ste.datastore:0.1.0]
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:164)[909:com.apogado.ste.datastore:0.1.0]
... 62 more
Caused by: java.lang.ClassNotFoundException: javassist.util.proxy.ProxyObject
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)[osgi-3.6.2.R36x_v20110210.jar:]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)[osgi-3.6.2.R36x_v20110210.jar:]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)[osgi-3.6.2.R36x_v20110210.jar:]
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)[osgi-3.6.2.R36x_v20110210.jar:]
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_29]
... 71 more