metamodel npe

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

metamodel npe

Jason Reilly
Hi all,

I am using OpenJPA 2.4.1 in Karaf and am seeing a NPE thrown...here is
stacktrace:

java.lang.NullPointerException
     at org.apache.openjpa.persistence.criteria.PathImpl.get(PathImpl.java:245)
     at org.renci.binning.dao.jpa.clinbin.DiagnosticBinningJobDAOImpl.findByExample(DiagnosticBinningJobDAOImpl.java:145)


That line in PathImpl is as follows:

if  (getType()!=  attr.getDeclaringType()) {


I am fairly sure that the "attr" is null as I have a check for that in
my "DiagnosticBinningJobDAOImpl.findByExample" method.  Here is snippet:

                 Join<DiagnosticBinningJob, DX> diagnosticBinningJobDXJoin = root.join(DiagnosticBinningJob_.dx);

                 logger.info("is join null: {}", diagnosticBinningJobDXJoin == null);

                 logger.info("is expression null: {}", diagnosticBinningJobDXJoin.get(DX_.id));


The last line there throws the NPE & I never see the log message, "is
expression null".  When I run this from within my editor as a JUnit test
case, the exception is not thrown.  I think this has something to do
with the class enhancing.  Yet, during the build, I see that the DX
class is enhanced without issue:

837  binning  INFO   [main] openjpa.Tool - Enhancer running on type "class org.renci.binning.dao.clinbin.model.DX".


Could this be due to an incorrect dependency version?  Like maybe and
old version of serp or asm?  Any other possible explanations?

Thanks,
Jason
Reply | Threaded
Open this post in threaded view
|

Re: metamodel npe

Jason Reilly
Hi all,

I have this sorted...turns out a different bundle/jar was exporting my
dao code.  Once I fixed the bundle exports, the NPE went away.

Sorry for the noise.

Regards,
Jason


On 12/12/2016 12:23 PM, Jason Reilly wrote:

> Hi all,
>
> I am using OpenJPA 2.4.1 in Karaf and am seeing a NPE thrown...here is
> stacktrace:
>
> java.lang.NullPointerException
>     at
> org.apache.openjpa.persistence.criteria.PathImpl.get(PathImpl.java:245)
>     at
> org.renci.binning.dao.jpa.clinbin.DiagnosticBinningJobDAOImpl.findByExample(DiagnosticBinningJobDAOImpl.java:145)
>
>
> That line in PathImpl is as follows:
>
> if  (getType()!=  attr.getDeclaringType()) {
>
>
> I am fairly sure that the "attr" is null as I have a check for that in
> my "DiagnosticBinningJobDAOImpl.findByExample" method. Here is snippet:
>
>                 Join<DiagnosticBinningJob, DX>
> diagnosticBinningJobDXJoin = root.join(DiagnosticBinningJob_.dx);
>
>                 logger.info("is join null: {}",
> diagnosticBinningJobDXJoin == null);
>
>                 logger.info("is expression null: {}",
> diagnosticBinningJobDXJoin.get(DX_.id));
>
>
> The last line there throws the NPE & I never see the log message, "is
> expression null".  When I run this from within my editor as a JUnit
> test case, the exception is not thrown.  I think this has something to
> do with the class enhancing.  Yet, during the build, I see that the DX
> class is enhanced without issue:
>
> 837  binning  INFO   [main] openjpa.Tool - Enhancer running on type
> "class org.renci.binning.dao.clinbin.model.DX".
>
>
> Could this be due to an incorrect dependency version?  Like maybe and
> old version of serp or asm?  Any other possible explanations?
>
> Thanks,
> Jason
>