You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by geelpheels <ge...@sina.com> on 2009/09/04 14:17:22 UTC

About additional libs

If I put some jar lib into classpath and start felix. Can the bundles use the
packages and classes defined in this jar lib?
-- 
View this message in context: http://www.nabble.com/About-additional-libs-tp25293354p25293354.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


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


Re: About additional libs

Posted by geelpheels <ge...@sina.com>.


Felix Meschberger-2 wrote:
> 
> Hi,
> 
> geelpheels schrieb:
>> If I put some jar lib into classpath and start felix. Can the bundles use
>> the
>> packages and classes defined in this jar lib?
> 
> No, not automatically. You have to list the package either as
> bootclasspath packages (in the org.osgi.framework.bootdelegation
> property) or as system packages (in the
> org.osgi.framework.system.packages).
> 
> What you choose is up to and depends on your use case. My preference is
> to use system packages since such packages become regular exports of the
> system bundle and content for package wiring like regular bundle exports.
> 
> Regards
> Felix
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 
> 

Thanks a lot!

-- 
View this message in context: http://www.nabble.com/About-additional-libs-tp25293354p25304780.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


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


Re: About additional libs

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 9/4/09 8:22, Felix Meschberger wrote:
> Hi,
>
> geelpheels schrieb:
>    
>> If I put some jar lib into classpath and start felix. Can the bundles use the
>> packages and classes defined in this jar lib?
>>      
> No, not automatically. You have to list the package either as
> bootclasspath packages (in the org.osgi.framework.bootdelegation
> property) or as system packages (in the org.osgi.framework.system.packages).
>
> What you choose is up to and depends on your use case. My preference is
> to use system packages since such packages become regular exports of the
> system bundle and content for package wiring like regular bundle exports.
>    

To state it more strongly, using boot class path delegation is typically 
seen as a bad practice since it hides bundle dependencies and makes them 
less reusable, which is why the system package approach is preferred.

-> richard

> Regards
> Felix
>
> ---------------------------------------------------------------------
> 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: About additional libs

Posted by geelpheels <ge...@sina.com>.


Richard S. Hall wrote:
> 
> The "-jar" option for the java command ignores the specified class path 
> and only uses the JAR file on the class path, so you need to do 
> something like:
> 
>      java -cp mylib;./bin/felix.jar org.apache.felix.main.Main
> 
> -> richard
> 
> On 9/4/09 13:18, geelpheels wrote:
>>
>>
>> Felix Meschberger-2 wrote:
>>    
>>> Hi,
>>>
>>> geelpheels schrieb:
>>>      
>>>> If I put some jar lib into classpath and start felix. Can the bundles
>>>> use
>>>> the
>>>> packages and classes defined in this jar lib?
>>>>        
>>> No, not automatically. You have to list the package either as
>>> bootclasspath packages (in the org.osgi.framework.bootdelegation
>>> property) or as system packages (in the
>>> org.osgi.framework.system.packages).
>>>
>>> What you choose is up to and depends on your use case. My preference is
>>> to use system packages since such packages become regular exports of the
>>> system bundle and content for package wiring like regular bundle
>>> exports.
>>>
>>> Regards
>>> Felix
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>
>>>      
>> OK. I've added my package name into the variable
>> org.osgi.framework.system.packages and then modified my importer bundle's
>> manifest file by adding Import-Package parameter.
>>
>> But it still report the Exception:org.osgi.framework.BundleException:
>> Activator start error in bundle com.kortide.
>> felix.fakeservice [5].
>>          at org.apache.felix.framework.Felix.startBundle(Felix.java:1506)
>>          at
>> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:774)
>>          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.j
>> ava:177)
>>          at java.lang.Thread.run(Thread.java:595)
>> Caused by: java.lang.NoClassDefFoundError: littlejarlib/TestLittleJarLib
>>          at
>> com.kortide.felix.fakeservice.Activator.start(Activator.java:13)
>>          at
>> org.apache.felix.framework.util.SecureAction.startActivator(SecureAct
>> ion.java:589)
>>          at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
>>          ... 5 more
>> java.lang.NoClassDefFoundError: littlejarlib/TestLittleJarLib
>>
>> my start command is :java -classpath
>> %JAVA_HOME%\lib\tools.jar;.\LittleJarLib.jar -jar bin\felix.jar
>>
>>    
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 
> 

