You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <en...@gmail.com> on 2009/04/03 18:02:02 UTC

Re: Folder and ZIP format contributions containing nested application JARs

I have some concerns over the changes [1][2] to add nested jars onto the 
classpath of a jar contribution without consulting the manifest.

Jar is a standard packaging scheme [3] in java, we shouldn't try to invent a 
new classloading behavior. For jar, the Class-Path header in 
META-INF/MANIFEST.MF is used to extend the classpath.

Other standard archives such as JEE EAR/WAR or OSGi bundle 
(Bundle-ClassPath) defines how the nested jars are honored using additional 
manifest files or deployment descriptors. We should respect them.

There is no standard way to deal with zip in Java classloading. I'm fine 
with the default behavior to include all nested jars on the classpath. Maybe 
we should also require a manifest file in the zip to provide the inner jars 
to the classpath.

[1] http://svn.apache.org/viewvc?rev=761236&view=rev
[2] http://svn.apache.org/viewvc?rev=761611&view=rev
[3] http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html

Thanks,
Raymond

--------------------------------------------------
From: "ant elder" <an...@gmail.com>
Sent: Thursday, April 02, 2009 6:06 AM
To: <de...@tuscany.apache.org>
Subject: Re: Folder and ZIP format contributions containing nested 
application JARs

> On Thu, Apr 2, 2009 at 11:24 AM, ant elder <an...@gmail.com> wrote:
>> On Sat, Jan 24, 2009 at 10:10 AM, ant elder <an...@gmail.com> wrote:
>>> Yep, and we do already support zip contributions, this applies to folder
>>> contributions too. In both of those the code already finds various 
>>> artifacts
>>> within the contribution like wsdl or xsd files, i think its "just" a 
>>> matter
>>> of adding similar support to find the jar files and get them added to 
>>> the
>>> contribution classpath. I've raised TUSCANY-2786 to track this, seems 
>>> like
>>> there is consensus emerging that this would be a useful thing to do.
>>>
>>>    ...ant
>>
>> I was asked off list by a user about when we'd be supporting this,
>> I've asked them to post to the ML about it but in the meantime i had a
>> quick go at adding support for this in 2.x r761236. Its work in
>> progress and presently jars within zips get copied to temporary files
>> which doesn't seem ideal, but its enough to get the two itests for zip
>> and folder contributions running. Comments on better approaches
>> welcome.
>>
>>   ...ant
>>
>
> and if we're going to support zip contributions there are some other
> things that would be nice to do:
>
> - a maven plugin for creating zip contributions. You could do it with
> the maven assembly plugin but it would be nice to simplify that so you
> can do something like just have <packaging>sca-zip</packaging> in the
> pom.xml and perhaps a simple way to include/exclude dependency jars
> that get included in the zip.
>
> - an archetype to create sca zip contribution projects
>
> - update the webapp runtime so it can use jar and zip contributions as
> well as the existing way of having everything in web-inf/classes
>
>   ...ant 


Re: Folder and ZIP format contributions containing nested application JARs

