openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Bauer" <>
Subject Re: NullPointerException when calling createEntityManager on EntityManagerFactory
Date Mon, 08 Dec 2008 19:38:09 GMT
The Animal class is listed as an entity class in the persistence.xml, but it
is not annotated (or defined in orm.xml) as an entity.  Annotating the
entity should correct the problem.  I'll open a JIRA to address the NPE,
since OpenJPA should be able to handle this condition more appropriately.

Also, after I annotated the entity, I needed to use the maven compiler
plugin to set the compile source and target to 1.5.  You can do that by
adding this to your pom, after dependencies:



On Sat, Dec 6, 2008 at 5:11 AM, Martin Olsen <> wrote:

> Hi.
> I am receiving a NullPointerException when I try to get an EntityManager
> in a jUnit test.
> What am I missing?
> The attached files is organised like this:
>  pom.xml
>  src/main/java/domain/
>  src/test/java/domain/
>  src/test/resources/META-INF/persistence.xml
> The test is run with `mvn test`.
> The stacktrace is in the attached file domain.OpenJPATest.txt
> --
> Martin Olsen

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message