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 12:30:33 GMT
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