dev@glassfish.java.net

Re: Export-Package and the mandatory-directive

From: Sheetal Vartak <sheetal.vartak_at_oracle.com>
Date: Tue, 26 Oct 2010 13:24:44 -0700

Hi Richard,

On Oct 26, 2010, at 1:10 PM, Richard S. Hall wrote:

>
>
> On 10/26/10 16:00, Sheetal Vartak wrote:
>> Hi Richard,
>>
>> Thanks for your reply.
>>
>> Yes StateHolderSaver is a class. Even if I specify com.sun.faces.application.view.*, I see the same issue.
>
> You probably don't need the ".*" if its the only package.
>
> You need to have the metadata correct or else things won't work. If you specify com.sun.faces.application.view, then what is your Import-Package? Below it is using StateHolderSaver in the requirement, which wouldn't work. Both the import and the export should be com.sun.faces.application.view.

I had tried with com.sun.faces.application.view.* in both Export-Package and Import-Package.
>
>> One thing to note is that :
>> jsf-api.jar has only 1 class i.e. StateHolderSaver that belongs to the package com.sun.faces.application.view. Whereas the jsf-impl.jar also has the same package with a lot more classes but it needs to import com.sun.faces.application.view.StateHolderSaver from jsf-api.jar.
>
> That's not going to happen then. If you import a package, you cannot also have that package locally. Imported packages override local packages. You cannot do split packages with Import-Package/Export-Package. If you really need to do that, then you would have to use Require-Bundle.

Hmm. Looks like this is the issue. I'll look into using Require-Bundle.

Thanks
Sheetal

>
>> Now, the weld-integration.jar (from the GF module) imports com.sun.faces.api package. Yet it complains. That's what is confusing to me.
>
> It is complaining because because of the failure to resolve bundle 50; i.e., the failure to resolve bundle 20 is a byproduct of the failure to resolve 50.
>
> -> richard
>
>> Sheetal
>>
>> On Oct 26, 2010, at 12:43 PM, Richard S. Hall wrote:
>>
>>>
>>> On 10/26/10 13:57, Sheetal Vartak wrote:
>>>> Hi,
>>>>
>>>> I am trying to add the following constraint in the jsf-api.jar :
>>>>
>>>> Export-Package: javax.faces.*;version=2.0,\
>>>> com.sun.faces.application.view.StateHolderSaver;version=2.0;password="com.sun.faces.application.view";mandatory:=password
>>> Maybe the issue is more simple. Is StateHolderSaver a class or a package? You can't export classes.
>>>
>>> -> richard
>>>
>>>> My jsf-impl.jar has the following :
>>>>
>>>> Import-Package:
>>>> ......
>>>> com.sun.faces.application.view.StateHolderSaver;version=2.0;password="com.sun.faces.application.view", \
>>>> ......
>>>>
>>>> Now when I drop these 2 jars in the v3.1 workspace and try to start the server, I see the following error message in server.log :
>>>>
>>>> [#|2010-10-25T16:12:04.901-0700|SEVERE|glassfish3.1|null|_ThreadID=16;_ThreadName=Thread-1;|Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle org.glassfish.web.weld-integration [20]: Unable to resolve 20.0: missing requirement [20.0] package; (&(package=com.sun.faces.spi)(version>=2.0.0)) [caused by: Unable to resolve 50.0: missing requirement [50.0] package; (&(package=com.sun.faces.application.view.StateHolderSaver)(password=com.sun.faces.application.view)(version>=2.0.0))]|#]
>>>>
>>>> I checked the Manifest.MF of weld-integration.jar. It has an Import-Package attr specifying "com.sun.faces.spi" as one of them. As you can see above, the mandatory-directive is only for com.sun.faces.application.view.StateHolderSaver. Then what am I missing here?
>>>>
>>>> Does weld-integration.jar's Manifest.MF somehow need the mandatory-directive to be specified? And why?
>>>>
>>>> Thanks
>>>> Sheetal
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>