You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by "Kettil, Mattias" <ma...@cgi.com> on 2016/06/17 12:01:53 UTC

Spurious NullPointerException in DelegateQueryBuilder

Hello,

We have an application that uses Deltaspike 1.6.1 on TomEE 1.7.1 with EclipseLink 2.6.2. Java version is 1.8.0_74.

During a batch operation (BatchEE 0.3-incubating) using 32 threads we sometimes get the following exception:

java.lang.NullPointerException
                             at org.apache.deltaspike.data.impl.builder.DelegateQueryBuilder.selectDelegate(DelegateQueryBuilder.java:79)
                             at org.apache.deltaspike.data.impl.builder.DelegateQueryBuilder.execute(DelegateQueryBuilder.java:52)
                             at org.apache.deltaspike.data.impl.builder.QueryBuilder.executeQuery(QueryBuilder.java:59)
                             at org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner$1.proceed(TransactionalQueryRunner.java:77)
                             at org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.execute(ResourceLocalTransactionStrategy.java:133)
                             at org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner.executeTransactional(TransactionalQueryRunner.java:72)
                             at org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner.executeQuery(TransactionalQueryRunner.java:54)
                             at org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner$$OwbNormalScopeProxy0.executeQuery(org/apache/deltaspike/data/impl/tx/TransactionalQueryRunner.java)
                             at org.apache.deltaspike.data.impl.handler.QueryHandler.process(QueryHandler.java:147)
                             at org.apache.deltaspike.data.impl.handler.QueryHandler.invoke(QueryHandler.java:129)
                             at org.apache.deltaspike.data.impl.handler.QueryHandler$$OwbNormalScopeProxy0.invoke(org/apache/deltaspike/data/impl/handler/QueryHandler.java)
                             at org.apache.deltaspike.proxy.impl.invocation.DelegateManualInvocationHandler.proceedOriginal(DelegateManualInvocationHandler.java:46)
                             at org.apache.deltaspike.proxy.impl.invocation.AbstractManualInvocationHandler.invoke(AbstractManualInvocationHandler.java:63)
                             at org.apache.deltaspike.proxy.impl.invocation.DelegateManualInvocationHandler.staticInvoke(DelegateManualInvocationHandler.java:39)
                             at se.company.OurRepository$$DSPartialBeanProxy.save(Unknown Source)...

Our repository class is defined like this:
@Repository
@ApplicationScoped
public interface OurRepository extends EntityRepository<OurEntity, Long> {
...
}

And is called from a @Stateless bean.

The entity itself is not null, since when we tried that in a unit test we got a different exception.
The stacktrace suggests that the bean manager instance is null, but we have no idea how that can be. Are we missing something here? Do you have any idea how this exception can arise?

Best regards,
Mattias Kettil

Re: Spurious NullPointerException in DelegateQueryBuilder

Posted by "John D. Ament" <jo...@apache.org>.
Very good news :-)

Enjoy!

John

On Tue, Jun 21, 2016 at 4:30 AM Kettil, Mattias <ma...@cgi.com>
wrote:

