-
Notifications
You must be signed in to change notification settings - Fork 871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return of (fixed) 2.0 issue in 2.1/2.2: NoClassDefFoundError for ODatabaseRecordThreadLocal #6404
Comments
I see that 2.2.7 and 2.2.8 has been released in the mean time, any progress on this issue? |
Could you please test against the experimental OrientDB OSGi distribution as described here #6306 (comment) |
Close issue because of no reply. If you reproduce given issue and have information which is requested in issue feel free to reopen it. |
Stopped actively following this case after more than a month with no activity and I didn't get any notification until the case was closed. But I have now tested the osgi bundle. The bundle it self worked just fine but the error during startup is the same: 2016-09-29 10:53:43,167 [Thread-3] ERROR com.ceesoft.ceeview.core.bootstrap.OSGiLogger - com.ceesoft.ceeview.datastore.impl.blueprints.orientdb [79]: [ERROR] : [com.ceesoft.ceeview.datastore.impl.blueprints.orientdb.DatabaseManagerProvider-0] The callback method validate has thrown an exception : javax/script/ScriptEngineFactory null |
I can't find a way to reopen this case. |
Reopened. It's a similar exception, but the cause is different. Do you manually start Felix or it's a part of some other external framework? |
We manually starts an embedded Felix instance. |
Did you tweak |
No, vanilla launch of Felix. |
Please make sure that |
first one didn't help. the second triggered this exception: org.apache.felix.log.LogException: java.lang.NoClassDefFoundError: sun/misc/Unsafe |
Followed the original exception down one level and found this (more details about the class): Caused by: java.lang.ClassNotFoundException: javax.script.ScriptEngineFactory not found by orientdb-osgi-core-bundle [111] |
Well, set it to |
Looks like sun.misc.Unsafe was not found even though sun.misc.* was set. Exception: |
Took a dump of our exported packages from system bundle without your changes. Exported Packages |
The only import package by orientdb-osgi-core-bundle is 'org.osgi.framework,version=1.8.0 from org.apache.felix.framework (0)' You should explicitly import all needed packages according to my Felix guy :) |
He is partially right :) All non-boot delegated packages should be imported. The only non-boot delegated dependency of |
Please elaborate more on the exported packages listing you provided. How you obtained them? Are they re-exported from some bundle in your setup? |
The list was obtained using Apache Felix Web Console and lists packages exported by the 'System Bundle' |
BTW, do you manually tweak the |
config.put("org.osgi.framework.system.packages.extra", "sun.misc,sun.net.util,sun.reflect"); |
Did some changes to the pom.xml to get past the ScriptEngineFactory issue by adding this to orientdb-osgi-core-bundle: This actually fixed the javax.script issue and sun.misc issue and I'm back to ODatabaseRecordThreadLocal exception that started this case :) java.lang.NoClassDefFoundError: Could not initialize class com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal |
Oh, I see. A package can't be boot delegated and system bundle exported at the same time. Seems like system bundle exported one has a priority. That's why it's unable to resolve the Regarding the |
Here is the complete import block for orientdb-osgi-core-bundle:
There is still a timing issue, but I will describe that in the a new comment |
First creation of a connection in a OSGI service will fail e.g. ODatabaseRecordThreadLocal line 32, Orient.instance() is null first time it is called.
The same line triggers the creation of the global Orient object so all following connections will work. So with the if-test the following code works with the test above in place. Of course the first connection can not be used.
Creating a dummy connection to initialize Orient is not a permanent solution. So we need to figure out how to make the bundle create the global Orient Object by it self. I don't think this is a issue when using Orient from an application so it must be related to the loading of bundles and/or class path. |
I went back to testing using Import-Package on orient-graphdb again with 2.2.12-SNAPSHOT. ODatabaseRecordThreadLocal line 31, when called the first time Orient.instance() returns null. Adding the following null pointer test actually removes the initial ClassNotFound exception
Consecutive calls that creates ODatabaseRecordThreadLocal will work and thus "fixing" the issue. So my conclusion is that #3501 didn't fix the issue but just hid it with the null pointer test like I did above, thus "fixing" the issue in 2.0. It seems like running Orient in a OSGI bundle messes up the loading of static constructors somehow. But why it results in ClassNotFound exceptions I have no idea. |
Sorry, found the link :) |
SOLUTION: |
IMO, this issue is never fixed. The root cause of the issue I think is about class loader "ScriptEngineManager" uses in [1], which is boot/root class loader, i.e. if there are any script engines that are added using a dynamic class loader they will never be loaded. The correct way to do is on line 73 from [1] is
|
Windows 10, Orientdb 2.2.4
I'm trying to upgrade from 2.0 to 2.2.4 and ran into the same issue that I had when upgrading from 1.7 to 2.0.
We are running OSGI and are embedding all Orientdb bundles and their dependencies into our bundle.
I posted on the google group when I tried the same upgrade to 2.1.3 and got these answers from you guys: https://groups.google.com/d/msg/orient-database/gjkfiywvIvs/4g0O0pXNDAAJ
But it doesn't look like anyone actually did something...
2016-07-11 09:59:58,228 [Thread-3] ERROR com.aaa.bootstrap.OSGiLogger - com.aaa.orientdb [131]: [ERROR] : java.lang.NoClassDefFoundError: Could not initialize class com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal null
org.apache.felix.log.LogException: java.lang.IllegalStateException: java.lang.NoClassDefFoundError: Could not initialize class com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal
at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__M_stateChanged(LifecycleCallbackHandler.java:171)
at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:560)
at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:440)
at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:179)
at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:319)
at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:240)
at org.apache.felix.ipojo.extender.internal.linker.ManagedType$InstanceSupport$1.call(ManagedType.java:312)
at org.apache.felix.ipojo.extender.internal.linker.ManagedType$InstanceSupport$1.call(ManagedType.java:306)
at org.apache.felix.ipojo.extender.internal.queue.JobInfoCallable.call(JobInfoCallable.java:114)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.activateOnCurrentThread(ODatabaseDocumentTx.java:2966)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.(ODatabaseDocumentTx.java:157)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPolled.(OPartitionedDatabasePool.java:118)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPolled.(OPartitionedDatabasePool.java:114)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.initQueue(OPartitionedDatabasePool.java:442)
at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.(OPartitionedDatabasePool.java:217)
at com.ceesoft.ceeview.datastore.impl.blueprints.orientdb.DatabaseManagerProvider.__M_validate(DatabaseManagerProvider.java:190)
at com.ceesoft.ceeview.datastore.impl.blueprints.orientdb.DatabaseManagerProvider.validate(DatabaseManagerProvider.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.felix.ipojo.util.Callback.call(Callback.java:233)
at org.apache.felix.ipojo.util.Callback.call(Callback.java:193)
at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__M_stateChanged(LifecycleCallbackHandler.java:162)
... 13 more
It took several versions of 2.0 before the issue was finally fixed. Since the issue now is back, does that mean that the bug fixes done late in 2.0 have not been merged into 2.1 or is there another reason that the problem has returned in 2.1?
Regards,
Roar
The text was updated successfully, but these errors were encountered: