You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "asaf.lahav" <as...@gmail.com> on 2007/04/10 11:27:10 UTC

Must a bundle be in a Jar file?

It would be easier to debug a bundle if it wouldn't be required to be closed
as a jar file.

Is it possible to create a bundle from class files that are not in a *.jar
file?

 

 

 


Re: Must a bundle be in a Jar file?

Posted by Felix Meschberger <Fe...@day.com>.
Hi,

Oops, you are right, there is support for the "reference:" location protocol
referring to a folder in Felix, so
bundleContext.install("reference:file:/path/to/dir")
should work.

Regards
Felix

On 4/10/07, BJ Hargrave <ha...@us.ibm.com> wrote:
>
> JAR file is the canonical form of a bundle. It can be in other forms if
> supported by the framework impl. As mentioned Equinox supports a
> reference: URL protocol which does not copy the bundle into the framework
> persistent store but refers to an external store which can be either a jar
> or a director which matches a jar structure. I am pretty sure that Felix
> also supports the reference protocol.
>
> IBM J9 vm also has a JXE format which is supported by Equinox.
>
> BJ Hargrave
> Senior Technical Staff Member, IBM
> OSGi Fellow and CTO of the OSGi Alliance
> hargrave@us.ibm.com
>
> office: +1 386 848 1781
> mobile: +1 386 848 3788
>
>

Re: Must a bundle be in a Jar file?

Posted by "Richard S. Hall" <he...@ungoverned.org>.
asaf.lahav wrote:
> FYI, Good news :)
>
>  
>
> I eventually figured out a way for Felix to load a bundle from a target
> Directory by using the following configuration property: 
>
> configMap.put("felix.auto.install.2","reference:file:c:/Development/OGSi/OSG
> iTestBundle");
>
> Apparently the 'reference:' prefix allows the bundle to be loaded from a
> directory rather than a JAR.
>   

Yes, this is the case. The exploded bundle directory should have the 
exact same structure of a bundle JAR file (i.e., like you just extracted 
the JAR file) and it will work fine.

The "reference:" protocol is not purely for directories, you can also 
point to a JAR file, in which case the JAR file will not be copied into 
the bundle cache.

-> richard

>  
>
>  
>
> -----Original Message-----
> From: fmeschbe@gmail.com [mailto:fmeschbe@gmail.com] On Behalf Of Felix
> Meschberger
> Sent: Tuesday, April 10, 2007 2:36 PM
> To: felix-dev@incubator.apache.org
> Subject: Re: Must a bundle be in a Jar file?
>
>  
>
> Hi,
>
>  
>
> To my knowledge, this is not supported in Felix.
>
>  
>
> BTW, the spec (page 27) says in section 3.2: "A bundle is deployed as
>
> a Java ARchive (JAR) file."
>
>  
>
> Doing single-class exchange is not a good thing any way IMHO, as this
>
> might violate the clearly defined lifecycle management of OSGi. In
>
> fact, using the maven-bundle-plugin of Felix makes the development
>
> cycle very easy: Change-Build-Update-Test.
>
>  
>
> Life class exchange is possible to some degree using a Java debugger,
>
> but this is for simple testing only and does not replace proper
>
> bundling and deployment according to the OSGi spec.
>
>  
>
> Regards
>
> Felix
>
>  
>
> On 4/10/07, asaf.lahav <as...@gmail.com> wrote:
>
>   
>> It would be easier to debug a bundle if it wouldn't be required to be
>>     
> closed
>
>   
>> as a jar file.
>>     
>
>   
>
>   
>> Is it possible to create a bundle from class files that are not in a *.jar
>>     
>
>   
>> file?
>>     
>
>   
>
>   
>
>   
>
>   
>
>   
>
>   
>
>   
>
>   
>
>
>   

RE: Must a bundle be in a Jar file?

Posted by "asaf.lahav" <as...@gmail.com>.
FYI, Good news :)

 

I eventually figured out a way for Felix to load a bundle from a target
Directory by using the following configuration property: 

