Hi Jerome,
On 09/10/08 09:32 PM, Jerome Dochez wrote:
> This is all quite confusing but you need an OSGi import, not a java
> import...
> If you want to access a LogStrings.properties which does not reside in
> your bundle you need to follow the usual OSGi rules of import/export
> like for classes.
>
> so the bundle exporting the resource should have an export-package
> statement in your osgi.bundle file :
>
> like what you have
> -exportcontents: \
> com.sun.enterprise.glassfish.web, \
> +
> com.sun.logging.enterprise.system.container.web, \
>
OK
> but you need to import it as well in *all* the importing bundles,
> still in the osgi.bundle file (and not a java import like below)
>
> Import-Package: \
> +
> com.sun.logging.enterprise.system.container.web, \
>
> this should fix the problem.
Sounds good! I was relying on the java import to update the bundle's
MANIFEST.MF file
by adding the pkg to its Import-Package list. I thought this is what the
static analyzer would
do (and it seems to be doing this for all other packages!), but I found
this not to be working,
until I updated the MANIFEST.MF manually.
>
> I will try to implement this now...
>
OK, thanks!
Jan
> jerome
>
> On Sep 10, 2008, at 8:57 PM, Jan Luehe wrote:
>
>> Carla,
>>
>> On 09/10/08 07:55 PM, Carla Mott wrote:
>>>
>>>
>>> One issue I ran into was that I needed to import the package to the
>>> bundle that wanted to use it. Exporting is not enough.
>>>
>>> Jan,
>>>
>>> Are you saying that if you put LogStrings.properties in the web-util
>>> package it is not getting picked up?
>>
>> LogStrings.properties already resides in war-util (per your changes).
>> Right now, it is not getting picked up by any class in web-glue, unless
>> it is copied to web-glue.
>>
>>> If not there then are you importing it?
>>
>> No, I had not, but doing so does the trick.
>>
>> In summary, here's what I had to do:
>>
>> - Have war-util export "com.sun.logging.enterprise.system.container.web"
>> - Import "com.sun.logging.enterprise.system.container.web" in
>> PECoyoteConnector.java:
>>
>> Index: connector/coyote/PECoyoteConnector.java
>> ===================================================================
>> --- connector/coyote/PECoyoteConnector.java (revision 22541)
>> +++ connector/coyote/PECoyoteConnector.java (working copy)
>> @@ -51,6 +51,7 @@
>> import com.sun.enterprise.web.pwc.connector.coyote.PwcCoyoteRequest;
>> import com.sun.enterprise.web.connector.extension.GrizzlyConfig;
>> import com.sun.logging.LogDomains;
>> +import com.sun.logging.enterprise.system.container.web.*;
>> import java.io.BufferedInputStream;
>> import java.io.File;
>> import java.io.FileInputStream;
>>
>>
>> Also, when I first imported the above package to
>> PECoyoteConnector.java, it would not compile,
>> giving me this error:
>>
>> /space/luehe/ws/v3/web/web-glue/src/main/java/com/sun/enterprise/web/connector/coyote/PECoyoteConnector.java:54:
>> package com.sun.logging.enterprise.system.container.web does not exist
>> import com.sun.logging.enterprise.system.container.web.*;
>> ^
>> 1 error
>>
>>
>> I had to add a dummy class to
>> "com.sun.logging.enterprise.system.container.web" in war-util in
>> order to make the compilation error go away.
>>
>>
>> Jan
>>
>>>
>>> I will deploy an app and restart the server to see if the resource
>>> bundles are not getting picked up. I had not tried that but really
>>> was running the quicklook tests.
>>>
>>>
>>>
>>> Carla
>>>
>>>
>>> Marina Vatkina wrote:
>>>> We need a QL test that restarts the server between a deploy and run
>>>> at least for 1 test :(.
>>>>
>>>> Will it help to move the bundle to com.sun.enterprise.web? To
>>>> import the package explicitly?
>>>> Or move to some other package that web-util had been exported before?
>>>>
>>>> Or will there be another logger request from a class that is not in
>>>> com.sun.enterprise.web sub-package?
>>>>
>>>> thanks,
>>>> -marina
>>>>
>>>> Jan Luehe wrote:
>>>>> On 09/10/08 05:55 PM, Jan Luehe wrote:
>>>>>
>>>>>> Hi Carla,
>>>>>>
>>>>>> after adding com.sun.logging.enterprise.system.container.web
>>>>>> (which is the
>>>>>> package containing LogStrings.properties) to web/war-util's list
>>>>>> of exported
>>>>>> packages (as per the attached diffs), all is well. :)
>>>>>
>>>>>
>>>>> I spoke too early, I'm still seeing the failure.
>>>>>
>>>>> It can be reproduced as follows:
>>>>>
>>>>> - start the domain
>>>>> - deploy a war file
>>>>> - stop and restart the domain
>>>>>
>>>>> The restart will fail with this error:
>>>>>
>>>>> Caused by: java.util.MissingResourceException: Can't find bundle
>>>>> for base name
>>>>> com.sun.logging.enterprise.system.container.web.LogStrings, locale en
>>>>> at
>>>>> java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:836)
>>>>>
>>>>> at
>>>>> java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805)
>>>>> at java.util.ResourceBundle.getBundle(ResourceBundle.java:699)
>>>>> at
>>>>> com.sun.logging.LogDomains$1.getResourceBundle(LogDomains.java:260)
>>>>> at
>>>>> com.sun.enterprise.web.connector.coyote.PECoyoteConnector.<clinit>(PECoyoteConnector.java:88)
>>>>>
>>>>> ... 25 more
>>>>>
>>>>>
>>>>> If I copy the LogStrings.properties from web/war-util to
>>>>> web/web-glue, all is fine.
>>>>>
>>>>> So it seems the classloader for web/web-glue (which is responsible
>>>>> for loading PECoyoteConnector)
>>>>> does not have access to the LogStrings.properties in web/war-util.
>>>>>
>>>>> So I tried to have web/war-util export the package in which
>>>>> LogStrings.properties resides,
>>>>> but that does not seem to help.
>>>>>
>>>>>
>>>>> Jan
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>