You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Mike Evans <mi...@rapid-mobile.com> on 2007/10/24 12:06:17 UTC
Problem using service binder with embedded felix
Hi All,
I have embedded Felix into Tomcat and I'm trying to start the service binder bundle so that it can discover and bind my bundles. When Felix tries to start the service binder I get the following NCDFE :
ERROR: Error starting file:bundle/servicebinder1.0.jar (org.osgi.framework.BundleException: Activator start error.)
java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.apache.felix.framework.searchpolicy.ContentClassLoader.findClass(ContentClassLoader.java:162)
...
I'm using the following code to start the service binder
// Create a case-insensitive configuration property map.
Map<String, String> configMap = new StringMap(false);
// Configure the Felix instance to be embedded in Tomcat.
configMap.put(FelixConstants.SERVICE_URLHANDLERS_PROP, "false");
configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
// Add core OSGi packages to be exported from the class path
// via the system bundle.
configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
"org.osgi.framework; version=1.3.0," +
"org.osgi.util.tracker; version=1.3.1," +
"org.osgi.service.packageadmin; version=1.2.0," +
"org.osgi.service.startlevel; version=1.0.0," +
"org.osgi.service.url; version=1.0.0" );
// Explicitly specify the directory to use for caching bundles.
configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "cache");
// Specify the auto start plugin
configMap.put(FelixConstants.AUTO_START_PROP +".1", "file:bundle/servicebinder1.0.jar");
What do I have to do to get the service binder working?
many thanks
Mike
--
Mike Evans
Rapid Mobile Ltd.
93 George St. Edinburgh EH2 3ES
Tel: +44 131 243 2502
--
Rapid Mobile Media Limited registered in Scotland No SC263541.
Registered for VAT number GB 852 9018 19.
Registered office 19A Canning Street, Edinburgh, EH3 8HE.
Contact number: +44(0)131 243 2502
For further information visit our website www.rapid-mobile.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Problem using service binder with embedded felix
Posted by "Richard S. Hall" <he...@ungoverned.org>.
Mike Evans wrote:
> Thanks for your response.
>
> I've added the the framework packages to the servicebinder jar and
> that fixes the error, thanks. I'm now getting a new error when the
> framework tries to load one of my bundles:
>
> ERROR: Error starting file:bundle/ContextualisationArchitecture.jar
> (org.osgi.framework.BundleException: Unresolved package in bundle 2:
> package;
> (&(package=org.ungoverned.gravity.servicebinder)(version>=1.1.0)))
> at org.apache.felix.framework.Felix._resolveBundle(Felix.java:1650)
> at org.apache.felix.framework.Felix._startBundle(Felix.java:1517)
> at org.apache.felix.framework.Felix.startBundle(Felix.java:1470)
> at
> org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1065)
> at
> org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258)
> at java.lang.Thread.run(Unknown Source)
>
> I've tried creating my bundle jar with the servicebinder.jar included
> at the root level and setting the Bundle-Classpath in the manifest to
> point to it, but this doesn't fix the issue. Do I have to unpack the
> servicebinder jar and include the packages in all of my bundles?
No, you don't. I am not sure what exactly is going on here, but it is
clear that your bundle cannot resolve because the package is not present
in Felix. Are you sure you didn't change the exports of Service Binder
when you modified the manifest? You really need to start there. Can you
load your bundles into Felix using its shell for testing purposes? If
so, load them and see if you can get them to resolve. Do a "headers
<bundle-id>" for the Service Binder bundle and see what it has for its
Export-Package header.
At worst, you can send me the bundle offlist to look at. Even though it
is no longer under active development, you should probably consider
using the Service Binder from the Felix trunk too.
> Also, I had to specify my bundle in the auto start properties of my
> framework - should the service binder not auto-discover my bundles, or
> have I misunderstood completely?
I am not sure I understand what you are talking about here. Service
Binder has nothing to do with auto-starting bundles.
-> richard
>
> thanks for your time
> Mike
>
>
> Richard S. Hall wrote:
>> Original versions of the Service Binder did not include
>> Import-Package statements for the org.osgi.framework packages in its
>> manifest (since this wasn't necessary under Oscar). So, check SB's
>> manifest and see if you need to add them, if so, extract, add, and
>> rearchive. Otherwise, build the SB in Felix' trunk.
>>
>> -> richard
>>
>> Mike Evans wrote:
>>> Hi All,
>>>
>>> I have embedded Felix into Tomcat and I'm trying to start the
>>> service binder bundle so that it can discover and bind my bundles.
>>> When Felix tries to start the service binder I get the following
>>> NCDFE :
>>>
>>> ERROR: Error starting file:bundle/servicebinder1.0.jar
>>> (org.osgi.framework.BundleException: Activator start error.)
>>> java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator
>>> at java.lang.ClassLoader.defineClass1(Native Method)
>>> at java.lang.ClassLoader.defineClass(Unknown Source)
>>> at
>>> org.apache.felix.framework.searchpolicy.ContentClassLoader.findClass(ContentClassLoader.java:162)
>>>
>>> ...
>>>
>>> I'm using the following code to start the service binder
>>>
>>> // Create a case-insensitive configuration property map.
>>> Map<String, String> configMap = new StringMap(false);
>>> // Configure the Felix instance to be embedded in Tomcat.
>>> configMap.put(FelixConstants.SERVICE_URLHANDLERS_PROP, "false");
>>> configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
>>> // Add core OSGi packages to be exported from the
>>> class path
>>> // via the system bundle.
>>> configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
>>> "org.osgi.framework; version=1.3.0," +
>>> "org.osgi.util.tracker; version=1.3.1," +
>>> "org.osgi.service.packageadmin; version=1.2.0," +
>>> "org.osgi.service.startlevel; version=1.0.0," +
>>> "org.osgi.service.url; version=1.0.0" );
>>> // Explicitly specify the directory to use for caching
>>> bundles.
>>> configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "cache");
>>> // Specify the auto start plugin
>>> configMap.put(FelixConstants.AUTO_START_PROP +".1",
>>> "file:bundle/servicebinder1.0.jar");
>>>
>>> What do I have to do to get the service binder working?
>>>
>>> many thanks
>>> Mike
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>> .
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Problem using service binder with embedded felix
Posted by Mike Evans <mi...@rapid-mobile.com>.
Thanks for your response.
I've added the the framework packages to the servicebinder jar and that fixes the error, thanks. I'm now getting a new error when the framework tries to load one of my bundles:
ERROR: Error starting file:bundle/ContextualisationArchitecture.jar (org.osgi.framework.BundleException: Unresolved package in bundle 2: package; (&(package=org.ungoverned.gravity.servicebinder)(version>=1.1.0)))
at org.apache.felix.framework.Felix._resolveBundle(Felix.java:1650)
at org.apache.felix.framework.Felix._startBundle(Felix.java:1517)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1470)
at org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1065)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:258)
at java.lang.Thread.run(Unknown Source)
I've tried creating my bundle jar with the servicebinder.jar included at the root level and setting the Bundle-Classpath in the manifest to point to it, but this doesn't fix the issue. Do I have to unpack the servicebinder jar and include the packages in all of my bundles?
Also, I had to specify my bundle in the auto start properties of my framework - should the service binder not auto-discover my bundles, or have I misunderstood completely?
thanks for your time
Mike
Richard S. Hall wrote:
> Original versions of the Service Binder did not include Import-Package
> statements for the org.osgi.framework packages in its manifest (since
> this wasn't necessary under Oscar). So, check SB's manifest and see if
> you need to add them, if so, extract, add, and rearchive. Otherwise,
> build the SB in Felix' trunk.
>
> -> richard
>
> Mike Evans wrote:
>> Hi All,
>>
>> I have embedded Felix into Tomcat and I'm trying to start the service
>> binder bundle so that it can discover and bind my bundles. When Felix
>> tries to start the service binder I get the following NCDFE :
>>
>> ERROR: Error starting file:bundle/servicebinder1.0.jar
>> (org.osgi.framework.BundleException: Activator start error.)
>> java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator
>> at java.lang.ClassLoader.defineClass1(Native Method)
>> at java.lang.ClassLoader.defineClass(Unknown Source)
>> at
>> org.apache.felix.framework.searchpolicy.ContentClassLoader.findClass(ContentClassLoader.java:162)
>>
>> ...
>>
>> I'm using the following code to start the service binder
>>
>> // Create a case-insensitive configuration property map.
>> Map<String, String> configMap = new StringMap(false);
>> // Configure the Felix instance to be embedded in Tomcat.
>> configMap.put(FelixConstants.SERVICE_URLHANDLERS_PROP, "false");
>> configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
>> // Add core OSGi packages to be exported from the class
>> path
>> // via the system bundle.
>> configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
>> "org.osgi.framework; version=1.3.0," +
>> "org.osgi.util.tracker; version=1.3.1," +
>> "org.osgi.service.packageadmin; version=1.2.0," +
>> "org.osgi.service.startlevel; version=1.0.0," +
>> "org.osgi.service.url; version=1.0.0" );
>> // Explicitly specify the directory to use for caching
>> bundles.
>> configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "cache");
>> // Specify the auto start plugin
>> configMap.put(FelixConstants.AUTO_START_PROP +".1",
>> "file:bundle/servicebinder1.0.jar");
>>
>> What do I have to do to get the service binder working?
>>
>> many thanks
>> Mike
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
> .
>
--
Mike Evans
Rapid Mobile Ltd.
93 George St. Edinburgh EH2 3ES
Tel: +44 131 243 2502
--
Rapid Mobile Media Limited registered in Scotland No SC263541.
Registered for VAT number GB 852 9018 19.
Registered office 19A Canning Street, Edinburgh, EH3 8HE.
Contact number: +44(0)131 243 2502
For further information visit our website www.rapid-mobile.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Problem using service binder with embedded felix
Posted by "Richard S. Hall" <he...@ungoverned.org>.
Original versions of the Service Binder did not include Import-Package
statements for the org.osgi.framework packages in its manifest (since
this wasn't necessary under Oscar). So, check SB's manifest and see if
you need to add them, if so, extract, add, and rearchive. Otherwise,
build the SB in Felix' trunk.
-> richard
Mike Evans wrote:
> Hi All,
>
> I have embedded Felix into Tomcat and I'm trying to start the service
> binder bundle so that it can discover and bind my bundles. When Felix
> tries to start the service binder I get the following NCDFE :
>
> ERROR: Error starting file:bundle/servicebinder1.0.jar
> (org.osgi.framework.BundleException: Activator start error.)
> java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(Unknown Source)
> at
> org.apache.felix.framework.searchpolicy.ContentClassLoader.findClass(ContentClassLoader.java:162)
>
> ...
>
> I'm using the following code to start the service binder
>
> // Create a case-insensitive configuration property map.
> Map<String, String> configMap = new StringMap(false);
> // Configure the Felix instance to be embedded in Tomcat.
> configMap.put(FelixConstants.SERVICE_URLHANDLERS_PROP, "false");
> configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
> // Add core OSGi packages to be exported from the class
> path
> // via the system bundle.
> configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
> "org.osgi.framework; version=1.3.0," +
> "org.osgi.util.tracker; version=1.3.1," +
> "org.osgi.service.packageadmin; version=1.2.0," +
> "org.osgi.service.startlevel; version=1.0.0," +
> "org.osgi.service.url; version=1.0.0" );
> // Explicitly specify the directory to use for caching
> bundles.
> configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "cache");
> // Specify the auto start plugin
> configMap.put(FelixConstants.AUTO_START_PROP +".1",
> "file:bundle/servicebinder1.0.jar");
>
> What do I have to do to get the service binder working?
>
> many thanks
> Mike
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org