You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Karl Pauls <ka...@gmail.com> on 2009/06/18 09:31:01 UTC

Re: Is it possible to share an object between the host application and an embedded felix instance?

Yes, have a look at:

http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html

regards,

Karl

On Thu, Jun 18, 2009 at 9:26 AM, Markus
Michel<ma...@uni-duesseldorf.de> wrote:
> Hi there!
>
> Inside my host application I tried implement a simple pushService, which
> shall be used to transfer an instance of a class named Vehicle to the OSGi
> world, by providing a set and get method. To be able to use the service I
> exported both the service interface and the Vehicle class to a jar file and
> imported that file within the bundle, which should use the service.
>
> Everytime I tried to use the Vehicle class within my host application, which
> instanciates the felix framework, and the bundle, I got a linkage error.
> After reading the following blog entry (
> http://frankkieviet.blogspot.com/2009/03/javalanglinkageerror-loader-constraint.html)
> I understood why this error occurs. But I have no clue how to solve my
> problem.
>
> Is in in general possible to share a class between the host application and
> an OSGi instance? If yes: Can somebody give me a short example?
>
> BR,
>
> Markus
>



-- 
Karl Pauls
karlpauls@gmail.com

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


Re: Is it possible to share an object between the host application and an embedded felix instance?

Posted by Markus Michel <ma...@uni-duesseldorf.de>.
Inside my host application I'm using felix 1.8.0.

BR,

Markus

2009/6/18 Karl Pauls <ka...@gmail.com>

> what version of felix are you using?
>
> regards,
>
> Karl
>
> On Thu, Jun 18, 2009 at 12:22 PM, Markus
> Michel<ma...@uni-duesseldorf.de> wrote:
> > I already used this tutorial to create my service. At the end of the
> > document I found a link to the library transloader, which should solve my
> > problem. But after trying out this
> > library I'm still getting nearly the same error message:
> >
> > org.osgi.framework.BundleException: Activator start error in bundle
> > OSGiVehicle [3].
> >    at org.apache.felix.framework.Felix.startBundle(Felix.java:1506)
> >    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:779)
> >    at
> >
> org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:105)
> >    at
> >
> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:291)
> >    at
> >
> org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:177)
> >    at java.lang.Thread.run(Thread.java:619)
> > Caused by: java.lang.LinkageError: loader constraint violation: loader
> > (instance of
> > org/apache/felix/framework/searchpolicy/ModuleImpl$ModuleClassLoader)
> > previously initiated loading for a different type with name
> > "canEmulator/SumoVehicle"
> >    at java.lang.ClassLoader.defineClass1(Native Method)
> >    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
> >    at
> >
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1556)
> >    at
> >
> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:562)
> >    at
> >
> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
> >    at
> >
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
> >    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> >    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> >    at java.lang.Class.forName0(Native Method)
> >    at java.lang.Class.forName(Class.java:247)
> >    at org.apache.commons.lang.ClassUtils.getClass(ClassUtils.java:545)
> >    at
> > com.googlecode.transloader.ClassWrapper.getClass(ClassWrapper.java:70)
> >    at
> >
> com.googlecode.transloader.clone.reflect.InnerNormalObjectCloner.instantiateClone(InnerNormalObjectCloner.java:16)
> >    at
> >
> com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.performIntendedCloning(ReflectionCloningStrategy.java:80)
> >    at
> >
> com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.clone(ReflectionCloningStrategy.java:69)
> >    at
> >
> com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.access$000(ReflectionCloningStrategy.java:15)
> >    at
> >
> com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy$1.traverse(ReflectionCloningStrategy.java:60)
> >    at
> >
> com.googlecode.transloader.clone.reflect.CyclicReferenceSafeTraverser.performWithoutFollowingCircles(CyclicReferenceSafeTraverser.java:32)
> >    at
> >
> com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.cloneObjectUsingClassLoader(ReflectionCloningStrategy.java:63)
> >    at
> > com.googlecode.transloader.ObjectWrapper.cloneWith(ObjectWrapper.java:91)
> >    at
> >
> osgiVehicle.VehiclePushServiceHandler.initialize(VehiclePushServiceHandler.java:55)
> >    at
> >
> osgiVehicle.VehiclePushServiceHandler.<init>(VehiclePushServiceHandler.java:29)
> >    at osgiVehicle.Activator.start(Activator.java:21)
> >    at
> >
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
> >    at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
> >    ... 5 more
> > java.lang.LinkageError: loader constraint violation: loader (instance of
> > org/apache/felix/framework/searchpolicy/ModuleImpl$ModuleClassLoader)
> > previously initiated loading for a different type with name
> > "canEmulator/SumoVehicle"
> >
> > 2009/6/18 Karl Pauls <ka...@gmail.com>
> >
> >> Yes, have a look at:
> >>
> >>
> >>
> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html
> >>
> >> regards,
> >>
> >> Karl
> >>
> >> On Thu, Jun 18, 2009 at 9:26 AM, Markus
> >> Michel<ma...@uni-duesseldorf.de> wrote:
> >> > Hi there!
> >> >
> >> > Inside my host application I tried implement a simple pushService,
> which
> >> > shall be used to transfer an instance of a class named Vehicle to the
> >> OSGi
> >> > world, by providing a set and get method. To be able to use the
> service I
> >> > exported both the service interface and the Vehicle class to a jar
> file
> >> and
> >> > imported that file within the bundle, which should use the service.
> >> >
> >> > Everytime I tried to use the Vehicle class within my host application,
> >> which
> >> > instanciates the felix framework, and the bundle, I got a linkage
> error.
> >> > After reading the following blog entry (
> >> >
> >>
> http://frankkieviet.blogspot.com/2009/03/javalanglinkageerror-loader-constraint.html
> >> )
> >> > I understood why this error occurs. But I have no clue how to solve my
> >> > problem.
> >> >
> >> > Is in in general possible to share a class between the host
> application
> >> and
> >> > an OSGi instance? If yes: Can somebody give me a short example?
> >> >
> >> > BR,
> >> >
> >> > Markus
> >> >
> >>
> >>
> >>
> >> --
> >> Karl Pauls
> >> karlpauls@gmail.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >>
> >>
> >
>
>
>
> --
> Karl Pauls
> karlpauls@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Is it possible to share an object between the host application and an embedded felix instance?

