Code Monkey home page Code Monkey logo

knopflerfish.org's Introduction

Knopflerfish

Knopflerfish is a leading universal open source OSGi Service Platform. Knopflerfish implements it's own OSGi framework as defined by the OSGi Core Specification and a o a large set of the bundles / services defined by OSGi Compendium Specification. Knopflerfish also includes various optional services such as OSGi wrappers for popular 3rd party libraries, knopflerfish specific bundles / services, and utilities and development tools.

Knopflerfish is designed to be compliant with the OSGi Release 6 specifications.

The Knopflerfish website has the full documentation and Knopflerfish OSGi Service Platform SDK's available for download. https://www.knopflerfish.org

Building Knopflerfish OSGi

Prerequisites

  • JDK 8, available from Open JDK, Oracle or elsewhere.
  • Ant 1.9.1 or later, available from ant.apache.org.
  • openssl, to create and manipulate certificates when using security and the Conditional Permission Admin (CPA) service. Test suites for CPA can not be built and executed without openssl.
  • ProGuard 4.10 or later, tested with 5.2. This is only need if you want to build the compact version of the framework. You need ProGuard 5 or later if you want to build with Java 8.
  • Knopflerfish can be built with JDK 11 or JDK 17, but there are some limitations. Please see the release notes for more info

Java compatibility

With the release of Knopflerfish 6.2 Java 8 is the baseline for building and running Knopflerfish.

The Knopflerfish 6.1 releases remain as an alternative for building and running Knopflerfish on Java 6 or Java 7.

The Knopflerfish SDK can be rebuilt for other JDK versions if preferred. For a comprehensive explanation of running and building Knopflerfish with different JDK versions please consult: https://www.knopflerfish.org/osgi_java_compatibility_guide.html

How to build

  1. Clone this repository

  2. Step into the osgi subdir and call ant

    > cd osgi
    > ant
    

This will build the framework and all essential OSGi bundles.

After a successful build a framework.jar will be created. Compiled bundles are placed in the jars directory.

To start the platform simply run:

java -jar framework.jar

To get more start-up options:

java -jar framework.jar -help

Please refer to the documentation for a complete description on starting Knopflerfish and start options.

Building the Knopflerfish OSGi SDK

A complete Knopflerfish OSGi SDK distribution can also be built. In this case build from the root directory of the repo and call the distrib target:

ant distrib

This target will compile all bundles, including test bundles. run the knopflerfish test suite, generate javadoc and bundle specific documentation, and finally create a self-extracting jar file with the complete SDK.

Working with bndtools

Knopflerfish itself is not built with bnd or bndtools, but it is very easy to integrate or use knopflerfish since an OSGi repository index file is generated in the build process.

Insert the following in the .bnd file of your project.

-plugin.org.knopflerfish.kf6: \
	aQute.bnd.repository.osgi.OSGiRepository; \
		locations=https://www.knopflerfish.org/releases/6.2.0/osgi/jars/index.xml; \
		name=kf6

and replace the location with a file URL pointing to your local Knopflerfish repository.

Working with maven

During the distribution build a maven2 repository is built which can be used as a local maven repository.

More information on user maven can be found here: https://www.knopflerfish.org/maven.html

About Knopflerfish

Knopflerfish is a leading universal open source OSGi Service Platform. https://www.knopflerfish.org

The development is led and maintained by Makewave https://www.makewave.com

As a complement to the freely available Knopflerfish, Makewave offers Knopflerfish Pro, the certified and fully supported edition of Knopflerfish.

knopflerfish.org's People

Contributors

chlarsson avatar d3bjorn avatar deining avatar dpolivaev avatar janste63 avatar joek-makewave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

knopflerfish.org's Issues

Service event lost if filtering is changed during delivery

If you change the filtering of a service listener by calling BundleContext.addServiceListener() when an event delivery is in progress, then the events queued will be dropped. This is true even if the event matched both before and after the filtering change.

Compiling KF with JDK 11

Compiling KF (in develop) with JDK11 fails due to ASM issues.

New version of asm is required, e.g. asm >= 7

Change group id of maven artifacts

The maven group id of the knopflerfish bundles should be changed to include the knopflerfish major version. With Knopflerfish's source code version first approach this will allow the same bundle to exist with the same name and version, potentially compiled with different JDK versions, but under different group id's in the same maven repository.

Patches for Debian package

hello knopflerfish developers,

I am using this channel because unfortunately, no mailing list seems to exist
(http://www.knopflerfish.org/mailman/listinfo). Is there something I missed?

I have two simple questions concerning patching 6.1.0's framework's build system (osgi/framework/build.xml):

  1. how can I build with another osgi.annotation jar? I tried this:
-  <property name="osgi.annotation.jar" location="${topdir}/annotations/osgi.annotation-6.0.1.jar"/>
+  <property name="osgi.annotation.jar" location="/usr/share/java/osgi.annotation.jar"/>

but I still get:

[javac]
/home/felix/knopflerfish-osgi-unstable/knopflerfish-osgi/osgi/framework/src/org/osgi/framework/Constants.java:19:
error: package org.osgi.annotation.versioning does not exist
$ jar tf /usr/share/java/osgi.annotation.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/osgi/
org/osgi/annotation/
org/osgi/annotation/versioning/
org/osgi/annotation/versioning/ConsumerType.class
org/osgi/annotation/versioning/ProviderType.class
org/osgi/annotation/versioning/Version.class
org/osgi/annotation/versioning/package-info.class
  1. How can I build without android support? Is the following patch correct?
-  <import file="${ant.dir}/android.xml"/>
+  <!--<import file="${ant.dir}/android.xml"/>-->

Many Thanks!
Felix

Desktop bundle uses no longer supported com.apple.eawt classes

Sep 22 16:44:56 WARNING #25 Desktop - This version of Mac OS X does not support the Apple EAWT. Application quit handling has been disabled (java.lang.ClassNotFoundException: com.apple.eawt.QuitHandler)
java.lang.ClassNotFoundException: com.apple.eawt.QuitHandler
at org.knopflerfish.framework.BundleClassLoader.findClass(BundleClassLoader.java:176)
at org.knopflerfish.framework.BundleClassLoader.loadClass(BundleClassLoader.java:305)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:292)
at org.knopflerfish.bundle.desktop.swing.OSXAdapter.setQuitHandler(OSXAdapter.java:130)
at org.knopflerfish.bundle.desktop.swing.Desktop.start(Desktop.java:357)
at org.knopflerfish.bundle.desktop.swing.Activator.openDesktop(Activator.java:381)
at org.knopflerfish.bundle.desktop.swing.Activator$3.run(Activator.java:367)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:711)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Sep 22 16:44:56 WARNING #25 Desktop - This version of Mac OS X does not support the Apple EAWT. Application about handling has been disabled (java.lang.ClassNotFoundException: com.apple.eawt.AboutHandler)
java.lang.ClassNotFoundException: com.apple.eawt.AboutHandler
at org.knopflerfish.framework.BundleClassLoader.findClass(BundleClassLoader.java:176)
at org.knopflerfish.framework.BundleClassLoader.loadClass(BundleClassLoader.java:305)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:292)
at org.knopflerfish.bundle.desktop.swing.OSXAdapter.setAboutHandler(OSXAdapter.java:170)
at org.knopflerfish.bundle.desktop.swing.Desktop.start(Desktop.java:361)
at org.knopflerfish.bundle.desktop.swing.Activator.openDesktop(Activator.java:381)
at org.knopflerfish.bundle.desktop.swing.Activator$3.run(Activator.java:367)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:711)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Publish tagged snapshot builds