> Hi John,
>
> It seems like the issue has disappeared after upgrading to 1.7.0. Nice
> timing with the new release. :)
>
> Thank you for your quick response.
>
> Best regards,
> Mattias
>
> -----Original Message-----
> From: John D. Ament [mailto:johndament@apache.org]
> Sent: den 17 juni 2016 14:20
> To: users@deltaspike.apache.org
> Subject: Re: Spurious NullPointerException in DelegateQueryBuilder
>
> Hi Mattias,
>
> I was wondering if you could try with latest 1.7.0-SNAPSHOT and see if the
> issue reproduces?  I see many changes going on in this class, and the line
> referenced isn't in this spot anymore.  The NPE likely means that
> beanManager is null, which doesn't make much sense to me.
>
> I would also try to see if this reproduces on TomEE 7.
>
> John
>
> On Fri, Jun 17, 2016 at 8:02 AM Kettil, Mattias <ma...@cgi.com>
> wrote:
>
> > Hello,
> >
> > We have an application that uses Deltaspike 1.6.1 on TomEE 1.7.1 with
> > EclipseLink 2.6.2. Java version is 1.8.0_74.
> >
> > During a batch operation (BatchEE 0.3-incubating) using 32 threads we
> > sometimes get the following exception:
> >
> > java.lang.NullPointerException
> >                              at
> >
> org.apache.deltaspike.data.impl.builder.DelegateQueryBuilder.selectDelegate(DelegateQueryBuilder.java:79)
> >                              at
> >
> org.apache.deltaspike.data.impl.builder.DelegateQueryBuilder.execute(DelegateQueryBuilder.java:52)
> >                              at
> >
> org.apache.deltaspike.data.impl.builder.QueryBuilder.executeQuery(QueryBuilder.java:59)
> >                              at
> >
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner$1.proceed(TransactionalQueryRunner.java:77)
> >                              at
> >
> org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.execute(ResourceLocalTransactionStrategy.java:133)
> >                              at
> >
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner.executeTransactional(TransactionalQueryRunner.java:72)
> >                              at
> >
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner.executeQuery(TransactionalQueryRunner.java:54)
> >                              at
> >
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner$$OwbNormalScopeProxy0.executeQuery(org/apache/deltaspike/data/impl/tx/TransactionalQueryRunner.java)
> >                              at
> >
> org.apache.deltaspike.data.impl.handler.QueryHandler.process(QueryHandler.java:147)
> >                              at
> >
> org.apache.deltaspike.data.impl.handler.QueryHandler.invoke(QueryHandler.java:129)
> >                              at
> >
> org.apache.deltaspike.data.impl.handler.QueryHandler$$OwbNormalScopeProxy0.invoke(org/apache/deltaspike/data/impl/handler/QueryHandler.java)
> >                              at
> >
> org.apache.deltaspike.proxy.impl.invocation.DelegateManualInvocationHandler.proceedOriginal(DelegateManualInvocationHandler.java:46)
> >                              at
> >
> org.apache.deltaspike.proxy.impl.invocation.AbstractManualInvocationHandler.invoke(AbstractManualInvocationHandler.java:63)
> >                              at
> >
> org.apache.deltaspike.proxy.impl.invocation.DelegateManualInvocationHandler.staticInvoke(DelegateManualInvocationHandler.java:39)
> >                              at
> > se.company.OurRepository$$DSPartialBeanProxy.save(Unknown Source)...
> >
> > Our repository class is defined like this:
> > @Repository
> > @ApplicationScoped
> > public interface OurRepository extends EntityRepository<OurEntity,
> > Long> { ...
> > }
> >
> > And is called from a @Stateless bean.
> >
> > The entity itself is not null, since when we tried that in a unit test
> > we got a different exception.
> > The stacktrace suggests that the bean manager instance is null, but we
> > have no idea how that can be. Are we missing something here? Do you
> > have any idea how this exception can arise?
> >
> > Best regards,
> > Mattias Kettil
> >
>

RE: Spurious NullPointerException in DelegateQueryBuilder

Posted by "Kettil, Mattias" <ma...@cgi.com>.
Hi John,

It seems like the issue has disappeared after upgrading to 1.7.0. Nice timing with the new release. :)

Thank you for your quick response. 

Best regards,
Mattias

-----Original Message-----
From: John D. Ament [mailto:johndament@apache.org] 
Sent: den 17 juni 2016 14:20
To: users@deltaspike.apache.org
Subject: Re: Spurious NullPointerException in DelegateQueryBuilder

Hi Mattias,

I was wondering if you could try with latest 1.7.0-SNAPSHOT and see if the issue reproduces?  I see many changes going on in this class, and the line referenced isn't in this spot anymore.  The NPE likely means that beanManager is null, which doesn't make much sense to me.

I would also try to see if this reproduces on TomEE 7.

John

On Fri, Jun 17, 2016 at 8:02 AM Kettil, Mattias <ma...@cgi.com>
wrote:

> Hello,
>
> We have an application that uses Deltaspike 1.6.1 on TomEE 1.7.1 with 
> EclipseLink 2.6.2. Java version is 1.8.0_74.
>
> During a batch operation (BatchEE 0.3-incubating) using 32 threads we 
> sometimes get the following exception:
>
> java.lang.NullPointerException
>                              at
> org.apache.deltaspike.data.impl.builder.DelegateQueryBuilder.selectDelegate(DelegateQueryBuilder.java:79)
>                              at
> org.apache.deltaspike.data.impl.builder.DelegateQueryBuilder.execute(DelegateQueryBuilder.java:52)
>                              at
> org.apache.deltaspike.data.impl.builder.QueryBuilder.executeQuery(QueryBuilder.java:59)
>                              at
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner$1.proceed(TransactionalQueryRunner.java:77)
>                              at
> org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.execute(ResourceLocalTransactionStrategy.java:133)
>                              at
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner.executeTransactional(TransactionalQueryRunner.java:72)
>                              at
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner.executeQuery(TransactionalQueryRunner.java:54)
>                              at
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner$$OwbNormalScopeProxy0.executeQuery(org/apache/deltaspike/data/impl/tx/TransactionalQueryRunner.java)
>                              at
> org.apache.deltaspike.data.impl.handler.QueryHandler.process(QueryHandler.java:147)
>                              at
> org.apache.deltaspike.data.impl.handler.QueryHandler.invoke(QueryHandler.java:129)
>                              at
> org.apache.deltaspike.data.impl.handler.QueryHandler$$OwbNormalScopeProxy0.invoke(org/apache/deltaspike/data/impl/handler/QueryHandler.java)
>                              at
> org.apache.deltaspike.proxy.impl.invocation.DelegateManualInvocationHandler.proceedOriginal(DelegateManualInvocationHandler.java:46)
>                              at
> org.apache.deltaspike.proxy.impl.invocation.AbstractManualInvocationHandler.invoke(AbstractManualInvocationHandler.java:63)
>                              at
> org.apache.deltaspike.proxy.impl.invocation.DelegateManualInvocationHandler.staticInvoke(DelegateManualInvocationHandler.java:39)
>                              at
> se.company.OurRepository$$DSPartialBeanProxy.save(Unknown Source)...
>
> Our repository class is defined like this:
> @Repository
> @ApplicationScoped
> public interface OurRepository extends EntityRepository<OurEntity, 
> Long> { ...
> }
>
> And is called from a @Stateless bean.
>
> The entity itself is not null, since when we tried that in a unit test 
> we got a different exception.
> The stacktrace suggests that the bean manager instance is null, but we 
> have no idea how that can be. Are we missing something here? Do you 
> have any idea how this exception can arise?
>
> Best regards,
> Mattias Kettil
>