Thanks a lot. It works!

-- 
View this message in context: http://www.nabble.com/About-additional-libs-tp25293354p25304837.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


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


Re: About additional libs

Posted by "Richard S. Hall" <he...@ungoverned.org>.
The "-jar" option for the java command ignores the specified class path 
and only uses the JAR file on the class path, so you need to do 
something like:

     java -cp mylib;./bin/felix.jar org.apache.felix.main.Main

-> richard

On 9/4/09 13:18, geelpheels wrote:
>
>
> Felix Meschberger-2 wrote:
>    
>> Hi,
>>
>> geelpheels schrieb:
>>      
>>> If I put some jar lib into classpath and start felix. Can the bundles use
>>> the
>>> packages and classes defined in this jar lib?
>>>        
>> No, not automatically. You have to list the package either as
>> bootclasspath packages (in the org.osgi.framework.bootdelegation
>> property) or as system packages (in the
>> org.osgi.framework.system.packages).
>>
>> What you choose is up to and depends on your use case. My preference is
>> to use system packages since such packages become regular exports of the
>> system bundle and content for package wiring like regular bundle exports.
>>
>> Regards
>> Felix
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>
>>      
> OK. I've added my package name into the variable
> org.osgi.framework.system.packages and then modified my importer bundle's
> manifest file by adding Import-Package parameter.
>
> But it still report the Exception:org.osgi.framework.BundleException:
> Activator start error in bundle com.kortide.
> felix.fakeservice [5].
>          at org.apache.felix.framework.Felix.startBundle(Felix.java:1506)
>          at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:774)
>          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.j
> ava:177)
>          at java.lang.Thread.run(Thread.java:595)
> Caused by: java.lang.NoClassDefFoundError: littlejarlib/TestLittleJarLib
>          at com.kortide.felix.fakeservice.Activator.start(Activator.java:13)
>          at
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAct
> ion.java:589)
>          at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
>          ... 5 more
> java.lang.NoClassDefFoundError: littlejarlib/TestLittleJarLib
>
> my start command is :java -classpath
> %JAVA_HOME%\lib\tools.jar;.\LittleJarLib.jar -jar bin\felix.jar
>
>    

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


Re: About additional libs

Posted by geelpheels <ge...@sina.com>.


Felix Meschberger-2 wrote:
> 
> Hi,
> 
> geelpheels schrieb:
>> If I put some jar lib into classpath and start felix. Can the bundles use
>> the
>> packages and classes defined in this jar lib?
> 
> No, not automatically. You have to list the package either as
> bootclasspath packages (in the org.osgi.framework.bootdelegation
> property) or as system packages (in the
> org.osgi.framework.system.packages).
> 
> What you choose is up to and depends on your use case. My preference is
> to use system packages since such packages become regular exports of the
> system bundle and content for package wiring like regular bundle exports.
> 
> Regards
> Felix
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 
> 

OK. I've added my package name into the variable
org.osgi.framework.system.packages and then modified my importer bundle's
manifest file by adding Import-Package parameter. 

But it still report the Exception:org.osgi.framework.BundleException:
Activator start error in bundle com.kortide.
felix.fakeservice [5].
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1506)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:774)
        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.j
ava:177)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NoClassDefFoundError: littlejarlib/TestLittleJarLib
        at com.kortide.felix.fakeservice.Activator.start(Activator.java:13)
        at
org.apache.felix.framework.util.SecureAction.startActivator(SecureAct
ion.java:589)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
        ... 5 more
java.lang.NoClassDefFoundError: littlejarlib/TestLittleJarLib

my start command is :java -classpath
%JAVA_HOME%\lib\tools.jar;.\LittleJarLib.jar -jar bin\felix.jar

-- 
View this message in context: http://www.nabble.com/About-additional-libs-tp25293354p25298440.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


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


Re: About additional libs

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

geelpheels schrieb:
> If I put some jar lib into classpath and start felix. Can the bundles use the
> packages and classes defined in this jar lib?

No, not automatically. You have to list the package either as
bootclasspath packages (in the org.osgi.framework.bootdelegation
property) or as system packages (in the org.osgi.framework.system.packages).

What you choose is up to and depends on your use case. My preference is
to use system packages since such packages become regular exports of the
system bundle and content for package wiring like regular bundle exports.

Regards
Felix

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