Snapshots should be published on knopflerfish.org when the commit is tagged as a snapshot release.

The development team may decide from time to time to make snapshot releases, typically after adding or updating bundles / features in the develop branch. Beta releases and/or release candidates may also be tagged as snapshot releases, i.e. the snapshots are not limited to the develop branch.

asm and JDK9

The only version of asm that supports JDK9 is 6.0-beta. A released version of asm would be preferred.

StackOverflowError when using JAXRS publisher

A StackOverflowError is created when using the JAXRS Publisher bundle in combination with KF's SCR.

Code getting/ungetting service is:
@OverRide
public Object addingService( ServiceReference reference ) {
Object service = context.getService( reference );
return delegateAddService( reference, service );
}

private Object delegateAddService( ServiceReference reference, Object service ) {
Object result;
if( isResource( service ) ) {
result = connector.addResource( reference );
} else {
context.ungetService( reference );
result = null;
}
return result;
}

The JAXRS code can be found at:
https://github.com/hstaudacher/osgi-jax-rs-connector

Loop is below.
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.delegateAddService(ResourceTracker.java:48)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.addingService(ResourceTracker.java:40)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
at org.knopflerfish.framework.Listeners.serviceChanged(Listeners.java:430)
at org.knopflerfish.framework.PermissionOps.callServiceChanged(PermissionOps.java:340)
at org.knopflerfish.framework.Services.register(Services.java:179)
at org.knopflerfish.framework.BundleContextImpl.registerService(BundleContextImpl.java:274)
at org.knopflerfish.bundle.component.ComponentConfiguration.registerService(ComponentConfiguration.java:341)
at org.knopflerfish.bundle.component.DelayedComponent.activateComponentConfiguration(DelayedComponent.java:60)
at org.knopflerfish.bundle.component.Component.satisfied(Component.java:492)
at org.knopflerfish.bundle.component.Component.removeComponentConfiguration(Component.java:835)
at org.knopflerfish.bundle.component.ComponentConfiguration.remove(ComponentConfiguration.java:596)
at org.knopflerfish.bundle.component.ComponentConfiguration.deactivate(ComponentConfiguration.java:236)
at org.knopflerfish.bundle.component.ComponentConfiguration.ungetService(ComponentConfiguration.java:537)
at org.knopflerfish.framework.PermissionOps.callUngetService(PermissionOps.java:370)
at org.knopflerfish.framework.ServiceRegistrationImpl.ungetService(ServiceRegistrationImpl.java:551)
at org.knopflerfish.framework.ServiceReferenceImpl.ungetService(ServiceReferenceImpl.java:220)
at org.knopflerfish.framework.BundleContextImpl.ungetService(BundleContextImpl.java:406)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.delegateAddService(ResourceTracker.java:48)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.addingService(ResourceTracker.java:40)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
at org.knopflerfish.framework.Listeners.serviceChanged(Listeners.java:430)
at org.knopflerfish.framework.PermissionOps.callServiceChanged(PermissionOps.java:340)
at org.knopflerfish.framework.Services.register(Services.java:179)
at org.knopflerfish.framework.BundleContextImpl.registerService(BundleContextImpl.java:274)
at org.knopflerfish.bundle.component.ComponentConfiguration.registerService(ComponentConfiguration.java:341)
at org.knopflerfish.bundle.component.DelayedComponent.activateComponentConfiguration(DelayedComponent.java:60)
at org.knopflerfish.bundle.component.Component.satisfied(Component.java:492)
at org.knopflerfish.bundle.component.Component.removeComponentConfiguration(Component.java:835)
at org.knopflerfish.bundle.component.ComponentConfiguration.remove(ComponentConfiguration.java:596)
at org.knopflerfish.bundle.component.ComponentConfiguration.deactivate(ComponentConfiguration.java:236)
at org.knopflerfish.bundle.component.ComponentConfiguration.ungetService(ComponentConfiguration.java:537)
at org.knopflerfish.framework.PermissionOps.callUngetService(PermissionOps.java:370)
at org.knopflerfish.framework.ServiceRegistrationImpl.ungetService(ServiceRegistrationImpl.java:551)
at org.knopflerfish.framework.ServiceReferenceImpl.ungetService(ServiceReferenceImpl.java:220)
at org.knopflerfish.framework.BundleContextImpl.ungetService(BundleContextImpl.java:406)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.delegateAddService(ResourceTracker.java:48)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.addingService(ResourceTracker.java:40)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
at org.knopflerfish.framework.Listeners.serviceChanged(Listeners.java:430)
at org.knopflerfish.framework.PermissionOps.callServiceChanged(PermissionOps.java:340)
at org.knopflerfish.framework.Services.register(Services.java:179)
at org.knopflerfish.framework.BundleContextImpl.registerService(BundleContextImpl.java:274)
at org.knopflerfish.bundle.component.ComponentConfiguration.registerService(ComponentConfiguration.java:341)
at org.knopflerfish.bundle.component.DelayedComponent.activateComponentConfiguration(DelayedComponent.java:60)
at org.knopflerfish.bundle.component.Component.satisfied(Component.java:492)
at org.knopflerfish.bundle.component.Component.removeComponentConfiguration(Component.java:835)
at org.knopflerfish.bundle.component.ComponentConfiguration.remove(ComponentConfiguration.java:596)
at org.knopflerfish.bundle.component.ComponentConfiguration.deactivate(ComponentConfiguration.java:236)
at org.knopflerfish.bundle.component.ComponentConfiguration.ungetService(ComponentConfiguration.java:537)
at org.knopflerfish.framework.PermissionOps.callUngetService(PermissionOps.java:370)
at org.knopflerfish.framework.ServiceRegistrationImpl.ungetService(ServiceRegistrationImpl.java:551)
at org.knopflerfish.framework.ServiceReferenceImpl.ungetService(ServiceReferenceImpl.java:220)
at org.knopflerfish.framework.BundleContextImpl.ungetService(BundleContextImpl.java:406)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.delegateAddService(ResourceTracker.java:48)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.addingService(ResourceTracker.java:40)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
at org.knopflerfish.framework.Listeners.serviceChanged(Listeners.java:430)
at org.knopflerfish.framework.PermissionOps.callServiceChanged(PermissionOps.java:340)
at org.knopflerfish.framework.Services.register(Services.java:179)
at org.knopflerfish.framework.BundleContextImpl.registerService(BundleContextImpl.java:274)
at org.knopflerfish.bundle.component.ComponentConfiguration.registerService(ComponentConfiguration.java:341)
at org.knopflerfish.bundle.component.DelayedComponent.activateComponentConfiguration(DelayedComponent.java:60)
at org.knopflerfish.bundle.component.Component.satisfied(Component.java:492)
at org.knopflerfish.bundle.component.Component.removeComponentConfiguration(Component.java:835)
at org.knopflerfish.bundle.component.ComponentConfiguration.remove(ComponentConfiguration.java:596)
at org.knopflerfish.bundle.component.ComponentConfiguration.deactivate(ComponentConfiguration.java:236)
at org.knopflerfish.bundle.component.ComponentConfiguration.ungetService(ComponentConfiguration.java:537)
at org.knopflerfish.framework.PermissionOps.callUngetService(PermissionOps.java:370)
at org.knopflerfish.framework.ServiceRegistrationImpl.ungetService(ServiceRegistrationImpl.java:551)
at org.knopflerfish.framework.ServiceReferenceImpl.ungetService(ServiceReferenceImpl.java:220)
at org.knopflerfish.framework.BundleContextImpl.ungetService(BundleContextImpl.java:406)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.delegateAddService(ResourceTracker.java:48)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.addingService(ResourceTracker.java:40)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
at org.knopflerfish.framework.Listeners.serviceChanged(Listeners.java:430)
at org.knopflerfish.framework.PermissionOps.callServiceChanged(PermissionOps.java:340)
at org.knopflerfish.framework.Services.register(Services.java:179)
at org.knopflerfish.framework.BundleContextImpl.registerService(BundleContextImpl.java:274)
at org.knopflerfish.bundle.component.ComponentConfiguration.registerService(ComponentConfiguration.java:341)
at org.knopflerfish.bundle.component.DelayedComponent.activateComponentConfiguration(DelayedComponent.java:60)
at org.knopflerfish.bundle.component.Component.satisfied(Component.java:492)
at org.knopflerfish.bundle.component.Component.removeComponentConfiguration(Component.java:835)
at org.knopflerfish.bundle.component.ComponentConfiguration.remove(ComponentConfiguration.java:596)
at org.knopflerfish.bundle.component.ComponentConfiguration.deactivate(ComponentConfiguration.java:236)
at org.knopflerfish.bundle.component.ComponentConfiguration.ungetService(ComponentConfiguration.java:537)
at org.knopflerfish.framework.PermissionOps.callUngetService(PermissionOps.java:370)
at org.knopflerfish.framework.ServiceRegistrationImpl.ungetService(ServiceRegistrationImpl.java:551)
at org.knopflerfish.framework.ServiceReferenceImpl.ungetService(ServiceReferenceImpl.java:220)
at org.knopflerfish.framework.BundleContextImpl.ungetService(BundleContextImpl.java:406)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.delegateAddService(ResourceTracker.java:48)
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.addingService(ResourceTracker.java:40)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
at org.knopflerfish.framework.Listeners.serviceChanged(Listeners.java:430)
at org.knopflerfish.framework.PermissionOps.callServiceChanged(PermissionOps.java:340)

