geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adme Admirolas <admiro...@gmail.com>
Subject Re: Geronimo 3.0 and CDI
Date Tue, 07 Feb 2012 13:33:51 GMT
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