Posted by Simon Laws <si...@googlemail.com>.
On Fri, Apr 17, 2009 at 4:50 PM, ant elder <an...@apache.org> wrote:
> On Fri, Apr 17, 2009 at 4:42 PM, Simon Laws <si...@googlemail.com> wrote:
>> On Fri, Apr 3, 2009 at 6:02 PM, ant elder <an...@apache.org> wrote:
>>> On Fri, Apr 3, 2009 at 5:50 PM, Raymond Feng <en...@gmail.com> wrote:
>>>> --------------------------------------------------
>>>> From: "ant elder" <an...@apache.org>
>>>> Sent: Friday, April 03, 2009 9:16 AM
>>>> To: <de...@tuscany.apache.org>
>>>> Subject: Re: Folder and ZIP format contributions containing nested
>>>> application JARs
>>>>
>>>> [[snip]]
>>>>>
>>>>> I'm not sure if you're objecting to supporting zip contributions with
>>>>> nested jars or that currently the change to do that doesn't
>>>>> discriminated between zip and jar contributions so its possible to
>>>>> nest jars in jars?
>>>>
>>>> I'm against adding nested jars to jar contributions. Zip contributions can
>>>> have its own classloading scheme.
>>>>
>>>
>>> Cool, me too. Like i said earlier this is work in progress and thats
>>> just a whole that needs to be plugged, i'll go prevent that from being
>>> possible.
>>>
>>>   ...ant
>>>
>>
>> Sorry, I overlooked this thread as I was out at the time. In summary
>> then are you saying your preference is the following....
>>
>> OK
>> -----
>>
>> mycontrib.ear
>>   myutil.jar
>>
>> mycontrib/
>>   myutil.jar
>>
>> Not OK
>> -----------
>>
>> mycontrib.jar
>>   myutil.jar
>>
>> Simon
>>
>
> Assuming you mean zip ("mycontrib.zip" not "mycontrib.ear") then yes,
> and thats what the code 1.x and 2.x support now.
>
>   ...ant
>

oops, ears on the brain. Yes I had intended "mycontrib.zip" not
"mycontrib.ear". Although mycontrib.ear as a contribution is also a
valid scenario so

OK
-----

mycontrib.ear
   myutil.jar

mycontrib.zip
   myutil.jar

mycontrib/
   myutil.jar

Not OK
-----------

mycontrib.jar
   myutil.jar

Seems ok to me.

Simon

Re: Folder and ZIP format contributions containing nested application JARs

Posted by ant elder <an...@apache.org>.
On Fri, Apr 17, 2009 at 4:42 PM, Simon Laws <si...@googlemail.com> wrote:
> On Fri, Apr 3, 2009 at 6:02 PM, ant elder <an...@apache.org> wrote:
>> On Fri, Apr 3, 2009 at 5:50 PM, Raymond Feng <en...@gmail.com> wrote:
>>> --------------------------------------------------
>>> From: "ant elder" <an...@apache.org>
>>> Sent: Friday, April 03, 2009 9:16 AM
>>> To: <de...@tuscany.apache.org>
>>> Subject: Re: Folder and ZIP format contributions containing nested
>>> application JARs
>>>
>>> [[snip]]
>>>>
>>>> I'm not sure if you're objecting to supporting zip contributions with
>>>> nested jars or that currently the change to do that doesn't
>>>> discriminated between zip and jar contributions so its possible to
>>>> nest jars in jars?
>>>
>>> I'm against adding nested jars to jar contributions. Zip contributions can
>>> have its own classloading scheme.
>>>
>>
>> Cool, me too. Like i said earlier this is work in progress and thats
>> just a whole that needs to be plugged, i'll go prevent that from being
>> possible.
>>
>>   ...ant
>>
>
> Sorry, I overlooked this thread as I was out at the time. In summary
> then are you saying your preference is the following....
>
> OK
> -----
>
> mycontrib.ear
>   myutil.jar
>
> mycontrib/
>   myutil.jar
>
> Not OK
> -----------
>
> mycontrib.jar
>   myutil.jar
>
> Simon
>

Assuming you mean zip ("mycontrib.zip" not "mycontrib.ear") then yes,
and thats what the code 1.x and 2.x support now.

   ...ant

Re: Folder and ZIP format contributions containing nested application JARs

Posted by Simon Laws <si...@googlemail.com>.
On Fri, Apr 3, 2009 at 6:02 PM, ant elder <an...@apache.org> wrote:
> On Fri, Apr 3, 2009 at 5:50 PM, Raymond Feng <en...@gmail.com> wrote:
>> --------------------------------------------------
>> From: "ant elder" <an...@apache.org>
>> Sent: Friday, April 03, 2009 9:16 AM
>> To: <de...@tuscany.apache.org>
>> Subject: Re: Folder and ZIP format contributions containing nested
>> application JARs
>>
>> [[snip]]
>>>
>>> I'm not sure if you're objecting to supporting zip contributions with
>>> nested jars or that currently the change to do that doesn't
>>> discriminated between zip and jar contributions so its possible to
>>> nest jars in jars?
>>
>> I'm against adding nested jars to jar contributions. Zip contributions can
>> have its own classloading scheme.
>>
>
> Cool, me too. Like i said earlier this is work in progress and thats
> just a whole that needs to be plugged, i'll go prevent that from being
> possible.
>
>   ...ant
>

