Skip to main content

JAX-RS GET request gives EJBTransactionRolledbackException every fifth time

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
Pacopag
Offline
Joined: 2014-03-21

Hi. I have a pretty simple service that looks like this

<br />
  @GET<br />
  @Path("/list")<br />
  public Response getList() {<br />
      TypedQuery<Glyph> query = em.createNamedQuery(Glyph.FIND_ALL, Glyph.class);<br />
      Glyphs glyphs = new Glyphs(query.getResultList());<br />
      return Response.ok(glyphs).build();<br />
  }<br />

Hitting the url works perfectly fine, except that (predictably) I get a javax.ejb.EJBTransactionRolledbackException every fifth time I request the url.

I really don't understand why this would happen. I actually don't even understand why there's a transaction involved at all. I'm pretty sure all this is doing is a "select * from some_table".
Let me know if you want to see the Glyph and Glyphs classes, but they're just straight-up Entity objects.

Edit: The root cause is actually javax.ejb.TransactionRolledbackLocalException

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Pacopag
Offline
Joined: 2014-03-21

Solution is here.

https://www.java.net/forum/topic/glassfish/glassfish/transactionrolledba...

This is not the first time I've had mysterious problems that were solved by restarting glassfish.

When am I going to learn my lesson?