-
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
remote access using Java API broken in 2.2.2 in OSGi environment? #6306
Comments
The problem is in the usage of As for now, the only workaround I can think of is manually calling package com.orientechnologies.orient.core;
import com.orientechnologies.orient.client.remote.OEngineRemote;
public class RemoteEngineFixer {
public static void applyFix() {
Orient.instance().registerEngine(new OEngineRemote());
}
} and call |
Sorry, public class RemoteEngineFixer extends Orient {
public static void applyFix() {
new RemoteEngineFixer();
}
private RemoteEngineFixer() {
registerEngine(new OEngineRemote());
}
} Hope it will work. |
Sorry again, it will not work since |
thank you @taburet for your thorough analysis and help, I was suspecting OSGi class loading again, as it works from the console. |
@grexe on the other side, you may invoke |
hehe we already use enough magic in our project;) and I had enough fun with OSGi already... I can imagine reflection magic won't play nice with the almighty OSGi class loader... |
sadly still happens with 2.2.4; I was hoping the changes to |
Hi @grexe! Unfortunately, I was working hard on other sever issues during 2.2.4. Hope I will find a free time slot to fix this in the next minor versions. |
I am using 2.2.6 and have this issue as well... when I checked the source code, I came to the same conclusions (about this being an issue with the ServiceLoader in an OSGi enviroment). If I can be of any assistance with this issue (testing, checking, coding, ...) please let me know. |
Hi guys! I started to work on a standalone OrientDB OSGi bundle, so basically it will wrap all the OrientDB modules and it's dependencies in an all-in-one OSGi bundle. The only problem is OrientDB Spatial module which cannot be distributed in that uber-bundle due to licensing restrictions. And it depends on Apache Lucene non-OSGi jars, the uber-bundle also depends on them. I'm going to export Lucene packages from the uber-bundle to fix this. WDYT, is it ok or should I repack Lucene jars as a separate OSGi bundle? |
With "export Lucene packages" you mean "exclude"? I'm fine with the uber-bundle without Lucene, happy to give it a try ;) |
For what it's worth, I was able to resolve the issue I had with creating an uber-bundle consisting of orientdb-client together with the META-INF/serivces files. (I am using 2.1.3 though). Actually, the uber-bundle approach feels more like a workaround than a proper solution... Are there any plans to divert from the ServiceLoader path maybe? |
The initial plan was to repackage everything in the uber-bundle, but since we cannot repack everything because of spatial module (licensing problems), I abandoned that path. My current thoughts are (1) repackage everything except spatial and enterprise into a single bundle, (2) package spatial and enterprise into their own bundles, (3) package shared non-OSGi deps into a separate bundle(s) and (4) create OSGi service to share OrientDB class loaders between OrientDB bundles. The main problem is still shared non-OSGi deps. I may create bundles for them, but it will be impossible to get into public repos (Eclipse Marketplace, for example) with this approach. On the other side, it will take ages to convince original authors to create and maintain OSGi distributions for their libraries. |
Guys, I created the first version of OrientDB OSGi distribution. Could you please try it in your setups to verify it's working in the wild.
The resulting uber bundle jar will be at If you use spatial module:
|
Thanks for your efforts! I checked out osgi-2.2.x and cleaned / verified (but without the tests, there were failures). Now I need to migrate my code to 2.2 (is: 2.1.3) as I - expectedly - have some issues; I'll let you know the outcome asap. (I have no use case for spatial though). |
@evandor Could you please provide more details about test failures like logs/exceptions? Was it OSGi tests or regular ones? |
I ran "mvn clean verify" and I got 2016-09-14 06:31:46:332 INFO - shutdown storage: OSystem... [Orient] Tests in error: Tests run: 70, Failures: 0, Errors: 6, Skipped: 1 [INFO] ------------------------------------------------------------------------ So it is in Server, not in the OSGi module. |
When I ran the command with skipped tests, I got a 34,7 MB file orientdb-osgi-core-bundle-2.2.10-SNAPSHOT, which first looked ok, but I am having issues with it: The embedded files are jars (not even bundles); when I wanted to import any class in my own bundle, e.g. import com.orientechnologies.orient.core.metadata.schema.OType; they cannot be resolved (compile time), as java does not support nested jars... Am I supposed to use the usual orientdb bundles for building and the uber jar for running the application? And where in the build I'd find the usual orientdb bundles? (the jars don't seem to be OSGi'ified). Thanks ;) |
Please provide details about your development/build/runtime environment. A striped down version of the project that won't compile would be great. I basically was targeting following environments:
|
I am using Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00) For development, I use gradle with bndtools (Eclipse). The project which won't compile is on github (not stripped down yet): https://github.com/evandor/skysail/tree/master/skysail.server.db I have orientdb imports, e.g. in https://github.com/evandor/skysail/blob/master/skysail.server.db/src/io/skysail/server/db/DbService.java which cannot be resolved as the osgi uber bundle relies on nested jars (which is not a standard java/jar setup afaik). In case you're interested, here's my uber-version (ca 5MB): https://github.com/evandor/skysail-repository/blob/master/release/io.skysail.bundled.orientdb-uber.jar (which works for me, build time and runtime). Required dependencies have to be added to OSGi "by hand", which I think is absolutely ok. This jar was created with bndtools with just the following instructions: Bundle-Version: 2.1.3.${tstamp} -classpath: Export-Package: Import-Package: Include-Resource: META-INF/services=services/orientdb Bundle-Name: orientdb-uber.jar Hope that helps, let me know if you need more information and thanks for your efforts! |
Hi @evandor! Maybe I missed something, but I don't see any references to Please try following:
|
Hi @taburet, this time the mvn clean install succeeded without any errors. But could you please clarify/confirm the following:
As I said, in that case I have a problem, as my build tool (bndtools) does not support nested jars. This is only relevant at build time, as I have a bundle that imports ODB classes, which cannot be resolved. Btw, I got in contact with the bndtools guys in this thread: https://groups.google.com/forum/#!topic/bndtools-users/pDveE9vafBk (maybe it contains some useful information for you). About the project I was referencing to: I did not use orientdb-osgi-core-bundle there, I created my own uber-bundle (io.skysail.bundled.orientdb-uber.jar, just 5MB, based on 2.1.3) which works for me (build and runtime). I think an uber-bundle like orientdb-osgi-core-bundle (containing all its dependencies) is quite against the "OSGi spirit"... So, long story short, with the
I cannot build any bundle which references any orientdb class (as the code resides in embedded, unexploded jars) (and I don't want to abandon bndtools) I might be able to use the uber jar at runtime, but I cannot test this as my bundle does not even compile. I hope orientdb will not stop shipping its jars as proper OSGi bundles (as it is still done in the 2.2.10 release). As long as orientdb ships with proper bundle-jars, I always can create my own uber jar and will be happy with it. But it would be even better, if the official uber-jar could be used by anyone, independent of their choice of tooling. Furthermore I think that the uber-jar does not need to contain all of its dependencies; OSGi developers should be able to provide them in their runtime (with the help of a little documentation of what is needed). Thanks for reading all of this ;) - I hope things became a bit more clear. If I can be of any assistance, please let me know! |
@evandor Thank you for the feedback. I will think what we can do about the problems you faced. |
@taburet checked out the osi branch today and got this error compiling with Oracle JDK 8 (Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode) on Linux x64 (Ubuntu 16.04, linux 4.8.0-040800rc8-generic)
|
Merged a fresh 2.2.x into osgi-2.2.x, maybe that will solve the problem with the test. |
@taburet there seems to be a problem with the last merge: Maven tries to resolve the wrong POM because of osgi vs. non-osgi difference in artifact names, I guess:
|
Sorry, bumped the version. Pushed. |
thanks @taburet for the super quick fix, that did it! Now testing... |
now I get this error when running with tests, though, @taburet
As expected, with skipping tests, the compile went through, so I can test the jar in my OSGi environment (standalone). |
That's strange, the server involved in these tests should listen on any network interface ( |
localhost is fine @taburet but I'm running a docker group on the same system, maybe that's causing trouble, however localhost is free, as docker runs on 10.0.0.100, on a virtual network card eth0:1:
|
hi @grexe, That test usually fail if there is a server running somewhere else while you run the tests, i hope it help ;). Bye |
Sorry guys, after internal discussion we have decided to leave ODB OSGi support in its present state, consider osgi-2.2.x branch unsupported. It's impossible to create a solution that will satisfy everyone at this point in time, mainly due to non-OSGi dependencies we have. Partial solution is not an option, since it will require too much effort on supporting it. For now, I suggest you to repackage the original ODB distribution for your specific needs. We will return to the subject in the future, maybe OSGi support will receive a more widespread adoption among our dependencies at some time. |
I'm running OrientDB 2.2.2 from the official docker image (with minor tweaks mainly preprocessing our environment etc.).
Running on Linux (Ubuntu 14.04) 64bit.
Accessing from Java API (Oracle JDK8, OSGi 4.3) using the client, core and graphdb JARs and the Blueprints 2.6.0 (wrapped as OSGi bundles using OPS4J Pax Tipi master POM).
The OSGi Java process is also running in a separate Docker container and accessing OrientDB over the network, using the URL
remote:orientdb/t2database
Using 2.1.x, everything worked fine (but we faced some issues with concurrent access we need to track down, this is why we want to make sure to use the latest stable version to rule out OrientDB as a cause).
Now, after upgrading to 2.2.2, I always get this error (but can connect perfectly from the orientdb docker host using console):
Seems like the server doesn't bring up the remote engine, but I see no reason why, and no error in the log, only this:
and this (but seems to be #3073 which can supposedly be ignored):
Any hints on what might be the cause?
There was #4883 but it's slightly different, since it never works for me from the Java client, and I have memory and plocal registered.
I am facing this issue since 2.2.0, before it worked.
The text was updated successfully, but these errors were encountered: