Skip to content
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

Invisible classes in OSGi environment #7772

Closed
Dmitry-PlainID opened this issue Sep 26, 2017 · 17 comments
Closed

Invisible classes in OSGi environment #7772

Dmitry-PlainID opened this issue Sep 26, 2017 · 17 comments
Assignees
Labels
Milestone

Comments

@Dmitry-PlainID
Copy link

OrientDB Version: 2.2.27

Java Version: 1.8

OS: Mac os

After installing OrientDB in OSGi environment (I use karat 4.1.2) I stuck with some problems:

  1. java.lang.NoClassDefFoundError: Could not initialize class com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal
    at com.orientechnologies.orient.server.OSystemDatabase.init(OSystemDatabase.java:147) ~[?:?]
    at com.orientechnologies.orient.server.OSystemDatabase.(OSystemDatabase.java:44) ~[?:?]
    at com.orientechnologies.orient.server.OServer.initSystemDatabase(OServer.java:1290) ~[?:?]
    at com.orientechnologies.orient.server.OServer.activate(OServer.java:352) ~[?:?]

    To fix it I removed static section in ODatabaseRecordThreadLocal class.

  2. Because I use Embedded & Distributed mode, orientdb-core indirectly uses orientdb-distributed module.
    In particular classes from com.orientechnologies.orient.server.distributed.impl,
    com.orientechnologies.orient.server.distributed.impl.task packages, that is not exportable.
    To fix it I added “,com.orientechnologies.orient.server.distributed.impl.*” in <osgi.export> property of orientdb-distributed
    pom.xml and
    “com.orientechnologies.orient.server.distributed.impl;resolution:=optional,
    com.orientechnologies.orient.server.distributed.impl.task;resolution:=optional,” in <osgi.import> property of orientdb-core
    pom.xml

Now bundles started and database synchronized with remote node.
Could you add those changes to next version.

@andrii0lomakin
Copy link
Member

@Dmitry-PlainID the second part is OK for me, what about the first part? Did you remove static initializer right? I am afraid that this change is not safe. Why did you do that?

@Dmitry-PlainID
Copy link
Author

First, it fix a problem with NoClassDefFound exception (I don't know how, but it fact)
Second, INSTANCE already initialized - ODatabaseRecordThreadLocal INSTANCE = new ODatabaseRecordThreadLocal();
This code do nothing

@andrii0lomakin
Copy link
Member

@Dmitry-PlainID , it is already initialized in your application lifecycle, but some applications can startup and shutdown OrientDB engine several times. Could you send me your OSGi deployment so I will run it?

@Dmitry-PlainID
Copy link
Author

I use Karaf 4.1.2 as OSGi framework.

This is very simple test project, that contains Activator and TestCommand.
test-orientdb.tar.gz

Change in Activator ORIENTDB_HOME on you path.

Install OrientDB modules/bundels and its dependences. It's not simple, I used for it karaf feature project.
orientdb-feature.zip

Build it - mvn install

Start karaf - bin/karaf.sh
add repository - feature:repo-add mvn:com.test/orientdb-features/0.0.1-SNAPSHOT/xml/features
install the feature - feature:install orientdb-features

Install my simple test bundle - install -s mvn:com.test/test-orientdb/0.0.1-SNAPSHOT

@Dmitry-PlainID
Copy link
Author

No more answers?

@andrii0lomakin
Copy link
Member

@Dmitry-PlainID we are busy by issues with higher priority once we finish them we will back to this one )).

@andrii0lomakin
Copy link
Member

@Dmitry-PlainID I have tried to build project which you provided. But as result I have got:

 Bundle com.test:test-orientdb:bundle:0.0.1-SNAPSHOT : Error during loading properties file: /C:/Users/andrey/Documents/Development/test-orientdb, error:java.util.UnknownFormatConversionException: Conversion = '▒'

could you help me to fix that?

@Dmitry-PlainID
Copy link
Author

Instead of junk in osgi.bnd(it should not be binary file) put following text:
Bundle-Activator: com.test.orientdb.activator.Activator
DynamicImport-Package: *

@andrii0lomakin
Copy link
Member

@Dmitry-PlainID now I have got following error, could you help me to resolve it?

karaf@root()> feature:repo-add mvn:com.test/orientdb-features/0.0.1-SNAPSHOT/xml/features
Adding feature url mvn:com.test/orientdb-features/0.0.1-SNAPSHOT/xml/features
karaf@root()> feature:install orientdb-features
Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=orientdb-features; type=karaf.feature; version="[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]"; filter:="(&(osgi.identity=orientdb-features)(type=karaf.feature)(version>=0.0.1.SNAPSHOT)(version<=0.0.1.SNAPSHOT))" [caused by: Unable to resolve orientdb-features/0.0.1.SNAPSHOT: missing requirement [orientdb-features/0.0.1.SNAPSHOT] osgi.identity; osgi.identity=com.orientechnologies.orientdb-graphdb; type=osgi.bundle; version="[2.2.27,2.2.27]"; resolution:=mandatory [caused by: Unable to resolve com.orientechnologies.orientdb-graphdb/2.2.27: missing requirement [com.orientechnologies.orientdb-graphdb/2.2.27] osgi.wiring.package; filter:="(osgi.wiring.package=org.apache.commons.configuration)" [caused by: Unable to resolve org.apache.commons.configuration/1.6.0: missing requirement [org.apache.commons.configuration/1.6.0] osgi.wiring.package; filter:="(osgi.wiring.package=javax.servlet)"]]]

@Dmitry-PlainID
Copy link
Author

Perhaps I used pre-configured environment.

Run following steps:
feature:install webconsole

feature:install pax-http-whiteboard

install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ant/1.7.0_6
install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-lang/2.4_6
install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-configuration/1.9_2
install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-beanutils/1.8.3_2
install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-jxpath/1.3_1

feature:repo-add mvn:com.test/orientdb-features/0.0.1-SNAPSHOT/xml/features
feature:install orientdb-features

@andrii0lomakin
Copy link
Member

@Dmitry-PlainID it is fixed in 2.2.x, could you build the latest snapshot from 2.2.x branch and check it?

@Dmitry-PlainID
Copy link
Author

I checked, it works. Thanks.

@andrii0lomakin
Copy link
Member

@Dmitry-PlainID could you try again ?

@andrii0lomakin
Copy link
Member

need to reopen issue because of binary compatibility issues I will provide new version very soon.

@andrii0lomakin
Copy link
Member

@Dmitry-PlainID could you try again ?

@Dmitry-PlainID
Copy link
Author

I checked, It still works

@andrii0lomakin
Copy link
Member

@Dmitry-PlainID thank you very much for the help. We plan to release 2.2.30 in two weeks, of course, this fix will be included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants