geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de>
Subject Re: Geronimo 3.0 and CDI
Date Tue, 07 Feb 2012 13:49:18 GMT
No, not as long as the JAR has a META-INF/beans.xml in it. 


I'm not yet sure in which configuration Geronimo ships OpenWebBeans. Usually we 'ignore' most
of the BDA restrictions of the CDI-1.0 spec because they are really broken. They will got
reworked/dropped in CDI-1.1 anyway...

Depending on this you might be careful because a few things wont work if the BDA modus is
enabled. If it's enabled in Geronimo by default, then I _highly_ suggest to disable it manually
by providing a META-INF/openwebbeans/openwebbeans.properties where you set org.apache.webbeans.useBDABeansXMLScanner
= false

Btw, this BDA 'feature' is the reason for about 50% of all JBossAS, Weld and Glassfish bug
reports in the CDI area ;)

LieGrue,
strub




>________________________________
> From: Adme Admirolas <admirolaz@gmail.com>
>To: user@geronimo.apache.org; Mark Struberg <struberg@yahoo.de> 
>Sent: Tuesday, February 7, 2012 2:33 PM
>Subject: Re: Geronimo 3.0 and CDI
> 
>
>Thanks for quick response. I found my mistake by myself. I have added beans.xml not to
web-inf, but to meta-inf folder. After moving that file, problem is solved.
>
>I got one more question. You have asked where "Injectable" class stored. Is there going
to be some problems, if that class would be in JAR in WEB-INF/lib?
>
>Admirolas
>
>
>On 7 February 2012 14:30, Mark Struberg <struberg@yahoo.de> wrote:
>
>Hi!
>>
>>First a small hint: you don't need to use @Default explicitly because it's assumed
if no other Qualifier (than @Named) is set.
>>
>>Second: you sure have the beans.xml marker files?
>>
>>
>>Where is this class 'Injectable' exactly stored? A JAR in WEB-INF/lib, in WEB-INF/classes
or an ear shared lib?
>>
>>LieGrue,
>>strub
>>
>>>________________________________
>>> From: Adme Admirolas <admirolaz@gmail.com>
>>>To: user@geronimo.apache.org
>>>Sent: Tuesday, February 7, 2012 1:07 PM
>>>Subject: Geronimo 3.0 and CDI
>>
>>>
>>>
>>>Hello,
>>>
>>>I'm failing to create simple web app and deploy it to Geronimo. I'm trying to
create simple servlet, and inject POJO using CDI.
>>>
>>>Here is my Servlet class:
>>>
>>>
>>>@WebServlet("/TestServlet")
>>>>public class TestServlet extends HttpServlet {
>>>>    private static final long serialVersionUID = 1L;
>>>>      
>>>>    @Inject
>>>>    private InjectableInterface inj;
>>>> 
>>>>    public TestServlet() {
>>>>        super();
>>>>    }
>>>>}
>>>>
>>>Here is InjectableInterface.java:
>>>
>>>
>>>public interface InjectableInterface {
>>>>
>>>>}
>>>>
>>>Here is implementation of interface:
>>>
>>>
>>>@Default
>>>>public class Injectable implements InjectableInterface {
>>>>
>>>>}
>>>>
>>>But when I deploy war to geronimo 3, i get this exception:
>>>
>>>
>>>javax.enterprise.inject.UnsatisfiedResolutionException: Api type [test.InjectableInterface]
is not found with the qualifiers
>>Qualifiers: [@javax.enterprise.inject.Default()]
>>for injection into Field Injection Point, field name :  inj, Bean Owner : [TestServlet,
Name:null, WebBeans Type:MANAGED, API Types:[], Qualifiers:[]] org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException(InjectionExceptionUtils.java:92)
org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:98) org.apache.webbeans.container.InjectionResolver.getInjectionPointBean(InjectionResolver.java:265)
org.apache.webbeans.inject.OWBInjector.getInjectedObjectReference(OWBInjector.java:229) org.apache.webbeans.inject.OWBInjector.inject(OWBInjector.java:146)
org.apache.webbeans.inject.OWBInjector.inject(OWBInjector.java:94) org.apache.geronimo.j2ee.annotation.Holder.newInstance(Holder.java:185)
org.apache.geronimo.tomcat.TomcatInstanceManager.newInstance(TomcatInstanceManager.java:74)
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:850)
>> org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:48)
org.apache.geronimo.tomcat.valve.ProtectedTargetValve.invoke(ProtectedTargetValve.java:53)
>>>What I'm doing wrong? Could anyone help me?
>>>
>>>Admrolas
>>>
>>>
>>>
>>
>
>
>

Mime
View raw message