[1.2.7] The JPA context is not initialized.

587 views
Skip to first unread message

Helton Souza

unread,
Nov 16, 2013, 4:50:58 PM11/16/13
to play-fr...@googlegroups.com
Guys I have my production environment running on Play 1.2.7

Everything was working good until yesterday when ALL my 3 apps started giving me exceptions:

play.exceptions.JPAException: The JPA context is not initialized. JPA Entity Manager automatically start when one or more classes annotated with the @javax.persistence.Entity annotation are found in the application.
at play.db.jpa.JPA.get(JPA.java:22)
at play.db.jpa.JPA.em(JPA.java:51)
at play.db.jpa.JPABase.em(JPABase.java:217)
at controllers.AdmEmailController.index(AdmEmailController.java:25)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:557)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:508)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
at Invocation.HTTP Request(Play!)


At first I though it was my mistake and then after investigating a lot I found this is happening every time I try to access my data base like:

EntityManager em = IngredientApi.em();
Query query = em.createNamedQuery(IngredientApi.NQ_GET_LIST_INGREDIENT);

OR this:

Query query = ConfigWeeklyEmail.em().createNamedQuery(ConfigWeeklyEmail.NQ_GET_LIST_TO_SEND);


I really need a light on this, can you point me any direction?

Thank you.
Message has been deleted

Helton Souza

unread,
Nov 17, 2013, 7:04:12 PM11/17/13
to play-fr...@googlegroups.com
Just adding my last test...

When I use:

JPA.newEntityManager()

It works, but if I try to use the normal way:

JPA.em()

I got JPA Context not Initialized.

Anderson Fernandes

unread,
Nov 18, 2013, 11:33:22 AM11/18/13
to play-fr...@googlegroups.com
Kill your stag, it's always there fault! kkkkkkkk

Fehmi Can SAGLAM

unread,
Nov 19, 2013, 2:14:06 AM11/19/13
to play-fr...@googlegroups.com, play-fr...@googlegroups.com
Hi,

Where do your sample codes stay? In an action? In a Job?

If not, I just want to remind you that you should manage your transaction manually using functions in the JPAPlugin.

Fehmi Can
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Helton Souza

unread,
Nov 19, 2013, 11:11:19 AM11/19/13
to play-fr...@googlegroups.com
SOLVED.

After trying to merge and find differences between version of the code I gave up.
Deleted the whole project started a new one (play new) and copy all the files into it and it's woking again.

I have NO idea what it was, but it's working on all my environments normally.

Posting this in case somebody have the same problem in the future.

Thank you.
Reply all
Reply to author
Forward
0 new messages