[jboss-user] [Beginner's Corner] - The cause exception lost in the exception chain

jaikiran pai do-not-reply at jboss.com
Sun Apr 11 01:27:35 EDT 2010


jaikiran pai [http://community.jboss.org/people/jaikiran] replied to the discussion

"The cause exception lost in the exception chain"

To view the discussion, visit: http://community.jboss.org/message/536759#536759

--------------------------------------------------------------
Quoting from that blog:

When using bean validation on JPA entities within an EJB 3 bean you  would actually get an EJBTransactionRolledbackException if there is a  constraint violation.

javax.ejb.EJBTransactionRolledbackException: Invalid object at persist time for groups [javax.validation.groups.Default, ]
Caused by: javax.validation.ConstraintViolationException: Invalid object at persist time for groups [javax.validation.groups.Default, ]



This  is all nicely according to specification, but not really interesting  information. You don't really want to know what happened, you want to  know what went wrong.



So I recommend adding the following to your  ejb-jar.xml:



<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                            http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
        version="3.0">
   <assembly-descriptor>
      <application-exception>
         <exception-class>javax.validation.ConstraintViolationException</exception-class>
         <rollback>true</rollback>
      </application-exception>
   </assembly-descriptor>
</ejb-jar>









--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/536759#536759]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100411/703b2210/attachment.html 


More information about the jboss-user mailing list