configMap.put("felix.auto.install.2","reference:file:c:/Development/OGSi/OSG
iTestBundle");

Apparently the 'reference:' prefix allows the bundle to be loaded from a
directory rather than a JAR.

 

 

-----Original Message-----
From: fmeschbe@gmail.com [mailto:fmeschbe@gmail.com] On Behalf Of Felix
Meschberger
Sent: Tuesday, April 10, 2007 2:36 PM
To: felix-dev@incubator.apache.org
Subject: Re: Must a bundle be in a Jar file?

 

Hi,

 

To my knowledge, this is not supported in Felix.

 

BTW, the spec (page 27) says in section 3.2: "A bundle is deployed as

a Java ARchive (JAR) file."

 

Doing single-class exchange is not a good thing any way IMHO, as this

might violate the clearly defined lifecycle management of OSGi. In

fact, using the maven-bundle-plugin of Felix makes the development

cycle very easy: Change-Build-Update-Test.

 

Life class exchange is possible to some degree using a Java debugger,

but this is for simple testing only and does not replace proper

bundling and deployment according to the OSGi spec.

 

Regards

Felix

 

On 4/10/07, asaf.lahav <as...@gmail.com> wrote:

> It would be easier to debug a bundle if it wouldn't be required to be
closed

> as a jar file.

> 

> Is it possible to create a bundle from class files that are not in a *.jar

> file?

> 

> 

> 

> 

> 

> 

> 

> 


Re: Must a bundle be in a Jar file?

Posted by BJ Hargrave <ha...@us.ibm.com>.
JAR file is the canonical form of a bundle. It can be in other forms if 
supported by the framework impl. As mentioned Equinox supports a 
reference: URL protocol which does not copy the bundle into the framework 
persistent store but refers to an external store which can be either a jar 
or a director which matches a jar structure. I am pretty sure that Felix 
also supports the reference protocol.

IBM J9 vm also has a JXE format which is supported by Equinox.

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargrave@us.ibm.com

office: +1 386 848 1781
mobile: +1 386 848 3788


Re: Must a bundle be in a Jar file?

Posted by Felix Meschberger <Fe...@day.com>.
Hi,

To my knowledge, this is not supported in Felix.

BTW, the spec (page 27) says in section 3.2: "A bundle is deployed as
a Java ARchive (JAR) file."

Doing single-class exchange is not a good thing any way IMHO, as this
might violate the clearly defined lifecycle management of OSGi. In
fact, using the maven-bundle-plugin of Felix makes the development
cycle very easy: Change-Build-Update-Test.

Life class exchange is possible to some degree using a Java debugger,
but this is for simple testing only and does not replace proper
bundling and deployment according to the OSGi spec.

Regards
Felix

On 4/10/07, asaf.lahav <as...@gmail.com> wrote:
> It would be easier to debug a bundle if it wouldn't be required to be closed
> as a jar file.
>
> Is it possible to create a bundle from class files that are not in a *.jar
> file?
>
>
>
>
>
>
>
>

Re: Must a bundle be in a Jar file?

Posted by Peter Neubauer <pe...@jayway.se>.
Well,
I think I misunderstood your question - I was assuming you mean the
"inner" structure of a bundle, not the bundle format itself. I am not
sure if Felix supports bundles as directories, Equinox certainly does
via the reference:.... protocol when installing them.

Probably some Felix people can help you here.

/peter

On 4/10/07, asaf.lahav <as...@gmail.com> wrote:
> See:
>
> Class: org.apache.felix.framework.Felix
>
> function: createBundleInfo
>
>
>
> I went through the code and apparently the framework seeks the manifest file
> under META-INF/MANIFEST.MF inside a jar file.
>
> It actually fails because it eventually performs JarFile.getJarEntry("").
>
>
>
>
>
> -----Original Message-----
> From: neubauer.peter@gmail.com [mailto:neubauer.peter@gmail.com] On Behalf
> Of Peter Neubauer
> Sent: Tuesday, April 10, 2007 12:38 PM
> To: felix-dev@incubator.apache.org
> Subject: Re: Must a bundle be in a Jar file?
>
>
>
> Asaf,
>
> it is possible to have the classfiles just in a folder inside the
>
> bundle. in that case, just add an entry to that folder to the bundle
>
> classpath.
>
>
>
> structure:
>
>
>
> mybundle
>
>   META-INF
>
>       MANIFEST.MF
>
>   target
>
>      classes
>
>          test
>
>             MyClass.class
>
>
>
> Would require an entry like
>
>
>
> Bundle-ClassPath: target/classes
>
>
>
> In the MANIFEST.MF.
>
>
>
> /peter
>
>
>
> On 4/10/07, asaf.lahav <as...@gmail.com> wrote:
>
> > It would be easier to debug a bundle if it wouldn't be required to be
> closed
>
> > as a jar file.
>
> >
>
> > Is it possible to create a bundle from class files that are not in a *.jar
>
> > file?
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
>

RE: Must a bundle be in a Jar file?

Posted by "asaf.lahav" <as...@gmail.com>.
See: 

Class: org.apache.felix.framework.Felix 

function: createBundleInfo

 

I went through the code and apparently the framework seeks the manifest file
under META-INF/MANIFEST.MF inside a jar file.

It actually fails because it eventually performs JarFile.getJarEntry("").

 

 

-----Original Message-----
From: neubauer.peter@gmail.com [mailto:neubauer.peter@gmail.com] On Behalf
Of Peter Neubauer
Sent: Tuesday, April 10, 2007 12:38 PM
To: felix-dev@incubator.apache.org
Subject: Re: Must a bundle be in a Jar file?

 

Asaf,

it is possible to have the classfiles just in a folder inside the

bundle. in that case, just add an entry to that folder to the bundle

classpath.

 

structure:

 

mybundle

  META-INF

      MANIFEST.MF

  target

     classes

         test

            MyClass.class

 

Would require an entry like

 

Bundle-ClassPath: target/classes

 

In the MANIFEST.MF.

 

/peter

 

On 4/10/07, asaf.lahav <as...@gmail.com> wrote:

> It would be easier to debug a bundle if it wouldn't be required to be
closed

> as a jar file.

> 

> Is it possible to create a bundle from class files that are not in a *.jar

> file?

> 

> 

> 

> 

> 

> 

> 

> 


RE: Must a bundle be in a Jar file?

Posted by "asaf.lahav" <as...@gmail.com>.
Here is the exception stack trace I'm getting:

 

java.util.zip.ZipException: error in opening zip file

      at java.util.zip.ZipFile.open(Native Method)

      at java.util.zip.ZipFile.<init>(Unknown Source)

      at java.util.jar.JarFile.<init>(Unknown Source)

ERROR: Auto-properties install. (org.osgi.framework.BundleException: Unable
to cache bundle: file:c:/Development/OGSi/OSGiTestBundle)

      at java.util.jar.JarFile.<init>(Unknown Source)

      at org.apache.felix.moduleloader.JarFileX.<init>(JarFileX.java:36)

      at
org.apache.felix.framework.util.SecureAction.openJAR(SecureAction.java:435)

      at
org.apache.felix.framework.cache.JarRevision.getManifestHeader(JarRevision.j
ava:96)

      at
org.apache.felix.framework.cache.JarRevision.preprocessBundleJar(JarRevision
.java:353)

      at
org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:307
)

      at
