List Info

Thread: Re: Question about adding a library to the project.




Re: Question about adding a library to the project.
user name
2008-05-15 12:09:37
I found the problem...I forgot a semicolon in the felix.client.run.properties file. It almost works now...I have another problem about the class loaders.
 
Here's what I did step by step:
I added the package org.apache.felix.bundlerepository to the property org.osgi.framework.system.packages. Then I imported both org.osgi.service.obr and org.apache.felix.bundlerepository packages in the pluginmanager's manifest file.
In the start method of the PluginManagerActivator, I added the following:

RepositoryAdminImpl rai =
new RepositoryAdminImpl(bc);
Resolver res = rai.resolver();
URL url =
null;
File f = new File("test.xml");
url = f.toURI().toURL();
rai.addRepository(url);
Repository [] repArray = rai.listRepositories();
System.
out.println(repArray[0].getURL().toString());
 
This will NOT work. I'm getting this error:
ERROR: Error starting reference:file:sc-bundles/pluginmanager.jar (org.osgi.framework.BundleException: Activator start error.)
java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/felix/framework/searchpolicy/ContentClassLoader) previously initiated loading for a different type with name "org/osgi/service/obr/Repository"
 
I can't call any methods of the class Repository, even though I can use their obj.
 
Replacing the last line with the following works:
System.out.println(((RepositoryImpl)repArray[0]).getURL().toString());
 
I also can't use RepositoryAdmin methods. I HAVE to use RepositoryAdminImpl. If I replace the first two lines of the code above with this:
RepositoryAdmin rai = new RepositoryAdminImpl(bc);
Resolver res =
rai.resolver();
I get this error:
ERROR: Error starting reference:file:sc-bundles/pluginmanager.jar (org.osgi.framework.BundleException: Activator start error.)java.lang.IncompatibleClassChangeError: Class org.apache.felix.bundlerepository.RepositoryAdminImpl does not implement the requested interface org.osgi.service.obr.RepositoryAdmin
 
I googled it and tried to find a solution, but I found nothing that could help me. I suppose you guys that have played with OSGi / SC for a while can help me with this issue.
 
Thanks again!
 
 
2008/5/14 Emil Ivov < emchosip-communicator.org">emchosip-communicator.org>:
Hey Mathieu,

This might be because the package is not on the classpath.

Every time you start SIP Communicator it dumps all its system properties
 to the log file and among them you have the system.class.path one. Have
a look there and check whether the bundlerepository jar is in it.

Hope this helps
Emil

Mathieu Plourde ΞΑΠΙΣΑ:
> Hello devs,
>
>   I'm playing around with SC and Apache Felix OSGi Bundle Repository. I
> noticed that the jar file for the bundle repository was already in the
> lib/bundle folder. I added it to the project to be able to use it. When
> I run SC, I get errors. It says the packages org.osgi.service.obr is not
> imported in the manifest. I then add it to the manifest file of the
> bundle. After that, I get an error for org.apache.felix.bundlerepository
> package stating that it's not imported by the bundle and that it's not
> exported by any other bundle. From there I'm unsure of what to do in
> order to solve the problem. The error "recommended&quot; me to add the
> package in the org.osgi.framework.system.packages property and import it
> in the bundle';s manifest. I did all that, but now I get the
> BundleException: Unresolved package in bundle 34: package;
&gt; (&(package=org.apache.felix.bundlerepository)(version>=0.0.0)))
>
> Anyone can help me with that?
>
> Thanks!


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribesip-communicator.dev.java.net">dev-unsubscribesip-communicator.dev.java.net
For additional commands, e-mail: dev-helpsip-communicator.dev.java.net">dev-helpsip-communicator.dev.java.net


Re: Question about adding a library to the project.
user name
2008-05-15 12:48:21
What is the setup here? Is the the OBR bundle being loaded
as a bundle 
or is it on the class path? If it is being loaded as a
bundle, then you 
shouldn't be putting anything on the system class path for
it.

-> richard

