You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Eelco Meuter <ee...@wur.nl> on 2009/06/10 12:13:19 UTC

Re: Embedded Felix: Using a service provided by the host from a bundle

Does your 'Host Project'-jar include the felix.jar in it's classpath?

Eelco

On Jun 9, 2009, at 11:02 PM, Markus Michel wrote:

> Hi!
>
> No, I'm trying to export the Hello World bundle to a "deployable  
> plugin and
> fragments"-jar so that I'm able to use it within my OSGi  
> environment, which
> is controlled by the host project. Inside the Eclipse IDE there  
> aren't any
> errors, because the
> environment is able to resolve the classpath to interface within the  
> host
> project, which defines the service. The error occurs if I try to  
> export the
> Hello World bundle to a "deployable plugin and fragments". Currently I
> haven't
> a clue how to solve that problem. Maybe someone can give me a complete
> example?
>
> BR,
>
> Markus
>
> 2009/6/9 <em...@yahoo.com>
>
>>
>> Hi Markus,
>>
>> When you export the jar from Eclipse are you choosing to export a  
>> Java jar
>> file?  (as opposed to a Plugin Development Environment 'Deployable  
>> Plugin'
>> for example)
>>
>> If you have no compile errors in the Eclipse IDE then I don't see  
>> how you
>> would get any errors if you are exporting as a regular Java jar.
>> Check the 'Problems' view in Eclipse to make sure you have no compile
>> errors before doing the export.
>>
>>
>> --- On Tue, 6/9/09, Markus Michel <ne...@googlemail.com> wrote:
>>
>>> From: Markus Michel <ne...@googlemail.com>
>>> Subject: Embedded Felix: Using a service provided by the host from a
>> bundle
>>> To: users@felix.apache.org
>>> Date: Tuesday, June 9, 2009, 11:52 AM
>>> Hi there,
>>>
>>> after reading the wiki entry (
>>>
>> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html#ApacheFelixFrameworkLaunchingandEmbedding-hostservices
>> )
>>> I tried to integrate the presented example
>>> into my existing code. Within my Eclipse workspace I have
>>> the following
>>> projects:
>>>
>>> Host Project, which uses the functionality of the felix.jar
>>> to create an
>>> OSGi instance and implements the Lookup service
>>>
>>> Equinox Hello World bundle which tries to use the Lookup
>>> service (To get
>>> access to the service implementation I added the Host
>>> Project as an required
>>> project to the build path)
>>>
>>> If I try to export the bundle to a jar file I'm getting the
>>> following errors
>>> within a zipped log file:
>>>
>>> # 09.06.09 18:34:17 MESZ
>>> # Eclipse Java Compiler 0.894_R34x, 3.4.2 release,
>>> Copyright IBM Corp 2000,
>>> 2008. All rights reserved.
>>> ----------
>>> 1. ERROR in
>>>
>> /home/markus/master/michel/masterthesis/eclipseWorkspace/TestBundle/ 
>> src/bla/Activator.java
>>> (at line 13)
>>>    ServiceReference serviceReference =
>>> context.getServiceReference(CanEmulator.Lookup.class.getName());
>>>
>>> ^^^^^^^^^^^
>>> CanEmulator cannot be resolved to a type
>>> ----------
>>> 2. ERROR in
>>>
>> /home/markus/master/michel/masterthesis/eclipseWorkspace/TestBundle/ 
>> src/bla/Activator.java
>>> (at line 17)
>>>    CanEmulator.Lookup lookup =
>>> (CanEmulator.Lookup)
>>> context.getService(serviceReference);
>>>    ^^^^^^^^^^^
>>> CanEmulator cannot be resolved to a type
>>> ----------
>>> 3. ERROR in
>>>
>> /home/markus/master/michel/masterthesis/eclipseWorkspace/TestBundle/ 
>> src/bla/Activator.java
>>> (at line 17)
>>>    CanEmulator.Lookup lookup =
>>> (CanEmulator.Lookup)
>>> context.getService(serviceReference);
>>>
>>>
>>>   ^^^^^^^^^^^
>>> CanEmulator cannot be resolved
>>> ----------
>>> 3 problems (3 errors)
>>>
>>> It seems like the bundle doesn't find the referenced
>>> project. Does anybody
>>> has an idea how to solve my problem? Do I have to add
>>> something to the
>>> mainfest file? (I tried to add my project to the bundle
>>> import path, but I
>>> couldn't find it in the list, because the host project
>>> isn't a plugin
>>> project)
>>>
>>> BR,
>>>
>>> Markus
>>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>

Wageningen University
Plant Production Systems
P.O. Box 430
6700 AK WAGENINGEN
The Netherlands
http://www.pps.wur.nl






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Embedded Felix: Using a service provided by the host from a bundle

Posted by Markus Michel <ma...@uni-duesseldorf.de>.
Yes, it does. In contract to that the bundle uses the functionality of the
newest equinox implementation (org.eclipse.osgi_3.5.0.v20090520.jar) to be
able to use the Equinox interface within the IDE ...

