javax.ejb.EJBException: nested exception is: org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer

Hibernate JIRA | Raoni Fortes Normanton | 9 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    My Customer class has two address (embedded), one must be validated, the other dont. When the address2 is null, the validation works. But when the empty instance is setted, the persist crashes. Validating by ClassValidator works fine. But when I call the em.persist() in service, the exception is throwed: javax.ejb.EJBException: nested exception is: org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:148) at org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:172) at org.hibernate.action.EntityIdentityInsertAction.preInsert(EntityIdentityInsertAction.java:119) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:42) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108) at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49) at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38) at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596) at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:213) at br.com.kinomaxx.kinosystem.dao.EntityManagerWrapperBean.persist(EntityManagerWrapperBean.java:52) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:45) at org.mycontainer.jpa.PersistenceContextInterceptor.intercept(PersistenceContextInterceptor.java:53) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.kernel.interceptors.NamingInjectInterceptor.intercept(NamingInjectInterceptor.java:48) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.kernel.interceptors.NamingInjectInterceptor.intercept(NamingInjectInterceptor.java:48) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.ejb.interceptor.EJBContextInterceptor.intercept(EJBContextInterceptor.java:55) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.ejb.transaction.RequiredTransactionHandler.intercept(RequiredTransactionHandler.java:38) at org.mycontainer.ejb.interceptor.TransactionInterceptor.intercept(TransactionInterceptor.java:52) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.ejb.interceptor.EJBExceptionInterceptor.intercept(EJBExceptionInterceptor.java:27) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.kernel.reflect.proxy.ProxyEngine.invoke(ProxyEngine.java:77) at $Proxy33.persist(Unknown Source) at br.com.kinomaxx.kinosystem.CustomerTest.test(CustomerTest.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99) at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45) at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71) at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) javax.ejb.EJBException: nested exception is: org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer at org.mycontainer.ejb.interceptor.EJBExceptionInterceptor.intercept(EJBExceptionInterceptor.java:31) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.kernel.reflect.proxy.ProxyEngine.invoke(ProxyEngine.java:77) at $Proxy33.persist(Unknown Source) at br.com.kinomaxx.kinosystem.CustomerTest.test(CustomerTest.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99) at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45) at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71) at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    Hibernate JIRA | 9 years ago | Raoni Fortes Normanton
    javax.ejb.EJBException: nested exception is: org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer
  2. 0

    My Customer class has two address (embedded), one must be validated, the other dont. When the address2 is null, the validation works. But when the empty instance is setted, the persist crashes. Validating by ClassValidator works fine. But when I call the em.persist() in service, the exception is throwed: javax.ejb.EJBException: nested exception is: org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:148) at org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:172) at org.hibernate.action.EntityIdentityInsertAction.preInsert(EntityIdentityInsertAction.java:119) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:42) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108) at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49) at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38) at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596) at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:213) at br.com.kinomaxx.kinosystem.dao.EntityManagerWrapperBean.persist(EntityManagerWrapperBean.java:52) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:45) at org.mycontainer.jpa.PersistenceContextInterceptor.intercept(PersistenceContextInterceptor.java:53) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.kernel.interceptors.NamingInjectInterceptor.intercept(NamingInjectInterceptor.java:48) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.kernel.interceptors.NamingInjectInterceptor.intercept(NamingInjectInterceptor.java:48) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.ejb.interceptor.EJBContextInterceptor.intercept(EJBContextInterceptor.java:55) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.ejb.transaction.RequiredTransactionHandler.intercept(RequiredTransactionHandler.java:38) at org.mycontainer.ejb.interceptor.TransactionInterceptor.intercept(TransactionInterceptor.java:52) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.ejb.interceptor.EJBExceptionInterceptor.intercept(EJBExceptionInterceptor.java:27) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.kernel.reflect.proxy.ProxyEngine.invoke(ProxyEngine.java:77) at $Proxy33.persist(Unknown Source) at br.com.kinomaxx.kinosystem.CustomerTest.test(CustomerTest.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99) at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45) at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71) at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) javax.ejb.EJBException: nested exception is: org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer at org.mycontainer.ejb.interceptor.EJBExceptionInterceptor.intercept(EJBExceptionInterceptor.java:31) at org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35) at org.mycontainer.kernel.reflect.proxy.ProxyEngine.invoke(ProxyEngine.java:77) at $Proxy33.persist(Unknown Source) at br.com.kinomaxx.kinosystem.CustomerTest.test(CustomerTest.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99) at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45) at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71) at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    Hibernate JIRA | 9 years ago | Raoni Fortes Normanton
    javax.ejb.EJBException: nested exception is: org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer

    Root Cause Analysis

    1. javax.ejb.EJBException

      nested exception is: org.hibernate.validator.InvalidStateException: validation failed for: br.com.kinomaxx.kinosystem.Customer

      at org.mycontainer.ejb.interceptor.EJBExceptionInterceptor.intercept()
    2. org.mycontainer.ejb
      EJBExceptionInterceptor.intercept
      1. org.mycontainer.ejb.interceptor.EJBExceptionInterceptor.intercept(EJBExceptionInterceptor.java:31)
      1 frame
    3. org.mycontainer.kernel
      ProxyEngine.invoke
      1. org.mycontainer.kernel.reflect.proxy.ProxyChainImpl.proceed(ProxyChainImpl.java:35)
      2. org.mycontainer.kernel.reflect.proxy.ProxyEngine.invoke(ProxyEngine.java:77)
      2 frames
    4. Unknown
      $Proxy33.persist
      1. $Proxy33.persist(Unknown Source)
      1 frame
    5. br.com.kinomaxx
      CustomerTest.test
      1. br.com.kinomaxx.kinosystem.CustomerTest.test(CustomerTest.java:50)
      1 frame
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    7. JUnit
      TestClassRunner.run
      1. org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
      2. org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
      3. org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
      4. org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
      5. org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
      6. org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
      7. org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
      8. org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
      9. org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
      10. org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
      10 frames
    8. JUnit4 Runner
      JUnit4TestReference.run
      1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
      1 frame
    9. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      5 frames