Re: Spurious NullPointerException in DelegateQueryBuilder

Posted by "John D. Ament" <jo...@apache.org>.
Hi Mattias,

I was wondering if you could try with latest 1.7.0-SNAPSHOT and see if the
issue reproduces?  I see many changes going on in this class, and the line
referenced isn't in this spot anymore.  The NPE likely means that
beanManager is null, which doesn't make much sense to me.

I would also try to see if this reproduces on TomEE 7.

John

On Fri, Jun 17, 2016 at 8:02 AM Kettil, Mattias <ma...@cgi.com>
wrote:

> Hello,
>
> We have an application that uses Deltaspike 1.6.1 on TomEE 1.7.1 with
> EclipseLink 2.6.2. Java version is 1.8.0_74.
>
> During a batch operation (BatchEE 0.3-incubating) using 32 threads we
> sometimes get the following exception:
>
> java.lang.NullPointerException
>                              at
> org.apache.deltaspike.data.impl.builder.DelegateQueryBuilder.selectDelegate(DelegateQueryBuilder.java:79)
>                              at
> org.apache.deltaspike.data.impl.builder.DelegateQueryBuilder.execute(DelegateQueryBuilder.java:52)
>                              at
> org.apache.deltaspike.data.impl.builder.QueryBuilder.executeQuery(QueryBuilder.java:59)
>                              at
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner$1.proceed(TransactionalQueryRunner.java:77)
>                              at
> org.apache.deltaspike.jpa.impl.transaction.ResourceLocalTransactionStrategy.execute(ResourceLocalTransactionStrategy.java:133)
>                              at
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner.executeTransactional(TransactionalQueryRunner.java:72)
>                              at
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner.executeQuery(TransactionalQueryRunner.java:54)
>                              at
> org.apache.deltaspike.data.impl.tx.TransactionalQueryRunner$$OwbNormalScopeProxy0.executeQuery(org/apache/deltaspike/data/impl/tx/TransactionalQueryRunner.java)
>                              at
> org.apache.deltaspike.data.impl.handler.QueryHandler.process(QueryHandler.java:147)
>                              at
> org.apache.deltaspike.data.impl.handler.QueryHandler.invoke(QueryHandler.java:129)
>                              at
> org.apache.deltaspike.data.impl.handler.QueryHandler$$OwbNormalScopeProxy0.invoke(org/apache/deltaspike/data/impl/handler/QueryHandler.java)
>                              at
> org.apache.deltaspike.proxy.impl.invocation.DelegateManualInvocationHandler.proceedOriginal(DelegateManualInvocationHandler.java:46)
>                              at
> org.apache.deltaspike.proxy.impl.invocation.AbstractManualInvocationHandler.invoke(AbstractManualInvocationHandler.java:63)
>                              at
> org.apache.deltaspike.proxy.impl.invocation.DelegateManualInvocationHandler.staticInvoke(DelegateManualInvocationHandler.java:39)
>                              at
> se.company.OurRepository$$DSPartialBeanProxy.save(Unknown Source)...
>
> Our repository class is defined like this:
> @Repository
> @ApplicationScoped
> public interface OurRepository extends EntityRepository<OurEntity, Long> {
> ...
> }
>
> And is called from a @Stateless bean.
>
> The entity itself is not null, since when we tried that in a unit test we
> got a different exception.
> The stacktrace suggests that the bean manager instance is null, but we
> have no idea how that can be. Are we missing something here? Do you have
> any idea how this exception can arise?
>
> Best regards,
> Mattias Kettil
>