Skip to main content

JAX-RS GET request gives EJBTransactionRolledbackException every fifth time

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
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.
Joined: 2014-03-21

Solution is here.

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?