Sorry, I overlooked this thread as I was out at the time. In summary
then are you saying your preference is the following....

OK
-----

mycontrib.ear
   myutil.jar

mycontrib/
   myutil.jar

Not OK
-----------

mycontrib.jar
   myutil.jar

Simon

Re: Folder and ZIP format contributions containing nested application JARs

Posted by ant elder <an...@apache.org>.
On Fri, Apr 3, 2009 at 5:50 PM, Raymond Feng <en...@gmail.com> wrote:
> --------------------------------------------------
> From: "ant elder" <an...@apache.org>
> Sent: Friday, April 03, 2009 9:16 AM
> To: <de...@tuscany.apache.org>
> Subject: Re: Folder and ZIP format contributions containing nested
> application JARs
>
> [[snip]]
>>
>> I'm not sure if you're objecting to supporting zip contributions with
>> nested jars or that currently the change to do that doesn't
>> discriminated between zip and jar contributions so its possible to
>> nest jars in jars?
>
> I'm against adding nested jars to jar contributions. Zip contributions can
> have its own classloading scheme.
>

Cool, me too. Like i said earlier this is work in progress and thats
just a whole that needs to be plugged, i'll go prevent that from being
possible.

   ...ant

Re: Folder and ZIP format contributions containing nested application JARs

Posted by Raymond Feng <en...@gmail.com>.
--------------------------------------------------
From: "ant elder" <an...@apache.org>
Sent: Friday, April 03, 2009 9:16 AM
To: <de...@tuscany.apache.org>
Subject: Re: Folder and ZIP format contributions containing nested 
application JARs

[[snip]]
> I'm not sure if you're objecting to supporting zip contributions with
> nested jars or that currently the change to do that doesn't
> discriminated between zip and jar contributions so its possible to
> nest jars in jars?

I'm against adding nested jars to jar contributions. Zip contributions can 
have its own classloading scheme.

>
> I don't think we should require a manifest in a zip contribution as
> the spec doesn't say thats required, i guess we could support an
> optional manifest to enable defining only a subset of the nested jars
> get used though it doesn't seem like a high priority to me.

We might need to bring this up to the SCA spec to get clarifications on how 
Zip should be handled.

>
>   ...ant 


Re: Folder and ZIP format contributions containing nested application JARs

Posted by ant elder <an...@apache.org>.
On Fri, Apr 3, 2009 at 5:02 PM, Raymond Feng <en...@gmail.com> wrote:
> I have some concerns over the changes [1][2] to add nested jars onto the
> classpath of a jar contribution without consulting the manifest.
>
> Jar is a standard packaging scheme [3] in java, we shouldn't try to invent a
> new classloading behavior. For jar, the Class-Path header in
> META-INF/MANIFEST.MF is used to extend the classpath.
>
> Other standard archives such as JEE EAR/WAR or OSGi bundle
> (Bundle-ClassPath) defines how the nested jars are honored using additional
> manifest files or deployment descriptors. We should respect them.
>
> There is no standard way to deal with zip in Java classloading. I'm fine
> with the default behavior to include all nested jars on the classpath. Maybe
> we should also require a manifest file in the zip to provide the inner jars
> to the classpath.
>

I'm not sure if you're objecting to supporting zip contributions with
nested jars or that currently the change to do that doesn't
discriminated between zip and jar contributions so its possible to
nest jars in jars?

I don't think we should require a manifest in a zip contribution as
the spec doesn't say thats required, i guess we could support an
optional manifest to enable defining only a subset of the nested jars
get used though it doesn't seem like a high priority to me.

   ...ant