org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:80)DEBU
G: WIRE: 1.0 -> org.osgi.service.packageadmin -> 0

DEBUG: WIRE: 1.0 -> org.osgi.service.startlevel -> 0

DEBUG: WIRE: 1.0 -> org.ungoverned.osgi.service.shell -> 1.0

DEBUG: WIRE: 1.0 -> org.osgi.framework -> 0

DEBUG: WIRE: 1.0 -> org.apache.felix.shell -> 1.0

DEBUG: WIRE: 2.0 -> org.osgi.framework -> 0

DEBUG: WIRE: 2.0 -> org.apache.felix.shell -> 1.0

done

-> 

      at
org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:58)

      at
org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(Bu
ndleArchive.java:1086)

      at
org.apache.felix.framework.cache.BundleArchive.revise(BundleArchive.java:708
)

      at
org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:148
)

      at
org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:149)

      at org.apache.felix.framework.Felix.installBundle(Felix.java:1770)

      at org.apache.felix.framework.Felix.installBundle(Felix.java:1730)

      at
org.apache.felix.framework.Felix.processAutoProperties(Felix.java:2938)

      at org.apache.felix.framework.Felix.start(Felix.java:471)

      at org.apache.felix.framework.Felix.start(Felix.java:205)

      at example.LaunchingTest.main(LaunchingTest.java:49)

 

-----Original Message-----
From: neubauer.peter@gmail.com [mailto:neubauer.peter@gmail.com] On Behalf
Of Peter Neubauer
Sent: Tuesday, April 10, 2007 12:38 PM
To: felix-dev@incubator.apache.org
Subject: Re: Must a bundle be in a Jar file?

 

Asaf,

it is possible to have the classfiles just in a folder inside the

bundle. in that case, just add an entry to that folder to the bundle

classpath.

 

structure:

 

mybundle

  META-INF

      MANIFEST.MF

  target

     classes

         test

            MyClass.class

 

Would require an entry like

 

Bundle-ClassPath: target/classes

 

In the MANIFEST.MF.

 

/peter

 

On 4/10/07, asaf.lahav <as...@gmail.com> wrote:

> It would be easier to debug a bundle if it wouldn't be required to be
closed

> as a jar file.

> 

> Is it possible to create a bundle from class files that are not in a *.jar

> file?

> 

> 

> 

> 

> 

> 

> 

> 


Re: Must a bundle be in a Jar file?

Posted by Peter Neubauer <pe...@jayway.se>.
Asaf,
it is possible to have the classfiles just in a folder inside the
bundle. in that case, just add an entry to that folder to the bundle
classpath.

structure:

mybundle
  META-INF
      MANIFEST.MF
  target
     classes
         test
            MyClass.class

Would require an entry like

Bundle-ClassPath: target/classes

In the MANIFEST.MF.

/peter

On 4/10/07, asaf.lahav <as...@gmail.com> wrote:
> It would be easier to debug a bundle if it wouldn't be required to be closed
> as a jar file.
>
> Is it possible to create a bundle from class files that are not in a *.jar
> file?
>
>
>
>
>
>
>
>