Mathieu Plourde wrote:
> I found the problem...I forgot a semicolon in the 
> felix.client.run.properties file. It almost works
now...I have another 
> problem about the class loaders.
>  
> Here's what I did step by step:
> I added the package org.apache.felix.bundlerepository
to the property 
> org.osgi.framework.system.packages. Then I imported
both 
> org.osgi.service.obr and
org.apache.felix.bundlerepository packages in 
> the pluginmanager's manifest file.
> In the start method of the PluginManagerActivator, I
added the following:
>
> RepositoryAdminImpl rai = *new*
RepositoryAdminImpl(bc);
> Resolver res = rai.resolver();
> URL url = *null*;
> File f = *new* File("test.xml");
> url = f.toURI().toURL();
> rai.addRepository(url);
> Repository [] repArray = rai.listRepositories();
> System./out/.println(repArray[0].getURL().toString());
>  
> This will NOT work. I'm getting this error:
> ERROR: Error starting
reference:file:sc-bundles/pluginmanager.jar 
> (org.osgi.framework.BundleException: Activator start
error.)
> java.lang.LinkageError: loader constraint violation:
loader (instance 
> of
org/apache/felix/framework/searchpolicy/ContentClassLoader)

> previously initiated loading for a different type with
name 
> "org/osgi/service/obr/Repository"
>  
> I can't call any methods of the class Repository, even
though I can 
> use their obj.
>  
> Replacing the last line with the following works:
>
System./out/.println(((RepositoryImpl)repArray[0]).getURL().
toString());
>  
> I also can't use RepositoryAdmin methods. I HAVE to use

> RepositoryAdminImpl. If I replace the first two lines
of the code 
> above with this:
> RepositoryAdmin rai = *new* RepositoryAdminImpl(bc);
> Resolver res = _rai_.resolver();
> I get this error:
> ERROR: Error starting
reference:file:sc-bundles/pluginmanager.jar 
> (_org.osgi.framework.BundleException_: Activator start

> error.)java.lang.IncompatibleClassChangeError: Class 
> org.apache.felix.bundlerepository.RepositoryAdminImpl
does not 
> implement the requested interface
org.osgi.service.obr.RepositoryAdmin
>  
> I googled it and tried to find a solution, but I found
nothing that 
> could help me. I suppose you guys that have played with
OSGi / SC for 
> a while can help me with this issue.
>  
> Thanks again!
>  
>  
> 2008/5/14 Emil Ivov <emchosip-communicator.org 
> <mailto:emchosip-communicator.org>>:
>
>     Hey Mathieu,
>
>     This might be because the package is not on the
classpath.
>
>     Every time you start SIP Communicator it dumps all
its system
>     properties
>      to the log file and among them you have the
system.class.path
>     one. Have
>     a look there and check whether the bundlerepository
jar is in it.
>
>     Hope this helps
>     Emil
>
>     Mathieu Plourde ΞΑΠΙΣΑ:
>     > Hello devs,
>     >
>     >   I'm playing around with SC and Apache Felix
OSGi Bundle
>     Repository. I
>     > noticed that the jar file for the bundle
repository was already
>     in the
>     > lib/bundle folder. I added it to the project
to be able to use
>     it. When
>     > I run SC, I get errors. It says the packages
>     org.osgi.service.obr is not
>     > imported in the manifest. I then add it to the
manifest file of the
>     > bundle. After that, I get an error for
>     org.apache.felix.bundlerepository
>     > package stating that it's not imported by the
bundle and that
>     it's not
>     > exported by any other bundle. From there I'm
unsure of what to do in
>     > order to solve the problem. The error
"recommended" me to add the
>     > package in the
org.osgi.framework.system.packages property and
>     import it
>     > in the bundle's manifest. I did all that, but
now I get the
>     > BundleException: Unresolved package in bundle
34: package;
>     >
(&(package=org.apache.felix.bundlerepository)(version>
;=0.0.0)))
>     >
>     > Anyone can help me with that?
>     >
>     > Thanks!
>
>
>    
------------------------------------------------------------
---------
>     To unsubscribe, e-mail:
>     dev-unsubscribesip-communicator.dev.java.net
>     <mailto:dev-unsubscribesip-communicator.dev.java.net>
>     For additional commands, e-mail:
>     dev-helpsip-communicator.dev.java.net
>     <mailto:dev-helpsip-communicator.dev.java.net>
>
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesip-communicator.dev.java.net
For additional commands, e-mail: dev-helpsip-communicator.dev.java.net


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )