Well wonder about the case where you want to inject a servlet which is not
defined through @WebServlet or web.xml. it would be a bean with a scope then
Le 11 mai 2013 05:31, "David Blevins" <[email protected]> a écrit :

>
> On May 10, 2013, at 2:03 PM, Arne Limburg <[email protected]>
> wrote:
>
> > Hi David,
> >
> > Do I read the log correctly and SimpleServlet is @Dependent? Is
> > SimpleServlet injected into a passivation-capable bean?
> > If not, I agree with you that this is a bug.
>
> Right.  Neither the bean (Car) or the injection target (SimpleServlet
> constructor) are passivation capable.
>
>
> -David
>
> > Am 10.05.13 22:55 schrieb "David Blevins" unter <[email protected]
> >:
> >
> >> Since the upgrade to 1.2.0 in we have a test failure.  There's a servlet
> >> with constructor injection like so:
> >>
> >>
> >>   @Inject
> >>   public SimpleServlet(Car car) {
> >>       this.car = car;
> >>   }
> >>
> >> And Car looks like so:
> >>
> >>   public class Car {
> >>       private final String make = "Lexus", model = "IS 350";
> >>       private final int year = 2011;
> >>
> >>       public String drive(String name) {
> >>           return name + " is on the wheel of a " + year + " " + make +
> >> " " + model;
> >>       }
> >>   }
> >>
> >> All deploys fine and everything is injected as expected.  Now the
> >> problem.  If you introduce a producer, it fails saying Car is not
> >> passivation capable as required by the SimpleServlet injection point.
> >>
> >>   public class Car {
> >>       private final String make = "Lexus", model = "IS 350";
> >>       private final int year = 2011;
> >>
> >>       public Car(String ignore) {
> >>       }
> >>
> >>       public String drive(String name) {
> >>           return name + " is on the wheel of a " + year + " " + make +
> >> " " + model;
> >>       }
> >>   }
> >>
> >>   public class Foo {
> >>
> >>       @Produces @Default
> >>       public Car car() {
> >>           return new Car("foo");
> >>       }
> >>   }
> >>
> >>
> >> javax.enterprise.inject.IllegalProductException: A producer method or
> >> field of scope @Dependent returns an unserializable object for injection
> >> into an injection point Constructor Injection Point, constructor name :
> >> org.apache.openejb.arquillian.tests.cdi.constructor.SimpleServlet, Bean
> >> Owner : [SimpleServlet, Name:null, WebBeans Type:DEPENDENT, API
> >>
> Types:[java.io.Serializable,java.lang.Object,javax.servlet.ServletConfig,o
> >>
> rg.apache.openejb.arquillian.tests.cdi.constructor.SimpleServlet,javax.ser
> >>
> vlet.http.HttpServlet,javax.servlet.Servlet,javax.servlet.GenericServlet],
> >>
> >>
> Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]]
> >> that requires a passivation capable dependency
> >>      at
> >>
> org.apache.webbeans.inject.AbstractInjectable.inject(AbstractInjectable.ja
> >> va:108)
> >>      at
> >>
> org.apache.webbeans.inject.InjectableConstructor.doInjection(InjectableCon
> >> structor.java:80)
> >>      at
> >>
> org.apache.webbeans.portable.InjectionTargetImpl.newInstance(InjectionTarg
> >> etImpl.java:253)
> >>      at
> >>
> org.apache.webbeans.portable.InjectionTargetImpl.produce(InjectionTargetIm
> >> pl.java:180)
> >>      at
> >>
> org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean.java:
> >> 119)
> >>
> >> There's debate as if the test is bad or if the check is incorrect.
>  Seems
> >> like an OWB bug to me.
> >>
> >> Thoughts?
> >>
> >>
> >> -David
> >>
> >
> >
>
>

Reply via email to