4 Replies Latest reply on Jun 2, 2011 9:29 AM by Mader Levap

    Integration test failing due to Hibernate Validator - unexpected!

    Troy Sellers Newbie

      Hi,


      I am trying to build an integration test that sets values in an object then calls the Submit action which validates, processes and persists if processing is sucessful.
      The processing will either return an approved or rejected decision on the values in this object.


      When I populate the object in the test with values that are known to work in the application I get the following stack trace that seems to suggest a hibernate validator has failed.  This is being swallowed by a SeamPhaseListener and I can't seem to get it to tell me which field this validation has failed on?!


      Does anyone know how I can get this to report to me exactly what field has failed the validation?  From what I can tell this validation is failing on processing the object 'er', i am assuming this is the case as it is the last insert statement before the stack trace.  There is only a single validation on this, @NotNull on the totalEstimatedRevenue field and this is definitely not null at this stage. 


      Cheers,
      Troy



      INFO  [au.com.optus.directConnect.session.EmailActions] Simple CER Approved - Email to Initiator
      DEBUG [org.jboss.seam.jsf.SeamPhaseListener] committing transaction after phase: INVOKE_APPLICATION 5
      Hibernate: insert into CAMAuthorisation (authorisationDate, authorisationDecision, estimatedCapitalExpenditure, evaluatedBy, justification, id) values (?, ?, ?, ?, ?, ?)
      Hibernate: insert into CustomerDetails (borisBuildingCategory_id, borisBuildingNumber, buildingName, citySuburb, floorNumber, name, postcode, state_id, streetName, streetNumber, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
      Hibernate: insert into er (dataE1sEstimatedRevenue, dataE1sNoE1s, ethernetEstimatedRevenue, futureATMSize, futureBroadlinkSize, futureDataSize, futureEthernetSize, futureVoiceSize, highSpeedATMEstimatedRevenue, highSpeedATMType_id, highSpeedBLER, highSpeedBroadlinkType_id, totalEstimatedRevenue, voiceMLER, voiceMultiLineNoE1s, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
      WARN  [org.jboss.seam.jsf.SeamPhaseListener] uncaught exception, passing to exception handler
      java.lang.IllegalStateException: Could not commit transaction
           at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:626)
           at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:605)
           at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:343)
           at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:243)
           at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:194)
           at org.jboss.seam.mock.AbstractSeamTest$Request.invokeApplicationPhase(AbstractSeamTest.java:659)
           at org.jboss.seam.mock.AbstractSeamTest$Request.emulateJsfLifecycle(AbstractSeamTest.java:595)
           at org.jboss.seam.mock.AbstractSeamTest$Request.access$300(AbstractSeamTest.java:177)
           at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:497)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.jboss.seam.mock.AbstractSeamTest$Request.run(AbstractSeamTest.java:491)
           at au.com.optus.directConnect.test.integration.TestSimpleCerProcessing.testSimpleCerProcessing(TestSimpleCerProcessing.java:24)
           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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
           at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
           at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
           at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
           at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
           at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
           at org.testng.TestRunner.runWorkers(TestRunner.java:712)
           at org.testng.TestRunner.privateRun(TestRunner.java:582)
           at org.testng.TestRunner.run(TestRunner.java:477)
           at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
           at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
           at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
           at org.testng.SuiteRunner.run(SuiteRunner.java:198)
           at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
           at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
           at org.testng.TestNG.run(TestNG.java:708)
           at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)
           at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141)
           at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
           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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
           at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
      Caused by: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state
           at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1401)
           at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
           at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
           at org.jboss.embedded.adapters.LocalOnlyUserTransaction.commit(LocalOnlyUserTransaction.java:96)
           at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52)
           at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:614)
           ... 53 more
      Caused by: javax.persistence.PersistenceException: org.hibernate.validator.InvalidStateException: validation failed for: au.com.optus.directConnect.entity.ConnectionEvaluationRequest
           at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:535)
           at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
           at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:250)
           at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
           at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
           at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1389)
           ... 58 more
      Caused by: org.hibernate.validator.InvalidStateException: validation failed for: au.com.optus.directConnect.entity.ConnectionEvaluationRequest
           at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:148)
           at org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:172)
           at org.hibernate.action.EntityInsertAction.preInsert(EntityInsertAction.java:160)
           at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:53)
           at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
           at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
           at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
           at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
           at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
           at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
           at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
           at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:523)
           ... 63 more
      ERROR [org.jboss.seam.jsf.SeamPhaseListener] swallowing exception
      java.lang.IllegalStateException: Could not commit transaction
           at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:626)
           at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:605)
           at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:343)
           at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:243)
           at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:194)
           at org.jboss.seam.mock.AbstractSeamTest$Request.invokeApplicationPhase(AbstractSeamTest.java:659)
           at org.jboss.seam.mock.AbstractSeamTest$Request.emulateJsfLifecycle(AbstractSeamTest.java:595)
           at org.jboss.seam.mock.AbstractSeamTest$Request.access$300(AbstractSeamTest.java:177)
           at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:497)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.jboss.seam.mock.AbstractSeamTest$Request.run(AbstractSeamTest.java:491)
           at au.com.optus.directConnect.test.integration.TestSimpleCerProcessing.testSimpleCerProcessing(TestSimpleCerProcessing.java:24)
           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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
           at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
           at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
           at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
           at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
           at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
           at org.testng.TestRunner.runWorkers(TestRunner.java:712)
           at org.testng.TestRunner.privateRun(TestRunner.java:582)
           at org.testng.TestRunner.run(TestRunner.java:477)
           at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
           at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
           at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
           at org.testng.SuiteRunner.run(SuiteRunner.java:198)
           at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
           at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
           at org.testng.TestNG.run(TestNG.java:708)
           at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)
           at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141)
           at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
           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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
           at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
      Caused by: javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state
           at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1401)
           at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
           at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
           at org.jboss.embedded.adapters.LocalOnlyUserTransaction.commit(LocalOnlyUserTransaction.java:96)
           at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52)
           at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:614)
           ... 53 more
      Caused by: javax.persistence.PersistenceException: org.hibernate.validator.InvalidStateException: validation failed for: au.com.optus.directConnect.entity.ConnectionEvaluationRequest
           at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:535)
           at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
           at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:250)
           at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
           at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
           at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1389)
           ... 58 more
      Caused by: org.hibernate.validator.InvalidStateException: validation failed for: au.com.optus.directConnect.entity.ConnectionEvaluationRequest
           at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:148)
           at org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:172)
           at org.hibernate.action.EntityInsertAction.preInsert(EntityInsertAction.java:160)
           at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:53)
           at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
           at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
           at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
           at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
           at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
           at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
           at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
           at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:523)