You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by Shawn Jiang <ge...@gmail.com> on 2011/03/21 05:05:52 UTC

NPE when calling BeanManagerImpl.isNormalScope(component.getScope())

Could anyone shed some light on following issue ?


I got a NPE when calling BeanManagerImpl.isNormalScope(null) when
constructing a MDB instance in a non-webbean ejb module.   From the
stacktrace, there's no chance the component.getScope() could return a
non-null value.

I'm wondering why there's no null param checking
for BeanManagerImpl.isNormalScope()  method ?   Or could anyone advise how
to make component.getScope() return a non-null value in following stacktrace
methods ?


> org.apache.webbeans.container.BeanManagerImpl.isNormalScope(java.lang.Class<?
> extends java.lang.annotation.Annotation>) line: 1031
> org.apache.webbeans.config.DefinitionUtil.defineInternalInjectedFields(org.apache.webbeans.component.AbstractInjectionTargetBean<T>,
> java.lang.Class<T>, boolean) line: 991
> org.apache.webbeans.config.DefinitionUtil.defineInternalInjectedFieldsRecursively(org.apache.webbeans.component.AbstractInjectionTargetBean<T>,
> java.lang.Class<T>) line: 968
> org.apache.webbeans.util.WebBeansAnnotatedTypeUtil.defineInjectedFields(org.apache.webbeans.component.AbstractInjectionTargetBean<X>,
> javax.enterprise.inject.spi.AnnotatedType<X>) line: 384
> org.apache.webbeans.component.creation.AnnotatedTypeBeanCreatorImpl<T>(org.apache.webbeans.component.creation.AbstractInjectedTargetBeanCreator<T>).defineInjectedFields()
> line: 80
> org.apache.webbeans.util.WebBeansAnnotatedTypeUtil.getJavaEeComponentInstanceInjectionPoints(org.apache.webbeans.config.WebBeansContext,
> javax.enterprise.inject.spi.AnnotatedType<T>) line: 724
> org.apache.webbeans.inject.OWBInjector.inject(java.lang.Object,
> javax.enterprise.context.spi.CreationalContext<?>) line: 126
> org.apache.webbeans.inject.OWBInjector.inject(java.lang.Object) line: 93
> org.apache.openejb.BeanContext.newInstance() line: 1122
> org.apache.openejb.core.mdb.MdbInstanceFactory.constructBean() line: 194
> org.apache.openejb.core.mdb.MdbInstanceFactory.createInstance(boolean)
> line: 124



-- 
Shawn



-- 
Shawn

Re: NPE when calling BeanManagerImpl.isNormalScope(component.getScope())

Posted by Shawn Jiang <ge...@gmail.com>.
Thanks, David !

On Mon, Mar 21, 2011 at 1:24 PM, David Blevins <da...@gmail.com>wrote:

> In OpenEJB we have OWB integrated 100% of the time.  Primarily so that
> scenarios like this don't occur.  I.e. "my app worked fine and then I turned
> on CDI and all these unrelated things break."
>
> Shawn, I'm hammering on that code now on the OpenEJB end.  I've checked in
> a temporary work around there, which should get us by for a while.
>
> -David
>
> On Mar 20, 2011, at 9:36 PM, Joseph Bergmark wrote:
>
> > I might be missing the point, but why are we calling OWB at all if this
> is a
> > non-cdi ejb module (which I assume means no beans.xml)?
> >
> > Sincerely,
> >
> > Joe
> >
> > On Mon, Mar 21, 2011 at 12:05 AM, Shawn Jiang <ge...@gmail.com>
> wrote:
> >
> >> Could anyone shed some light on following issue ?
> >>
> >>
> >> I got a NPE when calling BeanManagerImpl.isNormalScope(null) when
> >> constructing a MDB instance in a non-webbean ejb module.   From the
> >> stacktrace, there's no chance the component.getScope() could return a
> >> non-null value.
> >>
> >> I'm wondering why there's no null param checking
> >> for BeanManagerImpl.isNormalScope()  method ?   Or could anyone advise
> how
> >> to make component.getScope() return a non-null value in following
> >> stacktrace
> >> methods ?
> >>
> >>
> >>>
> >>
> org.apache.webbeans.container.BeanManagerImpl.isNormalScope(java.lang.Class<?
> >>> extends java.lang.annotation.Annotation>) line: 1031
> >>>
> >>
> org.apache.webbeans.config.DefinitionUtil.defineInternalInjectedFields(org.apache.webbeans.component.AbstractInjectionTargetBean<T>,
> >>> java.lang.Class<T>, boolean) line: 991
> >>>
> >>
> org.apache.webbeans.config.DefinitionUtil.defineInternalInjectedFieldsRecursively(org.apache.webbeans.component.AbstractInjectionTargetBean<T>,
> >>> java.lang.Class<T>) line: 968
> >>>
> >>
> org.apache.webbeans.util.WebBeansAnnotatedTypeUtil.defineInjectedFields(org.apache.webbeans.component.AbstractInjectionTargetBean<X>,
> >>> javax.enterprise.inject.spi.AnnotatedType<X>) line: 384
> >>>
> >>
> org.apache.webbeans.component.creation.AnnotatedTypeBeanCreatorImpl<T>(org.apache.webbeans.component.creation.AbstractInjectedTargetBeanCreator<T>).defineInjectedFields()
> >>> line: 80
> >>>
> >>
> org.apache.webbeans.util.WebBeansAnnotatedTypeUtil.getJavaEeComponentInstanceInjectionPoints(org.apache.webbeans.config.WebBeansContext,
> >>> javax.enterprise.inject.spi.AnnotatedType<T>) line: 724
> >>> org.apache.webbeans.inject.OWBInjector.inject(java.lang.Object,
> >>> javax.enterprise.context.spi.CreationalContext<?>) line: 126
> >>> org.apache.webbeans.inject.OWBInjector.inject(java.lang.Object) line:
> 93
> >>> org.apache.openejb.BeanContext.newInstance() line: 1122
> >>> org.apache.openejb.core.mdb.MdbInstanceFactory.constructBean() line:
> 194
> >>> org.apache.openejb.core.mdb.MdbInstanceFactory.createInstance(boolean)
> >>> line: 124
> >>
> >>
> >>
> >> --
> >> Shawn
> >>
> >>
> >>
> >> --
> >> Shawn
> >>
>
>


-- 
Shawn

Re: NPE when calling BeanManagerImpl.isNormalScope(component.getScope())

Posted by David Blevins <da...@gmail.com>.
In OpenEJB we have OWB integrated 100% of the time.  Primarily so that scenarios like this don't occur.  I.e. "my app worked fine and then I turned on CDI and all these unrelated things break."

Shawn, I'm hammering on that code now on the OpenEJB end.  I've checked in a temporary work around there, which should get us by for a while.

-David

On Mar 20, 2011, at 9:36 PM, Joseph Bergmark wrote:

> I might be missing the point, but why are we calling OWB at all if this is a
> non-cdi ejb module (which I assume means no beans.xml)?
> 
> Sincerely,
> 
> Joe
> 
> On Mon, Mar 21, 2011 at 12:05 AM, Shawn Jiang <ge...@gmail.com> wrote:
> 
>> Could anyone shed some light on following issue ?
>> 
>> 
>> I got a NPE when calling BeanManagerImpl.isNormalScope(null) when
>> constructing a MDB instance in a non-webbean ejb module.   From the
>> stacktrace, there's no chance the component.getScope() could return a
>> non-null value.
>> 
>> I'm wondering why there's no null param checking
>> for BeanManagerImpl.isNormalScope()  method ?   Or could anyone advise how
>> to make component.getScope() return a non-null value in following
>> stacktrace
>> methods ?
>> 
>> 
>>> 
>> org.apache.webbeans.container.BeanManagerImpl.isNormalScope(java.lang.Class<?
>>> extends java.lang.annotation.Annotation>) line: 1031
>>> 
>> org.apache.webbeans.config.DefinitionUtil.defineInternalInjectedFields(org.apache.webbeans.component.AbstractInjectionTargetBean<T>,
>>> java.lang.Class<T>, boolean) line: 991
>>> 
>> org.apache.webbeans.config.DefinitionUtil.defineInternalInjectedFieldsRecursively(org.apache.webbeans.component.AbstractInjectionTargetBean<T>,
>>> java.lang.Class<T>) line: 968
>>> 
>> org.apache.webbeans.util.WebBeansAnnotatedTypeUtil.defineInjectedFields(org.apache.webbeans.component.AbstractInjectionTargetBean<X>,
>>> javax.enterprise.inject.spi.AnnotatedType<X>) line: 384
>>> 
>> org.apache.webbeans.component.creation.AnnotatedTypeBeanCreatorImpl<T>(org.apache.webbeans.component.creation.AbstractInjectedTargetBeanCreator<T>).defineInjectedFields()
>>> line: 80
>>> 
>> org.apache.webbeans.util.WebBeansAnnotatedTypeUtil.getJavaEeComponentInstanceInjectionPoints(org.apache.webbeans.config.WebBeansContext,
>>> javax.enterprise.inject.spi.AnnotatedType<T>) line: 724
>>> org.apache.webbeans.inject.OWBInjector.inject(java.lang.Object,
>>> javax.enterprise.context.spi.CreationalContext<?>) line: 126
>>> org.apache.webbeans.inject.OWBInjector.inject(java.lang.Object) line: 93
>>> org.apache.openejb.BeanContext.newInstance() line: 1122
>>> org.apache.openejb.core.mdb.MdbInstanceFactory.constructBean() line: 194
>>> org.apache.openejb.core.mdb.MdbInstanceFactory.createInstance(boolean)
>>> line: 124
>> 
>> 
>> 
>> --
>> Shawn
>> 
>> 
>> 
>> --
>> Shawn
>> 


