Bug 310114 - [core] remove dependencies so that ECF can run on other OSGi frameworks
Summary: [core] remove dependencies so that ECF can run on other OSGi frameworks
Status: RESOLVED FIXED
Alias: None
Product: ECF
Classification: RT
Component: ecf.core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: ecf.core-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks: 319971
  Show dependency tree
 
Reported: 2010-04-22 09:24 EDT by Scott Lewis CLA
Modified: 2011-03-14 14:26 EDT (History)
6 users (show)

See Also:


Attachments
eventmgr supplement bundle (13.16 KB, application/java-archive)
2010-09-21 19:17 EDT, Neil Bartlett CLA
no flags Details
equinox/felix "adapter" bundle (16.03 KB, application/octet-stream)
2010-09-22 19:18 EDT, Neil Bartlett CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Lewis CLA 2010-04-22 09:24:53 EDT
Currently, the ECF framwork runs on Equinox only.  There has been community input that people would like to see the ECF bundles run on other frameworks.

To do this, we will have analyze existing dependencies, and eliminate those that cannot be incorporated into other frameworks.  In some cases this may reduce support for internationalization (i.e. NLS).
Comment 1 Markus Kuppe CLA 2010-04-22 09:34:02 EDT
Do you talk ECF as a whole here or just core, remote services and discovery?
Comment 2 Scott Lewis CLA 2010-04-22 09:42:12 EDT
(In reply to comment #1)
> Do you talk ECF as a whole here or just core, remote services and discovery?

Good question.  In my mind, the candidates for doing this:

core
shared object
discovery
remote services
filetransfer
datashare
call api
presence
all providers and protocols

*Not*

*.ui plugins
some examples/apps

Of course, when we do this we will have to sequence/prioritize these.  Adding helpwanted keyword also.
Comment 3 Scott Lewis CLA 2010-09-17 22:44:49 EDT
I (Scott) have been working some on this and have some progress to report on this bug...along with information about further needed changes.

First, I've been removing references to the Equinox org.eclipse.osgi.util.NLS class in core and ECF remote services bundles...i.e:

org.eclipse.ecf
o.e.e.identity
o.e.e.sharedobject
o.e.e.provider
o.e.e.discovery
o.e.e.provider.discovery
o.e.e.osgi.services.discovery
o.e.e.osgi.services.distribution
o.e.e.provider.zookeeper
o.e.e.provider.jslp
o.e.e.provider.jmdns
o.e.e.provider.r-osgi
o.e.e.datashare
o.e.e.provider.datashare
o.e.e.remoteservice
o.e.e.remoteservice.rest
o.e.e.remoteservice.soap
o.e.e.provider.remoteservice
o.e.e.server
o.e.e.server.generic
o.e.e.storage
o.e.e.console

The use of NLS in the above cases was not for UI strings, but rather for exception messages...and it's not necessary to have exception messages be translated via NLS.

New/additional Equinox dependency issues.

The following two remote services bundles have references to classes in org.eclipse.osgi.framework.eventmgr package:

org.eclipse.ecf.osgi.services.distribution
org.eclipse.ecf.provider.remoteservice
org.eclipse.ecf.remoteservice.eventadmin

Equinox bug 325624, if/when addressed, would eliminate this issue for ECF.  In the short term, ECF may duplicate these Equinox classes within ECF to satisfy this bug/enhancement.
Comment 4 Neil Bartlett CLA 2010-09-21 19:17:22 EDT
Created attachment 179351 [details]
eventmgr supplement bundle

The attached bundle allows ECF DOSGi to resolve and run on Apache Felix.

It is extremely simple, it merely exports a copy of the o.e.o.framework.eventmgr package, which satisfies the imports of the ECF bundles. It has no dependencies.

NB the bundle was built with Bnd. I'm not sure if it's possible to do the same thing with Eclipse PDE without copying the source code for package. The Bnd source is as follows:

    Bundle-Version: 3.6.0
    Export-Package: org.eclipse.osgi.framework.eventmgr;version=${Bundle-Version}
Comment 5 Markus Kuppe CLA 2010-09-22 03:54:53 EDT
(In reply to comment #4)
> Created an attachment (id=179351) [details]
> eventmgr supplement bundle
> 
> The attached bundle allows ECF DOSGi to resolve and run on Apache Felix.
> 
> It is extremely simple, it merely exports a copy of the
> o.e.o.framework.eventmgr package, which satisfies the imports of the ECF
> bundles. It has no dependencies.
> 
> NB the bundle was built with Bnd. I'm not sure if it's possible to do the same
> thing with Eclipse PDE without copying the source code for package. The Bnd
> source is as follows:
> 
>     Bundle-Version: 3.6.0
>     Export-Package:
> org.eclipse.osgi.framework.eventmgr;version=${Bundle-Version}

I wonder if such a bundle has broader usage among the OSGi community and thus host it as part of the Equinox project as an "official" supplement bundle.
Comment 6 Scott Lewis CLA 2010-09-22 10:45:02 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > Created an attachment (id=179351) [details] [details]
> > eventmgr supplement bundle
> > 
> > The attached bundle allows ECF DOSGi to resolve and run on Apache Felix.
> > 
> > It is extremely simple, it merely exports a copy of the
> > o.e.o.framework.eventmgr package, which satisfies the imports of the ECF
> > bundles. It has no dependencies.
> > 
> > NB the bundle was built with Bnd. I'm not sure if it's possible to do the same
> > thing with Eclipse PDE without copying the source code for package. The Bnd
> > source is as follows:
> > 
> >     Bundle-Version: 3.6.0
> >     Export-Package:
> > org.eclipse.osgi.framework.eventmgr;version=${Bundle-Version}
> 
> I wonder if such a bundle has broader usage among the OSGi community and thus
> host it as part of the Equinox project as an "official" supplement bundle.

Neil has already opened an Equinox enhancement request...see bug 325634.  If you think it's better/more appropriate to have in separate bundle (rather than in common) then you might want to suggest than on 325624.

Because this (eventmgr availability in equinox) appears to be the only remaining dependency for ECF running on non-equinox frameworks, perhaps we should add 325624 as blocking this bug.  Any comments/thoughts before I do that?
Comment 7 Neil Bartlett CLA 2010-09-22 11:11:52 EDT
Unfortunately there is a further problem. When starting up Felix I get the following error messages:

Error:  Could not parse XML contribution for "org.eclipse.ecf.provider.remoteservice//plugin.xml". Any contributed extensions and extension points will be ignored.
Error:  Could not parse XML contribution for "org.eclipse.ecf.provider//plugin.xml". Any contributed extensions and extension points will be ignored.
Error:  Could not parse XML contribution for "org.eclipse.ecf.sharedobject//plugin.xml". Any contributed extensions and extension points will be ignored.
Error:  Could not parse XML contribution for "org.eclipse.ecf.identity//plugin.xml". Any contributed extensions and extension points will be ignored.
Error:  Could not parse XML contribution for "org.eclipse.ecf//plugin.xml". Any contributed extensions and extension points will be ignored.
Error:  Could not parse XML contribution for "org.eclipse.equinox.registry//plugin.xml". Any contributed extensions and extension points will be ignored.

This appears to be a general problem with using the Extension Registry on non-Equinox. I know this should work in theory but I don't know if anybody has actually done it in practice. My guess would be some difference in the XML parsers available from the JRE on Felix vs Equinox, but I don't have time to fully investigate this problem.
Comment 8 Markus Kuppe CLA 2010-09-22 12:28:30 EDT
(In reply to comment #6)
> Neil has already opened an Equinox enhancement request...see bug 325634.  If
> you think it's better/more appropriate to have in separate bundle (rather than
> in common) then you might want to suggest than on 325624.

.common works for me.
Comment 9 Neil Bartlett CLA 2010-09-22 12:31:38 EDT
(In reply to comment #8)
> (In reply to comment #6)
> > Neil has already opened an Equinox enhancement request...see bug 325634.  If
> > you think it's better/more appropriate to have in separate bundle (rather than
> > in common) then you might want to suggest than on 325624.
> 
> .common works for me.

No, .common would be a bad because it is also used on Equinox. Then the package would be exported both by .common and the system bundle.

The supplement bundle is intended for use on non-Equinox framework, and it exports other packages that are otherwise exported only by the Equinox system bundle. It's the right place for this export.
Comment 10 Scott Lewis CLA 2010-09-22 13:24:52 EDT
WRT the registry issue described in comment 7, Neil has found a mailing list posting that describes this issue and provides an apparent work-around:

http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05302.html
Comment 11 Neil Bartlett CLA 2010-09-22 13:28:53 EDT
(In reply to comment #10)
> WRT the registry issue described in comment 7, Neil has found a mailing list
> posting that describes this issue and provides an apparent work-around:
> 
> http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05302.html

I confirm that Stuart's workaround does solve the registry issue.

ECF still does not work completely when using the ECF Generic provider, but it appears to be an issue in Felix with Java serialization:

Class not found sharedObjectID=StringID[org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter] containerID=StringID[xzGaUflMm3U64NH9UVGIVzDfp5A=]
java.lang.ClassNotFoundException: [Ljava.lang.Object;
	at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:814)
	at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:61)
	at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1733)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at org.eclipse.ecf.provider.util.IdentifiableObjectInputStream.resolveClass(IdentifiableObjectInputStream.java:42)

This doesn't look like an ECF issue at all. I will post a question about it on one of the Felix lists.
Comment 12 Neil Bartlett CLA 2010-09-22 13:44:32 EDT
On further consideration I believe it is in fact an ECF bug, since the code in question calls ClassLoader.loadClass(). This method is not aware of the Java array class name syntax, i.e "[Ljava.lang.Object;"

See the following Sun bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6500212

Bottom line, change myLoader.loadClass(className) --> Class.forName(className, true, myLoader)
Comment 13 Scott Lewis CLA 2010-09-22 18:38:20 EDT
(In reply to comment #12)
> On further consideration I believe it is in fact an ECF bug, since the code in
> question calls ClassLoader.loadClass(). This method is not aware of the Java
> array class name syntax, i.e "[Ljava.lang.Object;"
> 
> See the following Sun bug:
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6500212
> 
> Bottom line, change myLoader.loadClass(className) --> Class.forName(className,
> true, myLoader)


I've changed IdentifiableObjectInputStream to use Class.forName/3 rather than classloader.loadClass and released this change to HEAD.

This will be in ECF 3.4 and going forward, but it's too late to get into Helios maintenance release (3.3.1).
Comment 14 Neil Bartlett CLA 2010-09-22 19:18:56 EDT
Created attachment 179426 [details]
equinox/felix "adapter" bundle

The fix described by Scott in Comment 13 works. I have been able to invoke a service running under Felix from a client that is running Equinox.

Attached is a new bundle that implements both of the workarounds required, i.e.:
* exports the eventmgr package
* registers a SAXParserFactory service

Note that this bundle must be started before the Extension Registry bundle, which can be achieved using start levels.
Comment 15 Jeff McAffer CLA 2010-09-23 10:47:09 EDT
cool
Comment 16 Wim Jongman CLA 2010-09-23 12:33:16 EDT
(In reply to comment #15)
> cool

I would spell that with a capitol C ;)
Comment 17 Markus Kuppe CLA 2010-09-24 04:07:18 EDT
Do you run the Felix instance from inside Eclipse via a .launch config? If so, we should be able to include this in our CI builds.
Comment 18 Markus Kuppe CLA 2010-11-12 08:01:44 EST
(In reply to comment #10)
> WRT the registry issue described in comment 7, Neil has found a mailing list
> posting that describes this issue and provides an apparent work-around:
> 
> http://dev.eclipse.org/mhonarc/lists/equinox-dev/msg05302.html

Is it likely that this workaround won't be needed anymore in the near future?
Comment 19 Markus Kuppe CLA 2010-11-12 08:43:07 EST
FWIW: ECF's github [0] now contains everything that's necessary to run ECF remote services on Apache Felix with pax-runner. 


[0] https://github.com/ECF/ECF4Felix
Comment 20 Scott Lewis CLA 2011-03-14 14:26:21 EDT
The dependencies described by this bug have been removed, and ECF can run properly on Felix.  See documentation here https://github.com/ECF/ECF4Felix for the steps to actually do so.

Resolving as fixed.