Multiple Declarative Services component instances are not created for multiple factory configurations

This is concerning the Declarative Services SCR bundle (component_all-6.0.0.jar).

According to OSGi Compendium R6 Specification, item 112.7 (Declarative Services Specification / Deployment),

Factory Configuration - If one of the configuration PIDs matches a factory PID, with zero or more
Configurations, then for each Configuration of the factory PID, a component configuration must
be created that will obtain additional component properties from Configuration Admin.

If I have a component with configuration-policy="require", and multiple Configuration Objects in Configuration Admin with
Factory PID matching my component's configuration-pid (which in my case is equal to component name), then for each Configuration Object I should have a Component Instance created and activated, but this is not happening.

Here's my component:

@org.osgi.service.component.annotations.Component(name = "Component", configurationPolicy = ConfigurationPolicy.REQUIRE, immediate = true)
public class Component {

    public Component( ) {
        println("=== Constructor ===");
    }


    @Activate
    public void activate(Map properties) {
        println("=== Activate " + properties.get("number") + " ===");
        println(properties);
    }

    @Deactivate
    public void deactivate(Map properties) {
        println("=== Deactivate " + properties.get("number") + " ===");
        println(properties);
    }

    private void println(Map properties) {
        if (properties != null) {
            Iterator it = properties.entrySet().iterator( );
            while (it.hasNext()) {
                println(it.next().toString());
            }
        }
    }

    private void println(String message) {
        System.out.println(message);
    }
}

And here's the console log of me creating three factory configurations and only the first component instance being created:

