You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Achim Brandes <ac...@gmx.de> on 2007/09/27 16:46:27 UTC

bundle-classpath problem

Hello,

I think I hav a problem with the Bundle-Classpath. I want to import some 
jars inside the bundle-jarfile, so I used the Expression 
Bundle-Classpath: xy.jar. But by starting my app I get a 
FileNotFoundException, cause the Class (khs2010com.echoosgi.Main.class) 
implementing the BundleActivator doesn't get found. I think it's because 
of the classpath althoug the Main.class is inside the directory 
"khs2010com/echoosgi". The OSGi-R4 says that the classpath would be the 
bundles root directory, so I don't understand why the class doesn't get 
found. If I cancel the Bundle-Classpath expression it works, but missing 
the needed jars of cause.

Manifest-Version: 1.0
Bundle-SymbolicName: MA
Bundle-Description: A bundle that displays messages at startup and whe
n service events occur
Bundle-Name: Service listener example
Created-By: 1.5.0 (Sun Microsystems Inc.)
Bundle-Activator: khs2010com.echoosgi.main.MainActivator 
Bundle-Vendor: Apache Felix
Bundle-Version: 1.0.0
Bundle-Classpath: Echo2_App.jar, Echo2_Extras_App.jar, 
Echo2_Extras_WebContainer.jar, Echo2_WebRender.jar, Echo2_WebContainer.jar 
Import-Package: khs2010com.osgiifaces, org.osgi.framework, 
nextapp.echo2.app
Export-Package: khs2010com.osgiifaces, nextapp.echo2.app

I hope someone can help me with this simple problem.

Thanks
Achim

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


Re: bundle-classpath problem

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Well, if you are starting it via embedded execution, then you would 
definitely need to include "javax.naming" in the 
org.osgi.framework.system.packages property in the config map you give 
to Felix' constructor, because this property is only set if you are 
using the standard launcher.

-> richard

Achim Brandes wrote:
> I'm using JDK 1.5 and start felix with embedded execution. But the 
> problem with importing javax.naming has been solved without doing 
> something. :-D
> But thanks for the quick responses, that helps a lot.
>
> Achim
>
>
> ---------------------------------------------------------------------
> 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: bundle-classpath problem

Posted by Achim Brandes <ac...@gmx.de>.
I'm using JDK 1.5 and start felix with embedded execution. But the problem with importing javax.naming has been solved without doing something. :-D
But thanks for the quick responses, that helps a lot.

Achim


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


Re: bundle-classpath problem

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Achim Brandes wrote:
> I thought the standard java-packages are automatical avaible for the 
> bundles. But javax.naming can't be resolved.

Standard Java packages are not automatically available according to the 
spec, but Felix is configured to automatically export them for convenience.

Looking in the conf/config.properties file, it appears that javax.naming 
is available in there, so it looks like it should be exported for resolving.

-> richard

>
>
>
> ---------------------------------------------------------------------
> 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: bundle-classpath problem

Posted by Stuart McCulloch <st...@jayway.net>.
Hi Achim,

On 27/09/2007, Achim Brandes <ac...@gmx.de> wrote:
>
> I thought the standard java-packages are automatical avaible for the
> bundles. But javax.naming can't be resolved.


could you tell us what version of JDK and Felix you are using, and how are
you starting Felix?

also is there an import clause for javax.naming in your manifest?

finally, if you could provide the exception trace showing the resolve error,
that would be great

-- 
Cheers, Stuart

Re: bundle-classpath problem

Posted by Achim Brandes <ac...@gmx.de>.
I thought the standard java-packages are automatical avaible for the 
bundles. But javax.naming can't be resolved.



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


Re: bundle-classpath problem

