Guice-Persist - “Work already begun on this thread. Looks like you have called UnitOfWork.begin() twice without a balancing call to end() in between.”

StackOverflow https://stackoverflow.com/questions/10941709

Domanda

Our application is a Java-GWT application that uses Guice-Persist and Guice-Servlet extensively. We have never had a problem using the session-per-HTTPRequest feature of Guice-Persist which is similar to what Warp-persist originally used.

We are filtering our webapp through the PersistFilter class as per the documentation. Our persistence.xml file has transaction-type="RESOURCE_LOCAL" as per the Guice documentation here.

Now for some strange reason our PROD environment is showing the error

"Work already begun on this thread. Looks like you have called UnitOfWork.begin() twice without a balancing call to end() in between."

enter image description here

It looks like there is an issue where nested Units of work are not supported in Guice-Persist. LINK

We also recently moved from hibernate 3.6.3.Final to 4.1.4.Final. Not sure if his would have some sort of incompatibility with guice...

At this point we are totally in the dark as to why this would be happening.

È stato utile?

Soluzione

I was experiencing that symptom when a transaction was implicitly opened by Hibernate because I forgot to add a @Transaction annotation to the outermost logical transaction brace.

To, to pinpoint the issue, set breakpoints in your database layer as well as in begin() and end() to spot cases when persistence (read or write does not matter) happens without an existing transaction.

Altri suggerimenti

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top