I saw that 3.1.1 says that managed beans need to either have a default
constructor or have a constructor annotated @Inject, but I missed 5.4.1 with
the confusing double negative sentence that says that client proxies are
only valid for beans that "don't have a non-private constructor with no
parameters."

Thanks for the pointer!

Sincerely,

Joe

On Thu, Dec 10, 2009 at 1:43 AM, Gurkan Erdogdu <[email protected]>wrote:

> If a bean is normal scoped, it must satisfy conditions at  5.4.1. Mean that
> it has to default constructor.
>
> I think that I was checked this situation in our impl. in
> WebBeansUtil#checkUnproxiableApiType.
>
> We have to look where this method is called.
>
> 2009/12/9 Joe Bergmark (JIRA) <[email protected]>
>
> > Managed beans with non-default constructors lead to
> InstantiationException
> > when creating the proxy
> >
> >
> --------------------------------------------------------------------------------------------------
> >
> >                 Key: OWB-185
> >                 URL: https://issues.apache.org/jira/browse/OWB-185
> >             Project: OpenWebBeans
> >          Issue Type: Bug
> >          Components: Injection and Lookup
> >    Affects Versions: M3
> >            Reporter: Joe Bergmark
> >            Assignee: Gurkan Erdogdu
> >
> >
> > While working on OWB-151 I ran into a problem with the way proxies are
> > created for beans with non-default injected constructors.  For example,
> you
> > could look at
> >
> > org.apache.webbeans.newtests.interceptors.lifecycle.LifecycleBean and
> give
> > it a normal scope:
> >
> > @RequestScoped
> > @LifecycleBinding
> >
> @Named("org.apache.webbeans.newtests.interceptors.lifecycle.LifecycleBean")
> > public class LifecycleBean
> > {
> >    public static String CONSTRUCTOR_INJECTED = null;
> >
> >    @Inject
> >    public LifecycleBean(@New String string)
> >    {
> >        CONSTRUCTOR_INJECTED = string;
> >    }
> >
> >
> >    public void touch(){}
> > }
> >
> > Leads to the following exception (the stack trace is off slightly due to
> > some refactoring I have done but the error should be the same):
> > org.apache.webbeans.exception.WebBeansException:
> > java.lang.InstantiationException:
> >
> org.apache.webbeans.newtests.interceptors.lifecycle.LifecycleBean_$$_javassist_1
> >        at
> >
> org.apache.webbeans.proxy.JavassistProxyFactory.createNewProxyWithHandler(JavassistProxyFactory.java:53)
> >        at
> >
> org.apache.webbeans.proxy.JavassistProxyFactory.createNewProxyInstance(JavassistProxyFactory.java:78)
> >        at
> >
> org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:702)
> >        at
> >
> org.apache.webbeans.newtests.interceptors.lifecycle.LifecycleTest.testLifecycle(LifecycleTest.java:57)
> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >        at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >        at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
> >        at java.lang.reflect.Method.invoke(Method.java:599)
> >        at
> >
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> >        at
> >
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> >        at
> >
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> >        at
> >
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> >        at
> >
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> >        at
> >
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> >        at
> >
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
> >        at
> >
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
> >        at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
> >        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
> >        at
> org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
> >        at
> >
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> >        at
> >
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> >        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
> >        at
> >
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
> >        at
> >
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> >        at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> >        at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> >        at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> >        at
> >
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> > Caused by: java.lang.InstantiationException:
> >
> org.apache.webbeans.newtests.interceptors.lifecycle.LifecycleBean_$$_javassist_1
> >        at java.lang.J9VMInternals.newInstanceImpl(Native Method)
> >        at java.lang.Class.newInstance(Class.java:1325)
> >        at
> >
> org.apache.webbeans.proxy.JavassistProxyFactory.createNewProxyWithHandler(JavassistProxyFactory.java:48)
> >        ... 27 more
> >
> >
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >
>
>
> --
> Gurkan Erdogdu
> http://gurkanerdogdu.blogspot.com
>

Reply via email to