Posted by Achim Brandes <ac...@gmx.de>.
Stuart McCulloch schrieb:
> the default Bundle-Classpath entry if not set in the manifest is . (ie. dot)
>
>
> looking at the manifest, you're setting it to:
>
>     Bundle-Classpath: Echo2_App.jar, Echo2_Extras_App.jar, \
>      Echo2_Extras_WebContainer.jar, Echo2_WebRender.jar, \
>      Echo2_WebContainer.jar
>
> without a dot, which means only classes inside the listed jars will be
> available
>
> if you have classes (non-jarred) inside your bundle then you need to add a
> dot entry:
>
>     Bundle-Classpath: ., Echo2_App.jar, Echo2_Extras_App.jar, \
>      Echo2_Extras_WebContainer.jar, Echo2_WebRender.jar, \
>      Echo2_WebContainer.jar
>
> BTW, if you have classes (non-jarred) whose packages are inside a sub-folder
> (such as org.foo.MyClass located at <bundle>/somedir/org/foo/MyClass)
>
>     Bundle-Classpath: ., somedir, Echo2_App.jar, Echo2_Extras_App.jar, \
>      Echo2_Extras_WebContainer.jar, Echo2_WebRender.jar, \
>      Echo2_WebContainer.jar
>
> just like how a normal java classpath works (except it uses commas)
>
>   
Thanks for the short description. Now it works fine.

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


Re: bundle-classpath problem

Posted by Stuart McCulloch <st...@jayway.net>.
On 27/09/2007, Achim Brandes <ac...@gmx.de> wrote:
>
> Hello,
>
> I think I hav a problem with the Bundle-Classpath. I want to import some
> jars inside the bundle-jarfile, so I used the Expression
> Bundle-Classpath: xy.jar. But by starting my app I get a
> FileNotFoundException, cause the Class (khs2010com.echoosgi.Main.class)
> implementing the BundleActivator doesn't get found. I think it's because
> of the classpath althoug the Main.class is inside the directory
> "khs2010com/echoosgi".


the default Bundle-Classpath entry if not set in the manifest is . (ie. dot)


looking at the manifest, you're setting it to:

    Bundle-Classpath: Echo2_App.jar, Echo2_Extras_App.jar, \
     Echo2_Extras_WebContainer.jar, Echo2_WebRender.jar, \
     Echo2_WebContainer.jar

without a dot, which means only classes inside the listed jars will be
available

if you have classes (non-jarred) inside your bundle then you need to add a
dot entry:

    Bundle-Classpath: ., Echo2_App.jar, Echo2_Extras_App.jar, \
     Echo2_Extras_WebContainer.jar, Echo2_WebRender.jar, \
     Echo2_WebContainer.jar

BTW, if you have classes (non-jarred) whose packages are inside a sub-folder
(such as org.foo.MyClass located at <bundle>/somedir/org/foo/MyClass)

    Bundle-Classpath: ., somedir, Echo2_App.jar, Echo2_Extras_App.jar, \
     Echo2_Extras_WebContainer.jar, Echo2_WebRender.jar, \
     Echo2_WebContainer.jar

just like how a normal java classpath works (except it uses commas)

The OSGi-R4 says that the classpath would be the
> bundles root directory, so I don't understand why the class doesn't get
> found. If I cancel the Bundle-Classpath expression it works, but missing
> the needed jars of cause.
>
> Manifest-Version: 1.0
> Bundle-SymbolicName: MA
> Bundle-Description: A bundle that displays messages at startup and whe
> n service events occur
> Bundle-Name: Service listener example
> Created-By: 1.5.0 (Sun Microsystems Inc.)
> Bundle-Activator: khs2010com.echoosgi.main.MainActivator
> Bundle-Vendor: Apache Felix
> Bundle-Version: 1.0.0
> Bundle-Classpath: Echo2_App.jar, Echo2_Extras_App.jar,
> Echo2_Extras_WebContainer.jar, Echo2_WebRender.jar, Echo2_WebContainer.jar
> Import-Package: khs2010com.osgiifaces, org.osgi.framework,
> nextapp.echo2.app
> Export-Package: khs2010com.osgiifaces, nextapp.echo2.app
>
> I hope someone can help me with this simple problem.
>
> Thanks
> Achim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers, Stuart