Posted by Karl Pauls <ka...@gmail.com>.
what version of felix are you using?

regards,

Karl

On Thu, Jun 18, 2009 at 12:22 PM, Markus
Michel<ma...@uni-duesseldorf.de> wrote:
> I already used this tutorial to create my service. At the end of the
> document I found a link to the library transloader, which should solve my
> problem. But after trying out this
> library I'm still getting nearly the same error message:
>
> org.osgi.framework.BundleException: Activator start error in bundle
> OSGiVehicle [3].
>    at org.apache.felix.framework.Felix.startBundle(Felix.java:1506)
>    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:779)
>    at
> org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:105)
>    at
> org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:291)
>    at
> org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:177)
>    at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.LinkageError: loader constraint violation: loader
> (instance of
> org/apache/felix/framework/searchpolicy/ModuleImpl$ModuleClassLoader)
> previously initiated loading for a different type with name
> "canEmulator/SumoVehicle"
>    at java.lang.ClassLoader.defineClass1(Native Method)
>    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>    at
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1556)
>    at
> org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:562)
>    at
> org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
>    at
> org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
>    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>    at java.lang.Class.forName0(Native Method)
>    at java.lang.Class.forName(Class.java:247)
>    at org.apache.commons.lang.ClassUtils.getClass(ClassUtils.java:545)
>    at
> com.googlecode.transloader.ClassWrapper.getClass(ClassWrapper.java:70)
>    at
> com.googlecode.transloader.clone.reflect.InnerNormalObjectCloner.instantiateClone(InnerNormalObjectCloner.java:16)
>    at
> com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.performIntendedCloning(ReflectionCloningStrategy.java:80)
>    at
> com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.clone(ReflectionCloningStrategy.java:69)
>    at
> com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.access$000(ReflectionCloningStrategy.java:15)
>    at
> com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy$1.traverse(ReflectionCloningStrategy.java:60)
>    at
> com.googlecode.transloader.clone.reflect.CyclicReferenceSafeTraverser.performWithoutFollowingCircles(CyclicReferenceSafeTraverser.java:32)
>    at
> com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.cloneObjectUsingClassLoader(ReflectionCloningStrategy.java:63)
>    at
> com.googlecode.transloader.ObjectWrapper.cloneWith(ObjectWrapper.java:91)
>    at
> osgiVehicle.VehiclePushServiceHandler.initialize(VehiclePushServiceHandler.java:55)
>    at
> osgiVehicle.VehiclePushServiceHandler.<init>(VehiclePushServiceHandler.java:29)
>    at osgiVehicle.Activator.start(Activator.java:21)
>    at
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
>    at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
>    ... 5 more
> java.lang.LinkageError: loader constraint violation: loader (instance of
> org/apache/felix/framework/searchpolicy/ModuleImpl$ModuleClassLoader)
> previously initiated loading for a different type with name
> "canEmulator/SumoVehicle"
>
> 2009/6/18 Karl Pauls <ka...@gmail.com>
>
>> Yes, have a look at:
>>
>>
>> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html
>>
>> regards,
>>
>> Karl
>>
>> On Thu, Jun 18, 2009 at 9:26 AM, Markus
>> Michel<ma...@uni-duesseldorf.de> wrote:
>> > Hi there!
>> >
>> > Inside my host application I tried implement a simple pushService, which
>> > shall be used to transfer an instance of a class named Vehicle to the
>> OSGi
>> > world, by providing a set and get method. To be able to use the service I
>> > exported both the service interface and the Vehicle class to a jar file
>> and
>> > imported that file within the bundle, which should use the service.
>> >
>> > Everytime I tried to use the Vehicle class within my host application,
>> which
>> > instanciates the felix framework, and the bundle, I got a linkage error.
>> > After reading the following blog entry (
>> >
>> http://frankkieviet.blogspot.com/2009/03/javalanglinkageerror-loader-constraint.html
>> )
>> > I understood why this error occurs. But I have no clue how to solve my
>> > problem.
>> >
>> > Is in in general possible to share a class between the host application
>> and
>> > an OSGi instance? If yes: Can somebody give me a short example?
>> >
>> > BR,
>> >
>> > Markus
>> >
>>
>>
>>
>> --
>> Karl Pauls
>> karlpauls@gmail.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>



