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,org.apache.openejb.arquillian.tests.cdi.constructor.SimpleServlet,javax.servlet.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.java:108)
        at 
org.apache.webbeans.inject.InjectableConstructor.doInjection(InjectableConstructor.java:80)
        at 
org.apache.webbeans.portable.InjectionTargetImpl.newInstance(InjectionTargetImpl.java:253)
        at 
org.apache.webbeans.portable.InjectionTargetImpl.produce(InjectionTargetImpl.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