2009/6/10 Eelco Meuter <ee...@wur.nl>

> Does your 'Host Project'-jar include the felix.jar in it's classpath?
>
> Eelco
>
>
> On Jun 9, 2009, at 11:02 PM, Markus Michel wrote:
>
>  Hi!
>>
>> No, I'm trying to export the Hello World bundle to a "deployable plugin
>> and
>> fragments"-jar so that I'm able to use it within my OSGi environment,
>> which
>> is controlled by the host project. Inside the Eclipse IDE there aren't any
>> errors, because the
>> environment is able to resolve the classpath to interface within the host
>> project, which defines the service. The error occurs if I try to export
>> the
>> Hello World bundle to a "deployable plugin and fragments". Currently I
>> haven't
>> a clue how to solve that problem. Maybe someone can give me a complete
>> example?
>>
>> BR,
>>
>> Markus
>>
>> 2009/6/9 <em...@yahoo.com>
>>
>>
>>> Hi Markus,
>>>
>>> When you export the jar from Eclipse are you choosing to export a Java
>>> jar
>>> file?  (as opposed to a Plugin Development Environment 'Deployable
>>> Plugin'
>>> for example)
>>>
>>> If you have no compile errors in the Eclipse IDE then I don't see how you
>>> would get any errors if you are exporting as a regular Java jar.
>>> Check the 'Problems' view in Eclipse to make sure you have no compile
>>> errors before doing the export.
>>>
>>>
>>> --- On Tue, 6/9/09, Markus Michel <ne...@googlemail.com> wrote:
>>>
>>>  From: Markus Michel <ne...@googlemail.com>
>>>> Subject: Embedded Felix: Using a service provided by the host from a
>>>>
>>> bundle
>>>
>>>> To: users@felix.apache.org
>>>> Date: Tuesday, June 9, 2009, 11:52 AM
>>>> Hi there,
>>>>
>>>> after reading the wiki entry (
>>>>
>>>>
>>> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html#ApacheFelixFrameworkLaunchingandEmbedding-hostservices
>>> )
>>>
>>>> I tried to integrate the presented example
>>>> into my existing code. Within my Eclipse workspace I have
>>>> the following
>>>> projects:
>>>>
>>>> Host Project, which uses the functionality of the felix.jar
>>>> to create an
>>>> OSGi instance and implements the Lookup service
>>>>
>>>> Equinox Hello World bundle which tries to use the Lookup
>>>> service (To get
>>>> access to the service implementation I added the Host
>>>> Project as an required
>>>> project to the build path)
>>>>
>>>> If I try to export the bundle to a jar file I'm getting the
>>>> following errors
>>>> within a zipped log file:
>>>>
>>>> # 09.06.09 18:34:17 MESZ
>>>> # Eclipse Java Compiler 0.894_R34x, 3.4.2 release,
>>>> Copyright IBM Corp 2000,
>>>> 2008. All rights reserved.
>>>> ----------
>>>> 1. ERROR in
>>>>
>>>> /home/markus/master/michel/masterthesis/eclipseWorkspace/TestBundle/src/bla/Activator.java
>>>
>>>> (at line 13)
>>>>   ServiceReference serviceReference =
>>>> context.getServiceReference(CanEmulator.Lookup.class.getName());
>>>>
>>>> ^^^^^^^^^^^
>>>> CanEmulator cannot be resolved to a type
>>>> ----------
>>>> 2. ERROR in
>>>>
>>>> /home/markus/master/michel/masterthesis/eclipseWorkspace/TestBundle/src/bla/Activator.java
>>>
>>>> (at line 17)
>>>>   CanEmulator.Lookup lookup =
>>>> (CanEmulator.Lookup)
>>>> context.getService(serviceReference);
>>>>   ^^^^^^^^^^^
>>>> CanEmulator cannot be resolved to a type
>>>> ----------
>>>> 3. ERROR in
>>>>
>>>> /home/markus/master/michel/masterthesis/eclipseWorkspace/TestBundle/src/bla/Activator.java
>>>
>>>> (at line 17)
>>>>   CanEmulator.Lookup lookup =
>>>> (CanEmulator.Lookup)
>>>> context.getService(serviceReference);
>>>>
>>>>
>>>>  ^^^^^^^^^^^
>>>> CanEmulator cannot be resolved
>>>> ----------
>>>> 3 problems (3 errors)
>>>>
>>>> It seems like the bundle doesn't find the referenced
>>>> project. Does anybody
>>>> has an idea how to solve my problem? Do I have to add
>>>> something to the
>>>> mainfest file? (I tried to add my project to the bundle
>>>> import path, but I
>>>> couldn't find it in the list, because the host project
>>>> isn't a plugin
>>>> project)
>>>>
>>>> BR,
>>>>
>>>> Markus
>>>>
>>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>
> Wageningen University
> Plant Production Systems
> P.O. Box 430
> 6700 AK WAGENINGEN
> The Netherlands
> http://www.pps.wur.nl
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Mit freundlichen Grüßen,

Markus Michel