10 Replies Latest reply: Apr 16, 2012 6:30 PM by Bartosz Majsak RSS

    Problem after migrating to arquillian persistence 1.0.0.Alpha4

    mikie_s Newbie

      Hi!

       

      after migrating i have

      Caused by: Exception [EclipseLink-4011] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException

      Exception Description: Error preallocating sequence numbers.  The sequence table information is not complete.

      when i'm trying to save an entity

       

      environment:

          <properties>     

              <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>

              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>   

       

              <version.arquillian.core>1.0.0.Final</version.arquillian.core>

              <version.arquillian.persistence>1.0.0.Alpha4</version.arquillian.persistence>

              <version.arquillian.glassfish.embedded>1.0.0.Final-SNAPSHOT</version.arquillian.glassfish.embedded>

              <version.glassfish.embedded>3.1.2</version.glassfish.embedded>

              <version.hibernate.jpamodelgen>1.2.0.Final</version.hibernate.jpamodelgen>

              <version.junit>4.10</version.junit>

          </properties>

       

      arquillian.xml

          <extension qualifier="persistence">

              <property name="defaultDataSource">jdbc/javaee6</property>

              <property name="initStatement">set referential_integrity FALSE</property>

          </extension>

          <extension qualifier="persistence-dbunit">

              <property name="datatypeFactory">org.dbunit.ext.h2.H2DataTypeFactory</property>

          </extension>

       

      @Entity

      public class Employee{

       

          @Id @GeneratedValue    private int id;

       

          private String name;

      }

       

      I do em.persist(new EmployeeL("Employee")); in my test, wich annotated with @PersistenceTest and after

      FINE: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?          bind => [50, SEQ_GEN]

      FINE: SELECT SEQ_COUNT FROM SEQUENCE WHERE SEQ_NAME = ?   bind => [SEQ_GEN]

      exception is thrown

       

      there is no such exception on alpha3

       

      also i tried to change versions of other modules, but it aint help

        • 1. Re: Problem after migrating to arquillian persistence 1.0.0.Alpha4
          Bartosz Majsak Master

          Hi Mikie,

           

          have you tried with 1.0.0.CR3 glassfish container? What is the full stracktrace?

          • 2. Re: Problem after migrating to arquillian persistence 1.0.0.Alpha4
            mikie_s Newbie

            same result

             

            WARNING:

            Local Exception Stack:

            Exception [EclipseLink-4011] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException

            Exception Description: Error preallocating sequence numbers.  The sequence table information is not complete.

                      at org.eclipse.persistence.exceptions.DatabaseException.errorPreallocatingSequenceNumbers(DatabaseException.java:143)

                      at org.eclipse.persistence.sequencing.StandardSequence.getGeneratedVector(StandardSequence.java:73)

                      at org.eclipse.persistence.sequencing.DefaultSequence.getGeneratedVector(DefaultSequence.java:163)

                      at org.eclipse.persistence.sequencing.Sequence.getGeneratedVector(Sequence.java:257)

                      at org.eclipse.persistence.internal.sequencing.SequencingManager$Preallocation_Transaction_NoAccessor_State.getNextValue(SequencingManager.java:468)

                      at org.eclipse.persistence.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:1067)

                      at org.eclipse.persistence.internal.sequencing.ClientSessionSequencing.getNextValue(ClientSessionSequencing.java:70)

                      at org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:349)

                      at org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:308)

                      at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.assignSequenceNumber(UnitOfWorkImpl.java:465)

                      at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNotRegisteredNewObjectForPersist(UnitOfWorkImpl.java:4231)

                      at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:513)

                      at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4176)

                      at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:440)

                      at com.sun.enterprise.container.common.impl.EntityManagerWrapper.persist(EntityManagerWrapper.java:269)

                      at javaee6.jpa.lifecycle.LifecycleBean.saveEmployeeL(LifecycleBean.java:23)

                      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:597)

                      at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)

                      at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)

                      at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5388)

                      at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)

                      at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)

                      at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)

                      at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:42)

                      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:597)

                      at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)

                      at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)

                      at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)

                      at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:162)

                      at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:144)

                      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:597)

                      at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)

                      at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)

                      at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370)

                      at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5360)

                      at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5348)

                      at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:214)

                      at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)

                      at $Proxy139.saveEmployeeL(Unknown Source)

                      at javaee6.jpa.lifecycle.__EJB31_Generated__LifecycleBean__Intf____Bean__.saveEmployeeL(Unknown Source)

                      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:597)

                      at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)

                      at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

                      at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)

                      at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)

                      at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:111)

                      at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)

                      at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)

                      at org.jboss.weldee6.jpa.lifecycle.LifecycleBean$Proxy$_$$_Weld$Proxy$.saveEmployeeL(LifecycleBean$Proxy$_$$_Weld$Proxy$.java)

                      at javaee6.jpa.lifecycle.JarTest.saveEmployeeL(JarTest.java:45)

                      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:597)

                      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)

                      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

                      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)

                      at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:270)

                      at org.jboss.arquillian.container.test.impl.execution.LocalTestExecuter.execute(LocalTestExecuter.java:60)

                      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:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)

                      at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)

                      at org.jboss.arquillian.container.test.impl.execution.ContainerTestExecuter.execute(ContainerTestExecuter.java:38)

                      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:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

                      at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89)

                      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:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                      at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)

                      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:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                      at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)

                      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:597)

                      at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:90)

                      at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

                      at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

                      at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)

                      at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:263)

                      at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:226)

                      at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)

                      at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

                      at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240)

                      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)

                      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)

                      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)

                      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)

                      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)

                      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)

                      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)

                      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)

                      at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185)

                      at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)

                      at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

                      at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)

                      at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

                      at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)

                      at org.junit.runner.JUnitCore.run(JUnitCore.java:157)

                      at org.junit.runner.JUnitCore.run(JUnitCore.java:136)

                      at org.jboss.arquillian.junit.container.JUnitTestRunner.execute(JUnitTestRunner.java:65)

                      at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:160)

                      at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126)

                      at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90)

                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)

                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)

                      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)

                      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)

                      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

                      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

                      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)

                      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)

                      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)

                      at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)

                      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)

                      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)

                      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)

                      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)

                      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)

                      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

                      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

                      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

                      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

                      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

                      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

                      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

                      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

                      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

                      at java.lang.Thread.run(Thread.java:662)

            • 3. Re: Problem after migrating to arquillian persistence 1.0.0.Alpha4
              Bartosz Majsak Master

              That's interesting. Do you think you can share this project (or excerpt of it with the failing test) so I can work on this issue? GitHub would be perfect, but simple zip is also ok

              • 4. Re: Problem after migrating to arquillian persistence 1.0.0.Alpha4
                mikie_s Newbie

                yes, its a test project, but give me time to remove unnecessary code

                • 5. Re: Problem after migrating to arquillian persistence 1.0.0.Alpha4
                  mikie_s Newbie

                  and of course project from scratch doesn't make this exception

                  • 6. Re: Problem after migrating to arquillian persistence 1.0.0.Alpha4
                    Bartosz Majsak Master

                    Thanks! That would help me identifying the problem

                     

                    I have Glassfish Embedded profile in my integration test suite and quite similar test which is passing. However I'm using 3.1.1 version, and it just turned out that indeed on 3.1.2 it is failing. Would it be possible for you to switch to 3.1.1 until I get it running on 3.1.2?

                    • 7. Re: Problem after migrating to arquillian persistence 1.0.0.Alpha4
                      mikie_s Newbie

                      fortunately, my previous post is not true. it reproduced

                      here is an archive with small project

                       

                      i tried to use GF 3.1.1 but nothig have changed

                      • 8. Re: Problem after migrating to arquillian persistence 1.0.0.Alpha4
                        Bartosz Majsak Master

                        Thanks, I will have a look at it tomorrow latest.

                        • 9. Re: Problem after migrating to arquillian persistence 1.0.0.Alpha4
                          Bartosz Majsak Master

                          Ok, I know what's "wrong". And I have two "workarounds" for you But let's start from describing what is going on.

                           

                          I made few important changes in Alpha4 and your tests are affected by at least two of them:

                           

                          1. Cleanup is now performed before the test, meaning all tables in the database (including your sequence table) are cleaned. In Alpha3 cleanup was performed after the test by default.

                          -> First workaround - add @Cleanup(phase = TestExecutionPhase.AFTER) on the class level

                          -> Second workaround - change identity generation strategy from AUTO (default - in your case SEQUENCE) to IDENTITY -> @GeneratedValue(strategy = GenerationType.IDENTITY)

                           

                          2. By default DBUnit cleans all tables, you can change the behaviour to let's say using only those tables which are defined in your datasets (in your case none)

                          -> Third workaround - @Cleanup(strategy = CleanupStrategy.USED_ROWS_ONLY), but this is causing NPE at the moment You have earned "JIRA Hero" badge - I'm about to create the very first bug report for the next release. However it does not really make sense in your case to use this option, since you don't "use" any rows/data sets.

                           

                          This got me thinking that cleanup options should be also exposed in arquillian.xml to have them globally available and avoid setting them for each test class.

                           

                          Other thing is to support cleanup before the test when you are using sequence table. I need to figure out the best way to deal with that, having it as a property in arquillian.xml (such as "doNotCleanTables" ) is the last option for me (but might be the only one after second thought - you never know what kind of magic create-drop can do ).

                           

                          Thanks a lot for discovering this problems!

                          • 10. Re: Problem after migrating to arquillian persistence 1.0.0.Alpha4
                            Bartosz Majsak Master

                            Pushed bunch of changes which will make your life easier with Alpha5 which should be released within next few days. Many thanks for ultra fast feedback!