enter configuration
configuration> create -f Component
configuration> set number 1
configuration> save
configuration> [stdout] === Constructor ===
[stdout] === Activate 1 ===
[stdout] service.pid=Component._0
[stdout] service.factoryPid=Component
[stdout] component.name=Component
[stdout] number=1
[stdout] component.id=1
create -f Component
configuration> set number 2
configuration> save
configuration> create -f Component
configuration> set number 3
configuration> save
configuration> show
[-] Component._0
 factory PID: Component
 location: -
 change count: 1
 properties:
  number= 1
  service.factoryPid= Component
  service.pid= Component._0
[-] Component._1
 factory PID: Component
 location: -
 change count: 1
 properties:
  number= 2
  service.factoryPid= Component
  service.pid= Component._1
[-] Component._2
 factory PID: Component
 location: -
 change count: 1
 properties:
  number= 3
  service.factoryPid= Component
  service.pid= Component._2
configuration> 

ConditionalPermissionAdminTestSuite fails with Oracle JDK 1.8.0_77-b03

After installing the new Oracle JDK (build 1.8.0_77-b03) on MacOS 10.11.4, the following three test
Condperm210a, Condperm220a and Condperm230a in the ConditionalPermissionAdminTestSuite fails.

Failure: Condperm210a - P3 not exporting bundle, BundleImpl[id=140] != BundleImpl[id=142] :CONDPERM210A:FAIL
junit.framework.AssertionFailedError: P3 not exporting bundle, BundleImpl[id=140] != BundleImpl[id=142] :CONDPERM210A:FAIL
 at junit.framework.Assert.fail(Assert.java:47)
 at org.knopflerfish.bundle.condpermadmin_test.CondPermAdminTestSuite$Condperm210a.runTest(CondPermAdminTestSuite.java:618)
 at junit.framework.TestCase.runBare(TestCase.java:127)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:118)
 at junit.framework.TestSuite.runTest(TestSuite.java:208)
 at junit.framework.TestSuite.run(TestSuite.java:203)
 at org.knopflerfish.bundle.junit.JUnitServiceImpl.runTestCase(JUnitServiceImpl.java:177)
 at org.knopflerfish.bundle.junit.JUnitServiceImpl.runTestXML(JUnitServiceImpl.java:82)
 at org.knopflerfish.bundle.junit.JUnitServiceImpl.runTest(JUnitServiceImpl.java:62)
 at org.knopflerfish.bundle.junit_runner.Grunt.doRun(Grunt.java:198)
 at org.knopflerfish.bundle.junit_runner.Grunt.doGrunt(Grunt.java:79)
 at org.knopflerfish.bundle.junit_runner.Activator.start(Activator.java:57)
 at org.knopflerfish.framework.BundleImpl.start0(BundleImpl.java:387)
 at org.knopflerfish.framework.BundleThread.run(BundleThread.java:145)

Failure: Condperm220a - started test bundleP4! :CONDPERM220A:FAIL
junit.framework.AssertionFailedError: started test bundleP4! :CONDPERM220A:FAIL
 at junit.framework.Assert.fail(Assert.java:47)
 at org.knopflerfish.bundle.condpermadmin_test.CondPermAdminTestSuite$Condperm220a.runTest(CondPermAdminTestSuite.java:703)
 at junit.framework.TestCase.runBare(TestCase.java:127)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:118)
 at junit.framework.TestSuite.runTest(TestSuite.java:208)
 at junit.framework.TestSuite.run(TestSuite.java:203)
 at org.knopflerfish.bundle.junit.JUnitServiceImpl.runTestCase(JUnitServiceImpl.java:177)
 at org.knopflerfish.bundle.junit.JUnitServiceImpl.runTestXML(JUnitServiceImpl.java:82)
 at org.knopflerfish.bundle.junit.JUnitServiceImpl.runTest(JUnitServiceImpl.java:62)
 at org.knopflerfish.bundle.junit_runner.Grunt.doRun(Grunt.java:198)
 at org.knopflerfish.bundle.junit_runner.Grunt.doGrunt(Grunt.java:79)
 at org.knopflerfish.bundle.junit_runner.Activator.start(Activator.java:57)
 at org.knopflerfish.framework.BundleImpl.start0(BundleImpl.java:387)
 at org.knopflerfish.framework.BundleThread.run(BundleThread.java:145)

Failure: Condperm230a - started test bundleP5! :CONDPERM230A:FAIL
junit.framework.AssertionFailedError: started test bundleP5! :CONDPERM230A:FAIL
 at junit.framework.Assert.fail(Assert.java:47)
 at org.knopflerfish.bundle.condpermadmin_test.CondPermAdminTestSuite$Condperm230a.runTest(CondPermAdminTestSuite.java:795)
 at junit.framework.TestCase.runBare(TestCase.java:127)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:118)
 at junit.framework.TestSuite.runTest(TestSuite.java:208)
 at junit.framework.TestSuite.run(TestSuite.java:203)
 at org.knopflerfish.bundle.junit.JUnitServiceImpl.runTestCase(JUnitServiceImpl.java:177)
 at org.knopflerfish.bundle.junit.JUnitServiceImpl.runTestXML(JUnitServiceImpl.java:82)
 at org.knopflerfish.bundle.junit.JUnitServiceImpl.runTest(JUnitServiceImpl.java:62)
 at org.knopflerfish.bundle.junit_runner.Grunt.doRun(Grunt.java:198)
 at org.knopflerfish.bundle.junit_runner.Grunt.doGrunt(Grunt.java:79)
 at org.knopflerfish.bundle.junit_runner.Activator.start(Activator.java:57)
 at org.knopflerfish.framework.BundleImpl.start0(BundleImpl.java:387)
 at org.knopflerfish.framework.BundleThread.run(BundleThread.java:145)

This was tested with the framework 7.2.3 commit.
But the problem was also there in the previous version.

reference:file: bundles can not be loaded if org.knopflerfish.osgi.registerserviceurlhandler=false

freeplane uses knopflerfish as OSGi framework.
Recently it was added an API which allows to embed it into java applications.
One special use case is running in servlet to perform calculations defined in mind maps.