Re: NPE when calling BeanManagerImpl.isNormalScope(component.getScope())

Posted by Joseph Bergmark <be...@apache.org>.
I might be missing the point, but why are we calling OWB at all if this is a
non-cdi ejb module (which I assume means no beans.xml)?

Sincerely,

Joe

On Mon, Mar 21, 2011 at 12:05 AM, Shawn Jiang <ge...@gmail.com> wrote:

> Could anyone shed some light on following issue ?
>
>
> I got a NPE when calling BeanManagerImpl.isNormalScope(null) when
> constructing a MDB instance in a non-webbean ejb module.   From the
> stacktrace, there's no chance the component.getScope() could return a
> non-null value.
>
> I'm wondering why there's no null param checking
> for BeanManagerImpl.isNormalScope()  method ?   Or could anyone advise how
> to make component.getScope() return a non-null value in following
> stacktrace
> methods ?
>
>
> >
> org.apache.webbeans.container.BeanManagerImpl.isNormalScope(java.lang.Class<?
> > extends java.lang.annotation.Annotation>) line: 1031
> >
> org.apache.webbeans.config.DefinitionUtil.defineInternalInjectedFields(org.apache.webbeans.component.AbstractInjectionTargetBean<T>,
> > java.lang.Class<T>, boolean) line: 991
> >
> org.apache.webbeans.config.DefinitionUtil.defineInternalInjectedFieldsRecursively(org.apache.webbeans.component.AbstractInjectionTargetBean<T>,
> > java.lang.Class<T>) line: 968
> >
> org.apache.webbeans.util.WebBeansAnnotatedTypeUtil.defineInjectedFields(org.apache.webbeans.component.AbstractInjectionTargetBean<X>,
> > javax.enterprise.inject.spi.AnnotatedType<X>) line: 384
> >
> org.apache.webbeans.component.creation.AnnotatedTypeBeanCreatorImpl<T>(org.apache.webbeans.component.creation.AbstractInjectedTargetBeanCreator<T>).defineInjectedFields()
> > line: 80
> >
> org.apache.webbeans.util.WebBeansAnnotatedTypeUtil.getJavaEeComponentInstanceInjectionPoints(org.apache.webbeans.config.WebBeansContext,
> > javax.enterprise.inject.spi.AnnotatedType<T>) line: 724
> > org.apache.webbeans.inject.OWBInjector.inject(java.lang.Object,
> > javax.enterprise.context.spi.CreationalContext<?>) line: 126
> > org.apache.webbeans.inject.OWBInjector.inject(java.lang.Object) line: 93
> > org.apache.openejb.BeanContext.newInstance() line: 1122
> > org.apache.openejb.core.mdb.MdbInstanceFactory.constructBean() line: 194
> > org.apache.openejb.core.mdb.MdbInstanceFactory.createInstance(boolean)
> > line: 124
>
>
>
> --
> Shawn
>
>
>
> --
> Shawn
>