3

I'm migrating to bndtools some osgi plugins that I had created and were working in the standard Eclipse environment. I've added the Felix Web Console, and Jetty HTTP Service, and swapped out some Equinox bundles with Felix equivalents.

When I run one particular bundle that requires org.restlet.jar, the bundle resolves but won't activate. And the console output is:

____________________________ Welcome to Apache Felix Gogo

g! 2015-05-25 00:06:33.471:INFO:oejs.Server:jetty-7.x.y-SNAPSHOT 2015-05-25 00:06:33.545:INFO:oejsh.ContextHandler:started o.e.j.s.ServletContextHandler{/,null} 2015-05-25 00:06:33.620:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080 ! Failed to start bundle org.restlet-2.3.2.v20150501-1520, exception activator error com/sun/net/httpserver/HttpHandler from: org.restlet.engine.Engine:registerDefaultConnectors#839

I've tried solutions based on other questions, namely this one which recommends setting the run property org.osgi.framework.system.packages.extra = com.sun.net.httpserver (presumably in my bndtools .bnd file), and another one which suggests activating the Restlet application using a framework listener -- but these did not work for me, and console output was the same.

I'm still learning, and I would appreciate any help leading toward a solution, or tips on any methods or features that bndtools or Eclipse might offer to help me trace this to its cause.

Incidentally, Felix Web Console is working, as a required bundle for this same plugin.

Here is my bndtools configuration:

Bundle-Version: 0.0.0.${tstamp}
Service-Component:  \
    *
-runfw: org.apache.felix.framework;version='[4,5)'
-runee: JavaSE-1.7
-runsystemcapabilities: ${native_capability}

-resolve.effective: active;skip:="osgi.service"


-buildpath:  \
    osgi.core,\
    osgi.cmpn,\
    biz.aQute.bnd.annotation,\
    org.apache.felix.log,\
    com.fiscio.api;version=latest,\
    osgi.enterprise,\
    org.restlet,\
    org.restlet.ext.json,\
    org.json

-runbundles:  \
    com.fiscio.api;version=latest,\
    org.apache.felix.configadmin;version='[1.8.0,1.8.1)',\
    org.apache.felix.gogo.command;version='[0.14.0,0.14.1)',\
    org.apache.felix.gogo.runtime;version='[0.16.2,0.16.3)',\
    org.apache.felix.gogo.shell;version='[0.10.0,0.10.1)',\
    org.apache.felix.http.jetty;version='[2.2.2,2.2.3)',\
    org.apache.felix.log;version='[1.0.1,1.0.2)',\
    org.apache.felix.metatype;version='[1.0.10,1.0.11)',\
    org.apache.felix.scr;version='[1.8.2,1.8.3)',\
    org.apache.felix.webconsole;version='[4.2.2,4.2.3)',\
    org.json;version='[1.0.0,1.0.1)',\
    org.restlet;version='[2.3.2,2.3.3)',\
    org.restlet.ext.json;version='[2.3.2,2.3.3)',\
    osgi.cmpn;version='[5.0.0,5.0.1)',\
    osgi.enterprise;version='[4.2.0,4.2.1)'

-runrequires:  \
    osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.webconsole)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.configadmin)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.metatype)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.log)',\
    osgi.identity;filter:='(&(osgi.identity=osgi.cmpn)(version>=4.2))',\
    osgi.identity;filter:='(&(osgi.identity=org.apache.felix.scr)(version>=1.6.0))',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.http.jetty)',\
    osgi.identity;filter:='(osgi.identity=com.fiscio.api)',\
    osgi.identity;filter:='(osgi.identity=org.json)',\
    osgi.identity;filter:='(osgi.identity=org.restlet.ext.json)',\
    osgi.identity;filter:='(osgi.identity=org.restlet)'

## Uncomment if you need to change the HTTP port
-runproperties: org.osgi.framework.system.packages.extra = com.sun.net.httpserver

Private-Package:  \
    com.fiscio.rest,\
    com.fiscio.rest.resources
Community
  • 1
  • 1

1 Answers1

4

Turns out that the other answers given to this issue on stackoverflow.com such as this one were correct, except that setting -runproperties: org.osgi.framework.system.packages.extra = com.sun.net.httpserver did not achieve the desired result in the bndtools launch configuration. The bndtools FAQ suggests the following, which solved my problem:

Note that using the -runsystempackages instruction is equivalent to setting the OSGi property org.osgi.framework.system.packages.extra; however it is better to use -runsystempackages because then the Run Requirements resolver inside Bndtools will take account of the availability of those packages during resolution.

Community
  • 1
  • 1