Because URL.setURLStreamHandlerFactory is already used by Tomcat ( embedded in spring boot)
I used configuration option org.knopflerfish.osgi.registerserviceurlhandler=false
Unfortunately as a consequence protocol 'reference' was no more resolved.

However it is needed at Bundles.install0 which tries to create the bundle URL calling URL url = new URL(location);

 BundleImpl install0(String location, InputStream in, Object checkContext, Bundle caller)
    throws BundleException {
    InputStream bin;
    BundleArchive ba = null;
    try {
      if (in == null) {
        // Do it the manual way to have a chance to
        // set request properties
        final URL url  = new URL(location);
        final URLConnection conn = url.openConnection();

As a work around I added following static block to one of the components:

       try {
            Constructor<ServiceURLStreamHandlerFactory> constructor = ServiceURLStreamHandlerFactory.class.getDeclaredConstructor();
            constructor.setAccessible(true);
            ServiceURLStreamHandlerFactory systemUrlStreamHandlerFactory = constructor.newInstance();
            TomcatURLStreamHandlerFactory.getInstance().addUserFactory(systemUrlStreamHandlerFactory);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

It creates ServiceURLStreamHandlerFactory from knopflerfish and registers it as user factory by TomcatURLStreamHandlerFactory.

If the constructor was public or I could at least access FrameworkContext.systemUrlStreamHandlerFactory or some static method to create it I would not need the trick with the reflection.

It would be even better if the correct handler was used directly at the position where URL is created.

Could you consider any of that?
Let me know if I can help by submitting a pull request.

ant bundle_doc target in installed SDK fails

The ant bundle_doc target fails in an installed SDK:

BUILD FAILED
./knopflerfish_osgi_6.1.1/osgi/build.xml:526: The following error occurred while executing this line:
./knopflerfish_osgi_6.1.1/osgi/bundles/build.xml:83: The following error occurred while executing this line:
./knopflerfish_osgi_6.1.1/osgi/bundles/build.xml:22: The following error occurred while executing this line:
./knopflerfish_osgi_6.1.1/osgi/bundles/xml/build.xml:49: The following error occurred while executing this line:
./knopflerfish_osgi_6.1.1/ant/docbuild_include.xml:36: ./knopflerfish_osgi_6.1.1/osgi/bundles/xml/doc does not exist.

repository console command

repository> list -help
Usage: list [-help] [-l] []
List repositories. Mark with a '*' in the first
column if a repository is enabled.
-l Verbose output
Name or id of repository
repository> list -l
E Id Rank Description

  • 16 0 Knopflerfish 6.1.1 Repository

  • 17 0 Knopflerfish 6.1.1 Repository

repository> list -l 17
Command execution failed, stack trace follows:
java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;
at org.knopflerfish.bundle.repositorycommands.RepositoryCommandGroup.cmdList(RepositoryCommandGroup.java:321)
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:498)
at org.knopflerfish.service.console.CommandGroupAdapter.execute(CommandGroupAdapter.java:256)
at org.knopflerfish.bundle.console.Command$2.run(Command.java:239)
at java.security.AccessController.doPrivileged(Native Method)
at org.knopflerfish.bundle.console.Command.run(Command.java:226)
at java.lang.Thread.run(Thread.java:745)
repository>

Bundle-SubversionURL

The bundle manifest header Bundle-SubversionURL should be changed to Bundle-GitURL

The default URLs must be updated for all bundles.

The BundleManifestTask (ant task) must be updated to use new header.

The task could possibly rewrite old values in release builds in KF6

Dynamic import dead lock

There is a small chance for a dead lock if you dynamicly import a package and at the same time resolve a bundle that access the same package.

Fragments sometimes fail to resolve

If you have two fragment or more that imports and exports two packages or more between them selves and they have bundle ids below the host bundle, then if you resolve the host the fragments will not attach properly.

Deadlock weaving hooks

Framework Version 8.0.6 - at org.knopflerfish.framework.WeavingHooks.callHooks(WeavingHooks.java:119)

NPE in http service with felix web console

I loaded:

  • org.knopflerfish.bundle/http/5.2.0
  • org.knopflerfish.bundle/jsdk-API/2.5.0.kf3-2
  • org.apache.felix/org.apache.felix.webconsole/all/4.2.16
  • org.apache.felix/org.apache.felix.webconsole.plugins.ds/2.0.2
  • org.apache.felix/org.apache.felix.webconsole.plugins.scriptconsole/1.0.2
  • org.jruby/jruby-complete/9.1.6.0

and was rewarded with:

 [ERROR] 2016-11-18 05:42:54.142 [HttpServer-WorkerThread-6] org.knopflerfish.bundle.http.5.2.0 - [Unknown]Internal error: java.lang.NullPointerException
java.lang.NullPointerException: null
	at org.knopflerfish.bundle.http.ResponseImpl.setContentType(ResponseImpl.java:736) ~[?:?]
	at javax.servlet.ServletResponseWrapper.setContentType(ServletResponseWrapper.java:130) ~[org.knopflerfish.bundle-jsdk-API-2.5.0.kf3-2.jar:?]
	at org.apache.felix.webconsole.AbstractWebConsolePlugin.spoolResource0(AbstractWebConsolePlugin.java:594) ~[?:?]
	at org.apache.felix.webconsole.AbstractWebConsolePlugin$1.run(AbstractWebConsolePlugin.java:526) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_60]
	at org.apache.felix.webconsole.AbstractWebConsolePlugin.spoolResource(AbstractWebConsolePlugin.java:521) ~[?:?]
	at org.apache.felix.webconsole.AbstractWebConsolePlugin.doGet(AbstractWebConsolePlugin.java:181) ~[?:?]
	at org.apache.felix.webconsole.plugins.ds.internal.WebConsolePlugin.doGet(WebConsolePlugin.java:194) ~[?:?]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:691) ~[org.knopflerfish.bundle-jsdk-API-2.5.0.kf3-2.jar:?]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:804) ~[org.knopflerfish.bundle-jsdk-API-2.5.0.kf3-2.jar:?]
	at org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:567) ~[?:?]
	at org.apache.felix.webconsole.internal.servlet.OsgiManager$3.run(OsgiManager.java:465) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_60]
	at org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:461) ~[?:?]
	at org.knopflerfish.bundle.http.RequestDispatcherImpl.service(RequestDispatcherImpl.java:162) ~[org.knopflerfish.bundle-http-5.2.0.jar:?]
	at org.knopflerfish.bundle.http.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:461) ~[org.knopflerfish.bundle-http-5.2.0.jar:?]
	at org.knopflerfish.bundle.http.Transaction.run(Transaction.java:177) [org.knopflerfish.bundle-http-5.2.0.jar:?]
	at org.knopflerfish.bundle.http.TransactionManager$WorkerThread.run(TransactionManager.java:288) [org.knopflerfish.bundle-http-5.2.0.jar:?]