-- 
Karl Pauls
karlpauls@gmail.com

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


Re: Is it possible to share an object between the host application and an embedded felix instance?

Posted by Markus Michel <ma...@uni-duesseldorf.de>.
I already used this tutorial to create my service. At the end of the
document I found a link to the library transloader, which should solve my
problem. But after trying out this
library I'm still getting nearly the same error message:

org.osgi.framework.BundleException: Activator start error in bundle
OSGiVehicle [3].
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1506)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:779)
    at
org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:105)
    at
org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:291)
    at
org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:177)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.LinkageError: loader constraint violation: loader
(instance of
org/apache/felix/framework/searchpolicy/ModuleImpl$ModuleClassLoader)
previously initiated loading for a different type with name
"canEmulator/SumoVehicle"
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1556)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:562)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)
    at
org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1446)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.apache.commons.lang.ClassUtils.getClass(ClassUtils.java:545)
    at
com.googlecode.transloader.ClassWrapper.getClass(ClassWrapper.java:70)
    at
com.googlecode.transloader.clone.reflect.InnerNormalObjectCloner.instantiateClone(InnerNormalObjectCloner.java:16)
    at
com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.performIntendedCloning(ReflectionCloningStrategy.java:80)
    at
com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.clone(ReflectionCloningStrategy.java:69)
    at
com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.access$000(ReflectionCloningStrategy.java:15)
    at
com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy$1.traverse(ReflectionCloningStrategy.java:60)
    at
com.googlecode.transloader.clone.reflect.CyclicReferenceSafeTraverser.performWithoutFollowingCircles(CyclicReferenceSafeTraverser.java:32)
    at
com.googlecode.transloader.clone.reflect.ReflectionCloningStrategy.cloneObjectUsingClassLoader(ReflectionCloningStrategy.java:63)
    at
com.googlecode.transloader.ObjectWrapper.cloneWith(ObjectWrapper.java:91)
    at
osgiVehicle.VehiclePushServiceHandler.initialize(VehiclePushServiceHandler.java:55)
    at
osgiVehicle.VehiclePushServiceHandler.<init>(VehiclePushServiceHandler.java:29)
    at osgiVehicle.Activator.start(Activator.java:21)
    at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
    ... 5 more
java.lang.LinkageError: loader constraint violation: loader (instance of
org/apache/felix/framework/searchpolicy/ModuleImpl$ModuleClassLoader)
previously initiated loading for a different type with name
"canEmulator/SumoVehicle"

2009/6/18 Karl Pauls <ka...@gmail.com>

> Yes, have a look at:
>
>
> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html
>
> regards,
>
> Karl
>
> On Thu, Jun 18, 2009 at 9:26 AM, Markus
> Michel<ma...@uni-duesseldorf.de> wrote:
> > Hi there!
> >
> > Inside my host application I tried implement a simple pushService, which
> > shall be used to transfer an instance of a class named Vehicle to the
> OSGi
> > world, by providing a set and get method. To be able to use the service I
> > exported both the service interface and the Vehicle class to a jar file
> and
> > imported that file within the bundle, which should use the service.
> >
> > Everytime I tried to use the Vehicle class within my host application,
> which
> > instanciates the felix framework, and the bundle, I got a linkage error.
> > After reading the following blog entry (
> >
> http://frankkieviet.blogspot.com/2009/03/javalanglinkageerror-loader-constraint.html
> )
> > I understood why this error occurs. But I have no clue how to solve my
> > problem.
> >
> > Is in in general possible to share a class between the host application
> and
> > an OSGi instance? If yes: Can somebody give me a short example?
> >
> > BR,
> >
> > Markus
> >
>
>
>
> --
> Karl Pauls
> karlpauls@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>