2009/5/21 Matej Pončák <[email protected]>

>
> Although there is some Errors, it seems to my service is running.
>
> I can run my jar file with command  "java -jar MIS.jar" successfuly.
> I expected that felix.jar doesn't change my enviroment settings
> (classpath). So, do I have to set all my env. (classpath) settings to
> java command? I expected that Felix appends their own settings, but not
> overwrite.
>

looking at your original manifest, it contains the following:

   Class-Path = lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
lib/felix.jar

which the java launcher uses to augment the classpath when running with the
"-jar" option
( in this case the referenced jars are under an external lib directory
alongside the MIS.jar )

when you run this jarfile as a bundle under Felix, this manifest entry is
ignored because it
doesn't make sense in an OSGi application - the framework effectively treats
your bundle
as a self-contained unit, and doesn't know about the external lib directory
alongside it.

this is why you need to manually add those jars to your Felix launch command
- of course
you could write a custom launcher that scans a bunch of bundles, extracts
any Class-Path
headers, and add them to the launch classpath

however, you might like to know that in OSGi R4 you can embed jars inside
your bundle
(ie. as entries in the jarfile, like in a WAR) and refer to them using the
Bundle-ClassPath
header, for example:

   Bundle-ClassPath: ., lib/appframework-1.0.3.jar, lib/swing-worker-1.1.jar

where the appframework and swing worker jarfiles are actually inside your
bundle - this
is useful as it means you can embed implementation jars and keep them
private from
other bundles without breaking them open and inlining the contents

of course the downside of embedded jars is that classic java tools like
javac, etc can't
handle them - which is why the old Class-Path header refers to external
directories :(

HTH

Thanks a lot for  yours help.
> Can you please help me with actual error?
> (org.osgi.framework.BundleException: R3 imports cannot contain directives.)
>

as Richard said if your manifest is as shown in the first email then it
could be a bug in Felix's R3 parser

could you open an issue on JIRA and attach your bundle? (or a testcase
bundle that recreates the error)

Matej
>

-- 
Cheers, Stuart

Reply via email to