Using target property filters may cause SCR to give incorrect errors for circular component chains

The following SCR service.xml fill produce an incorrect error for a circular component chain.

A complete test example will be checked into the branch of the same name as this issue.

<?xml version="1.0" encoding="UTF-8"?>

<components>

  <component name="org.knopflerfish.bundle.componentFilter_testA"
	     immediate="true"
             xmlns="http://www.osgi.org/xmlns/scr/v1.0.0">
    <implementation
       class="org.knopflerfish.bundle.componentFilter_test.GeneralComponentImplA"/>

    <service>
      <provide
         interface="org.knopflerfish.service.componentFilter_test.GeneralComponent"/>
    </service>

    <property name="actionName" value="A" />

    <reference  name = "org.knopflerfish.service.componentFilter_test.OtherComponent"
		interface = "org.knopflerfish.service.componentFilter_test.OtherComponent"
		bind = "setOtherComponent"
		policy="static"
		cardinality="1..1"
		/>
    
  </component>

  <component name="org.knopflerfish.bundle.componentFilter_testB"
	     immediate="true"
             xmlns="http://www.osgi.org/xmlns/scr/v1.0.0">
    
    <implementation
       class="org.knopflerfish.bundle.componentFilter_test.GeneralComponentImplB"/>

    <service>
      <provide
         interface="org.knopflerfish.service.componentFilter_test.GeneralComponent"/>
    </service>

    <property name="actionName" value="B" /> 
    
    <reference  name = "org.knopflerfish.service.componentFilter_test.GeneralComponent"
		interface = "org.knopflerfish.service.componentFilter_test.GeneralComponent"
		target = "(actionName=A)"
		bind = "setGeneralComponentImplA"
		policy="static"
		cardinality="1..1"
		/>
    
  </component>

</components>

When removing the reference dependency to the OtherComponent, which is non-existing, the example above works as expected. I..e. it is only when the filtered target component is not available the problem occurs.

Improve framework log message when unable to resolve

When the framework fails to resolve a package the following error message is written:
[stderr] org.osgi.framework.BundleException: Bundle#7, unable to resolve: Missing package(s) or can not resolve all of the them:
.... package name(s) follows....

Would be preferred if also the bundle name and/or symbolic name can be written in addition to the bundle id. Especially if the number of bundles is large.

Change symbolic name of log bundle

The symbolic name of the log bundle should be changed to org.knopflerfish.bundle.log

This will make the log bundle naming in line with all other Knopflerfish bundles.

Knopflerfish fails to start if arbitraty working directory contains files with special names

Usually SystemBundle.initSystemBundle() initializes list of packages exported by SystemBundle reading lists contained in internal resource files packages.txt and exports contained in framework.jar using internal method addSysPackagesFromFile . The same method is used to add packages from file given in property org.knopflerfish.framework.system.packages.file . Therefore this method tries to find the file on the disk before it takes the resource from the jar.

