[seam-dev] Issue resolved with JBoss AS 7 CR1 and Seam Social

Antoine Sabot-Durand antoine at sabot-durand.net
Tue Jul 5 05:56:39 EDT 2011


For people that missed the beginning of the thread, in my case I need beans.xml in /WEB-INF and /WEB-INF/classes/META-INF. The first (with content) to be picked up by Seam Config, the second (empty) to expose beans to the web app. My expectation is to only need one of those.

Antoine

Le 5 juil. 2011 à 11:01, Mark Struberg a écrit :

> Hi Jaikiran!
> 
> Yup it could be more clear ;)
> 
> To add another pro argument: 
> java.util.ServiceLoader does pickup stuff from WEB-INF/classes/META-INF/services too if this is an indicator ;)
> 
> LieGrue,
> strub
> 
> --- On Tue, 7/5/11, Jaikiran Pai <jpai at redhat.com> wrote:
> 
>> From: Jaikiran Pai <jpai at redhat.com>
>> Subject: Re: [seam-dev] Issue resolved with JBoss AS 7 CR1 and Seam Social
>> To: "Mark Struberg" <struberg at yahoo.de>
>> Cc: seam-dev at lists.jboss.org
>> Date: Tuesday, July 5, 2011, 8:34 AM
>> On Tuesday 05 July 2011 01:18 PM,
>> Mark Struberg wrote:
>>> JSR-299 section 12.1
>>> 
>>>> A directory in the JVM classpath is a bean archive
>> if it has a
>>>> file named beans.xml in the META-INF directory.
>>> 
>>> And since WEB-INF/classes of a WAR is a JVM classpath
>> directory...
>> The CDI spec in that section also has:
>> 
>> - The WEB-INF/classes directory of a war is a bean archive
>> if there is a 
>> file named beans.xml in the WEB-INF directory of the war.
>> 
>> So I'm not too sure if the spec meant to allow the
>> beans.xml in 2 places 
>> (WEB-INF/classes and WEB-INF/classes/META-INF) within the
>> .war. Infact, 
>> my understanding of "JVM classpath" is the classpath set
>> via the 
>> -classpath argument to the java command. However, I'm not
>> too sure what 
>> the CDI spec really intended it to be (maybe needs a
>> clarification in 
>> 1.1?). If it really means that WEB-INF/classes/META-INF is
>> valid for the 
>> beans.xml then we need to take that into account in AS7.
>> 
>> -Jaikiran
>> 
>>> 
>>> LieGrue,
>>> strub
>>> 
>>> 
>>> --- On Tue, 7/5/11, Jaikiran Pai<jpai at redhat.com> 
>> wrote:
>>> 
>>>> From: Jaikiran Pai<jpai at redhat.com>
>>>> Subject: Re: [seam-dev] Issue resolved with JBoss
>> AS 7 CR1 and Seam Social
>>>> To: "Mark Struberg"<struberg at yahoo.de>
>>>> Cc: seam-dev at lists.jboss.org
>>>> Date: Tuesday, July 5, 2011, 7:39 AM
>>>> On Tuesday 05 July 2011 01:04 PM,
>>>> Mark Struberg wrote:
>>>>> Jaikiran, _why_ should
>> WEB-INF/classes/META-INF be an
>>>> invalid directory?
>>>>> 
>>>>> WEB-INF/classes is definitely a valid class
>> filepath.
>>>> Thus a META-INF inside is valid. This works in
>> every spec
>>>> and on every EE server I know.
>>>> Except for the JPA spec, none of the other specs
>> mention
>>>> that as a
>>>> metadata location. May be I'm missing some spec?
>> Which
>>>> other spec uses
>>>> this location? I agree that WEB-INF/classes is a
>> valid
>>>> class filepath,
>>>> but that doesn't mean that META-INF inside it
>> should be
>>>> valid, does it?
>>>> 
>>>> -Jaikiran
>>>>> 
>>>>> LieGrue,
>>>>> strub
>>>>> 
>>>>> --- On Tue, 7/5/11, Jaikiran Pai<jpai at redhat.com>
>>>> wrote:
>>>>> 
>>>>>> From: Jaikiran Pai<jpai at redhat.com>
>>>>>> Subject: Re: [seam-dev] Issue resolved
>> with JBoss
>>>> AS 7 CR1 and Seam Social
>>>>>> To: seam-dev at lists.jboss.org
>>>>>> Date: Tuesday, July 5, 2011, 5:23 AM
>>>>>> Indeed, WEB-INF/classes/META-INF is
>>>>>> *not* a valid location for metadata
>>>>>> files like this one.
>> WEB-INF/classes/META-INF is
>>>> meant only
>>>>>> for
>>>>>> persistence.xml (for some reason the JPA
>> spec
>>>> mandated this
>>>>>> location).
>>>>>> The right place for the metadata file is
>>>> .war/META-INF. AS7
>>>>>> infact logs
>>>>>> a WARN message if it sees any file other
>> than
>>>>>> persistence.xml in the
>>>>>> WEB-INF/classes/META-INF folder. I guess
>> you are
>>>> seeing
>>>>>> that WARN in the
>>>>>> logs/console, aren't you?
>>>>>> 
>>>>>> -Jaikiran
>>>>>> On Tuesday 05 July 2011 01:21 AM, Pete
>> Muir
>>>> wrote:
>>>>>>> I would somewhat expect this -
>>>>>> WEB-INF/classes/META-INF is not a valid
>> location
>>>> for
>>>>>> beans.xml to activate CDI services for a
>> war - AS6
>>>> used to
>>>>>> do it as a spec extension. Now, why the
>> libraries
>>>> are
>>>>>> activated for the war, but the actual war
>> isn't on
>>>> AS7 is
>>>>>> quite weird, and one for Stuart to take a
>> look
>>>> at.
>>>>>>> 
>>>>>>> On 4 Jul 2011, at 20:32, Antoine
>> Sabot-Durand
>>>> wrote:
>>>>>>> 
>>>>>>>> In /WEB-INF/classes/META-INF
>>>>>>>> 
>>>>>>>> Antoine
>>>>>>>> 
>>>>>>>> Le 4 juil. 2011 à 20:57, Pete
>> Muir a
>>>> écrit :
>>>>>>>> 
>>>>>>>>> Sounds odd - in this case
>> where
>>>> exactly in
>>>>>> beans.xml? /META-INF or
>>>> /WEB-INF/classes/META-INF?
>>>>>>>>> 
>>>>>>>>> But Stuart will know the exact
>> problem
>>>> ;-)
>>>>>>>>> 
>>>>>>>>> On 4 Jul 2011, at 19:51,
>> Antoine
>>>> Sabot-Durand
>>>>>> wrote:
>>>>>>>>> 
>>>>>>>>>> I understand, but my
>> question was
>>>> : is it
>>>>>> normal when beans.xml is in META-INF that
>> CDI
>>>> beans are
>>>>>> instantiated (i.e. I see Seam Config and
>> Seam
>>>> Social
>>>>>> Extensions log messages) but that those
>> Beans are
>>>> not
>>>>>> available for JSF views. It looks like a
>> bug for
>>>> me....
>>>>>> Should I use seam-beans.xml instead ?
>>>>>>>>>> 
>>>>>>>>>> Antoine
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Le 4 juil. 2011 à 20:30,
>> Pete
>>>> Muir a
>>>>>> écrit :
>>>>>>>>>> 
>>>>>>>>>>> I believe Stuart
>> intended to
>>>> make it
>>>>>> work in WEB-INF, but there are a lot of
>> issues
>>>> with loading
>>>>>> it from there, largely because there is
>> no
>>>> guarantee that
>>>>>> the Servlet container has started when
>> Seam Config
>>>> is
>>>>>> started. And Java EE itself offers to API
>> to read
>>>> from the
>>>>>> web root.
>>>>>>>>>>> 
>>>>>>>>>>> This is resolved in
>> CDI 1.1 as
>>>> we
>>>>>> offer the ability to read the .xml files
>> as an
>>>> InputStream
>>>>>> using the ProcessModule event on startup.
>>>>>>>>>>> 
>>>>>>>>>>> On 4 Jul 2011, at
>> 18:21, Jason
>>>> Porter
>>>>>> wrote:
>>>>>>>>>>> 
>>>>>>>>>>>> The suggested file
>> is
>>>>>> sem-beans.XML in the place you put it, but
>> in
>>>> short, yes, I
>>>>>> believe this is expected.
>>>>>>>>>>>> 
>>>>>>>>>>>> Sent from my
>> iPhone
>>>>>>>>>>>> 
>>>>>>>>>>>> On Jul 4, 2011, at
>> 8:20,
>>>> Antoine
>>>>>> Sabot-Durand<antoine at sabot-durand.net>
>>>> 
>>>>>> wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Just to let
>> you know I
>>>> managed
>>>>>> to run social Web App example with Jboss
>> 7-CR1.
>>>> The trick
>>>>>> was to have 2 beans.xml file. One in
>> META-INF for
>>>>>> Seam-Config to read beans configuration
>> and one in
>>>> WEB-INF
>>>>>> in order to having the server exposing CDI
>> bean
>>>> for JSF
>>>>>> view. I drop the Seam-Faces and its
>> dependency
>>>>>> Seam-International since I don't need them
>> and
>>>> they cashed
>>>>>> the deployment.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> If I put
>> config info
>>>> in
>>>>>> WEB-INF/beans.xml, Seam-Config doesn't
>> read them
>>>> and if I
>>>>>> don't put beans.xml in WEB-INF my JSF
>> views don't
>>>> access CDI
>>>>>> bean (LE doesn't trigger any code). I
>> don't know
>>>> if it's the
>>>>>> expected behavior for Seam-Config to read
>>>> beans.xml only in
>>>>>> META-INF....
>>>>>>>>>>>>> 
>> 
>> 
> 
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev




More information about the seam-dev mailing list