final File f = new File(new File(sysPkgFile).getAbsolutePath());

    if (!f.exists() || !f.isFile()) {
      url = SystemBundle.class.getResource(sysPkgFile);
      if (null == url) {
        url = SystemBundle.class.getResource("/" + sysPkgFile);
      }

Unfortunately it causes a failure if the working directory occasionally contains files with matching names. Our users have experienced such failures.

Therefore I ask you to change the above logic so that framework can be started in any directory and it does not depend on its content.

As a work around I am going to temporarily change values of system property user.dir when the framework is initialized and change it back when the first plug-in is being activated.

NPE in StartLevelController

DEBUG: errors - FrameworkErrorEvent throwable:

java.lang.NullPointerException
at org.knopflerfish.framework.StartLevelController.increaseStartLevel(StartLevelController.java:291)
at org.knopflerfish.framework.StartLevelController$1.run(StartLevelController.java:243)
at org.knopflerfish.framework.StartLevelController.run(StartLevelController.java:171)
at java.lang.Thread.run(Thread.java:745)

Occurs if a bundle is uninstalled during startup

NullPointerException in Component.newComponentConfiguration when multiple component instances are bound to the same service and have the same target property

I have two components defined: TargetService and Component.

TargetService

public interface TargetService {
}

@org.osgi.service.component.annotations.Component(
        name = "TargetService",



        configurationPolicy = ConfigurationPolicy.REQUIRE,
        immediate = true)
public class TargetServiceImpl implements TargetService {

    @Activate
    public void activate(Map properties) {
        println("=== TargetService Activate " + properties.get("number") + " ===");
    }

    @Deactivate
    public void deactivate(Map properties) {
        println("=== TargetService Deactivate " + properties.get("number") + " ===");
    }

    private void println(String message) {
        System.out.println(message);
    }
}

Component

@org.osgi.service.component.annotations.Component(
        name = "Component",
        configurationPolicy = ConfigurationPolicy.REQUIRE,
        immediate = true)
public class Component {

    private TargetService target;

    @Reference(unbind = "unbindTargetService")
    public void bindTargetService(TargetService target) {
        this.target = target;
    }

    public void unbindTargetService(TargetService target) {
        this.target = null;
    }

    @Activate
    public void activate(Map properties) {
        println("=== Component Activate " + properties.get("number") + " ===");
        println(properties);
    }

    @Deactivate
    public void deactivate(Map properties) {
        println("=== Component Deactivate " + properties.get("number") + " ===");
        println(properties);
    }

    private void println(Map properties) {
        if (properties != null) {
            Iterator it = properties.entrySet().iterator( );
            while (it.hasNext()) {
                println(it.next().toString());
            }
        }
    }

    private void println(String message) {
        System.out.println(message);
    }
}

I want Components 101 and 102 to be bound to TargetService 1 and Component 201 to be bound to TargetService 2, like so:

chart

Let's create their configurations:

> enter configuration
configuration> create -f Component
configuration> set TargetService.target (number=1)
configuration> set number 101
configuration> save
configuration> create -f Component
configuration> set TargetService.target (number=1)
configuration> set number 102
configuration> save
configuration> create -f Component
configuration> set TargetService.target (number=2)
configuration> set number 201
configuration> save
configuration> show
[-] Component._0
 factory PID: Component
 location: -
 change count: 1
 properties:
  TargetService.target= (number=1)
  number= 101
  service.factoryPid= Component
  service.pid= Component._0
[-] Component._1
 factory PID: Component
 location: -
 change count: 1
 properties:
  TargetService.target= (number=1)
  number= 102
  service.factoryPid= Component
  service.pid= Component._1
[-] Component._2
 factory PID: Component
 location: -
 change count: 1
 properties:
  TargetService.target= (number=2)
  number= 201
  service.factoryPid= Component
  service.pid= Component._2

Components 101 and 102 should be activated as soon as their references for TargetService 1 are satisfied.
But when TargetService configuration becomes available, a NullPointerException occurs.

configuration> create -f TargetService
configuration> set number 1
configuration> save
configuration> [stderr] ## DEBUG: errors - FrameworkErrorEvent bundle #28
[stderr] ## DEBUG: errors - FrameworkErrorEvent throwable: 
[stderr] java.lang.NullPointerException
[stderr] 	at org.knopflerfish.bundle.component.Component.newComponentConfiguration(Component.java:774)
[stderr] 	at org.knopflerfish.bundle.component.Component.newComponentConfigurations(Component.java:752)
[stderr] 	at org.knopflerfish.bundle.component.Component.satisfied(Component.java:483)
[stderr] 	at org.knopflerfish.bundle.component.Component.refAvailable(Component.java:714)
[stderr] 	at org.knopflerfish.bundle.component.Reference.refAvailable(Reference.java:456)
[stderr] 	at org.knopflerfish.bundle.component.ReferenceListener.serviceChanged(ReferenceListener.java:497)
[stderr] 	at org.knopflerfish.bundle.component.ReferenceListener.serviceEvent(ReferenceListener.java:455)
[stderr] 	at org.knopflerfish.bundle.component.ComponentServiceListener.serviceChanged(ComponentServiceListener.java:71)
[stderr] 	at org.knopflerfish.framework.Listeners.serviceChanged(Listeners.java:430)
[stderr] 	at org.knopflerfish.framework.PermissionOps.callServiceChanged(PermissionOps.java:340)
[stderr] 	at org.knopflerfish.framework.Services.register(Services.java:179)
[stderr] 	at org.knopflerfish.framework.BundleContextImpl.registerService(BundleContextImpl.java:274)
[stderr] 	at org.knopflerfish.bundle.component.ComponentService.registerService(ComponentService.java:72)
[stderr] 	at org.knopflerfish.bundle.component.ComponentConfiguration.registerComponentService(ComponentConfiguration.java:376)
[stderr] 	at org.knopflerfish.bundle.component.ImmediateComponent.activateComponentConfiguration(ImmediateComponent.java:60)
[stderr] 	at org.knopflerfish.bundle.component.Component.satisfied(Component.java:485)
[stderr] 	at org.knopflerfish.bundle.component.Component.resolvedConstraint(Component.java:582)
[stderr] 	at org.knopflerfish.bundle.component.Component.cmConfigUpdated(Component.java:645)
[stderr] 	at org.knopflerfish.bundle.component.CMConfig.cmPidSet(CMConfig.java:241)
[stderr] 	at org.knopflerfish.bundle.component.CMConfig.access$100(CMConfig.java:53)
[stderr] 	at org.knopflerfish.bundle.component.CMConfig$CMPid.set(CMConfig.java:341)
[stderr] 	at org.knopflerfish.bundle.component.CMConfig$CMPid.configUpdated(CMConfig.java:391)
[stderr] 	at org.knopflerfish.bundle.component.CMHandler.configurationEvent(CMHandler.java:116)
[stderr] 	at org.knopflerfish.bundle.cm.ListenerEvent.sendEvent(ListenerEvent.java:84)
[stderr] 	at org.knopflerfish.bundle.cm.ListenerEventQueue.run(ListenerEventQueue.java:90)
[stderr] 	at java.lang.Thread.run(Thread.java:745)
[stdout] === TargetService Activate 1 ===

I think the problem is in how Reference.update method works.

  void update(String ccid, Map dict, boolean useNoId) {
    boolean before = isSatisfied();
    boolean doCheck = updateMinCardinality(dict) && isSatisfied() != before;
    if (listener != null) {
      // We only have one listener, check if it still is true;
      if (listener.checkTargetChanged(ccid, dict)) {
        if (listener.isOnlyId(useNoId ? Component.NO_CCID : ccid)) {
          // Only one ccid change listener target
          listener.setTarget(ccid, dict);
        } else {
          // We have multiple listener we need multiple listeners
          factoryListeners = new TreeMap();
          for (String p : listener.getIds()) {
            factoryListeners.put(p, listener);
          }
          listener = null;
          // NYI, optimize, we don't have to checkTargetChanged again
        }
      } else if (useNoId) {
        // No change, just make sure that ccid is registered
        listener.addId(ccid, true);
      }
    }
    ...

The first call to this method (ccid = "Component._0") sets the target to (number=1).
The second call to this method (with ccid = "Component._1") has no effect:
listener.checkTargetChanged return false, because target hasn't changed since the previous call ((number=1)),
and useNoId is false, so neither branch there is taken and ccid "Component._1" is lost.
The third call creates factoryListeners with only two entries:

factoryListeners = {TreeMap@3447}  size = 2
 0 = {TreeMap$Entry@3453} "Component._0" -> "ReferenceListener(Reference TargetService in Immediate component: Component, target=(number=1))"
 1 = {TreeMap$Entry@3454} "Component._2" -> "ReferenceListener(Reference TargetService in Immediate component: Component, target=(number=2))"

Later, Component.newComponentConfiguration("Component._1".....) calls ref.getListener("Component._1").numAvailable( ), but ref.getListener("Component._1") returns null.

knopflerfish does not work for freeplane any more

Dear knopflerfish devs,

the freeplane project [1] uses knopflerfish for OSGi support for years.
Freeplane is somewhat special in that it loads extracted OSGi "jars":

felix@debianunstable:/$ find /usr/share/freeplane/core/org.freeplane.core/
/usr/share/freeplane/core/org.freeplane.core/
/usr/share/freeplane/core/org.freeplane.core/lib
/usr/share/freeplane/core/org.freeplane.core/lib/freeplaneeditor-1.5.jar
/usr/share/freeplane/core/org.freeplane.core/lib/jortho-1.5.jar
/usr/share/freeplane/core/org.freeplane.core/lib/freeplaneviewer.jar
/usr/share/freeplane/core/org.freeplane.core/lib/freeplaneosgi-1.5.jar
/usr/share/freeplane/core/org.freeplane.core/META-INF
/usr/share/freeplane/core/org.freeplane.core/META-INF/MANIFEST.MF

With knopflerfish 5.2.0, there is a problem when loading/starting the core bundle:
felix@debianunstable:~$ freeplane
org.knopflerfish.framework.readonly=true
org.knopflerfish.gosg.jars=reference:file:/usr/share/freeplane/core/
org.freeplane.basedirectory=/usr/share/freeplane
java.security.policy=/usr/share/freeplane/freeplane.policy
org.osgi.framework.storage=/usr/share/freeplane/fwdir
Knopflerfish OSGi framework launcher, version
Copyright 2003-2016 Knopflerfish. All Rights Reserved.
See http://www.knopflerfish.org for more information.

java.lang.IllegalArgumentException: Failed to read exports: java.io.FileNotFoundException: /home/felix/exports (No such file or directory)
at org.knopflerfish.framework.SystemBundle.addSysPackagesFromFile(SystemBundle.java:699)
at org.knopflerfish.framework.SystemBundle.initSystemBundle(SystemBundle.java:557)
at org.knopflerfish.framework.FrameworkContext.init(FrameworkContext.java:402)
at org.knopflerfish.framework.SystemBundle.doInit(SystemBundle.java:622)
at org.knopflerfish.framework.SystemBundle.init(SystemBundle.java:152)
at org.knopflerfish.framework.Main.assertFramework(Main.java:446)
at org.knopflerfish.framework.Main.handleArgs(Main.java:546)
at org.knopflerfish.framework.Main.start(Main.java:224)
at org.knopflerfish.framework.Main.main(Main.java:156)
at org.freeplane.launcher.Launcher.run(Launcher.java:115)
at org.freeplane.launcher.Launcher.launch(Launcher.java:80)
at org.freeplane.launcher.Launcher.main(Launcher.java:67)
Error: Command "-istart org.freeplane.core" failed, Failed to read exports: java.io.FileNotFoundException: /home/felix/exports (No such file or directory)

Could you please help me find a solution or workaround?

[1] https://github.com/freeplane/freeplane

Many Thanks and Best Regards,
Felix

proguard does not support java 9

The current version used does not support java 9. Furthermore there does not seem to be a more recent version with support for java 9. This prevents building the compact version of KF with JDK9

Failure on starting KF with installed security manager in readonly mode

This is copied from sourceforge #186:

If I run knopflerfish with installed security manager with option org.knopflerfish.framework.readonly=true

  • without creating empty directories fwdir/perms and fwdir/condperm knopflerfisch fails with exception

java.lang.NullPointerException
at org.knopflerfish.framework.permissions.PermUtil.getSortedFiles(PermUtil.java:134)
at org.knopflerfish.framework.permissions.PermissionInfoStorage.load(PermissionInfoStorage.java:316)
at org.knopflerfish.framework.permissions.PermissionInfoStorage.(PermissionInfoStorage.java:94)
at org.knopflerfish.framework.permissions.PermissionsHandle.(PermissionsHandle.java:68)
at org.knopflerfish.framework.SecurePermissionOps.init(SecurePermissionOps.java:124)
at org.knopflerfish.framework.FrameworkContext.init(FrameworkContext.java:303)
at org.knopflerfish.framework.SystemBundle.doInit(SystemBundle.java:618)
at org.knopflerfish.framework.SystemBundle.init(SystemBundle.java:152)
at org.knopflerfish.framework.Main.assertFramework(Main.java:445)
at org.knopflerfish.framework.Main.handleArgs(Main.java:541)
at org.knopflerfish.framework.Main.start(Main.java:224)
at org.knopflerfish.framework.Main.main(Main.java:153)
at org.freeplane.launcher.Launcher.run(Launcher.java:90)
at org.freeplane.launcher.Launcher.launch(Launcher.java:56)
at org.freeplane.launcher.Launcher.main(Launcher.java:49)
because it wants to get (empty) list of files from directories which are not created.
There is a workaround to create the directories before the application run.
I think if were nice if Knopflerfish could accept the case of missing directories.

API question: HttpService registerServlet and registerResources enumeration

Dear all,
Is there a way to query the HttpService or registered servlets and/or resources. This can be useful in managing the HttpServlet and security assessment of the OSGi environment. Numerous bundles can register servlets, and it is difficult for an administrator of the OSGi environment to assess if a bundle is exposing servlets or not. Such an API enables extra inspection of of servelts exposing Web services.

SCR gets ConcurrentModificationException in service listener

DEBUG: errors - FrameworkErrorEvent bundle #85

DEBUG: errors - FrameworkErrorEvent throwable:

java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)
at java.util.HashMap$KeyIterator.next(HashMap.java:1466)
at org.knopflerfish.bundle.component.ComponentServiceListener.serviceChanged(ComponentServiceListener.java:70)
at org.knopflerfish.framework.Listeners.serviceChanged(Listeners.java:430)
at org.knopflerfish.framework.PermissionOps.callServiceChanged(PermissionOps.java:340)
at org.knopflerfish.framework.Services.register(Services.java:179)
at org.knopflerfish.framework.BundleContextImpl.registerService(BundleContextImpl.java:289)
at org.knopflerfish.framework.BundleContextImpl.registerService(BundleContextImpl.java:304)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.