3 Replies Latest reply on Sep 26, 2007 9:36 AM by aj1m aj1m

    problem to add data with jboss to postgresql

    aj1m aj1m Newbie

      hi;
      i a, using jboss 4.0.5 and postgresql, and i did a function that add to my base but the problem is in the first time when i try to add i get this error:

      2007-09-24 18:43:15,951 DEBUG [org.hibernate.util.JDBCExceptionReporter] Could not execute JDBC batch update [insert into Contact (address, city, firstname, lastname, mobile, phone, zipCode, id) values (?, ?, ?, ?, ?, ?, ?, ?)]
      java.sql.BatchUpdateException: L'élément du batch 0 insert into Contact (address, city, firstname, lastname, mobile, phone, zipCode, id) values (8, 8, a, 8, 8, 8, 8, 10) a été annulé. Appeler getNextException pour en connaître la cause.
       at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2530)
       at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1317)
       at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:350)
       at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statem
      
      


      the thing that i cant understood that this error only happen in the first add but after the first add when i try to add data it work correctly

        • 1. Re: problem to add data with jboss to postgresql
          aj1m aj1m Newbie

          all the error is :

          2007-09-24 11:38:46,704 DEBUG [org.hibernate.util.JDBCExceptionReporter] Could not execute JDBC batch update [insert into Contact (address, city, firstname, lastname, mobile, phone, zipCode, id) values (?, ?, ?, ?, ?, ?, ?, ?)]
          java.sql.BatchUpdateException: L'élément du batch 0 insert into Contact (address, city, firstname, lastname, mobile, phone, zipCode, id) values (montplaisir, tunis, thyna, soft, 24, 71, 1002, 3) a été annulé. Appeler getNextException pour en connaître la cause.
           at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2530)
           at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1317)
           at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:350)
           at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2592)
           at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:519)
           at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
           at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
           at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
           at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
           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:515)
           at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
           at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
           at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
           at org.jboss.tm.TxManager.commit(TxManager.java:240)
           at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
           at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
           at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
           at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211)
           at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
           at $Proxy66.addContact(Unknown Source)
           at com.labosun.cj.web.servlet.AddContactExecuteServlet.doPost(AddContactExecuteServlet.java:31)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
           at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
           at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
           at java.lang.Thread.run(Thread.java:619)
          2007-09-24 11:38:46,714 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: null
          2007-09-24 11:38:46,744 ERROR [org.hibernate.util.JDBCExceptionReporter] L'élément du batch 0 insert into Contact (address, city, firstname, lastname, mobile, phone, zipCode, id) values (montplaisir, tunis, thyna, soft, 24, 71, 1002, 3) a été annulé. Appeler getNextException pour en connaître la cause.
          2007-09-24 11:38:46,754 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 23505
          2007-09-24 11:38:46,754 ERROR [org.hibernate.util.JDBCExceptionReporter] ERROR: duplicate key violates unique constraint "contact_pkey"
          2007-09-24 11:38:46,764 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] Could not synchronize database state with session
          org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
           at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
           at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
           at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
           at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
           at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
           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:515)
           at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
           at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
           at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
           at org.jboss.tm.TxManager.commit(TxManager.java:240)
           at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
           at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
           at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
           at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211)
           at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
           at $Proxy66.addContact(Unknown Source)
           at com.labosun.cj.web.servlet.AddContactExecuteServlet.doPost(AddContactExecuteServlet.java:31)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
           at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
           at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
           at java.lang.Thread.run(Thread.java:619)
          Caused by: java.sql.BatchUpdateException: L'élément du batch 0 insert into Contact (address, city, firstname, lastname, mobile, phone, zipCode, id) values (montplaisir, tunis, thyna, soft, 24, 71, 1002, 3) a été annulé. Appeler getNextException pour en connaître la cause.
           at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2530)
           at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1317)
           at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:350)
           at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2592)
           at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:519)
           at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
           at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
           ... 51 more
          2007-09-24 11:38:46,814 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
          2007-09-24 11:38:46,814 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
          2007-09-24 11:38:46,814 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] mark transaction for rollback
          2007-09-24 11:38:46,854 DEBUG [org.jboss.ejb3.entity.ManagedEntityManagerFactory] ************** closing entity managersession **************
          2007-09-24 11:38:46,934 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/projetweb].[addContactExecuteServlet]] Servlet.service() for servlet addContactExecuteServlet threw exception
          java.lang.RuntimeException: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=AJ1M/15, BranchQual=, localId=15] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.persistence.EntityExistsException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update)
          
          
          



          • 2. Re: problem to add data with jboss to postgresql
            Wolfgang Koppenberger Newbie

            Take a look at the stacktrace:

            2007-09-24 11:38:46,754 ERROR [org.hibernate.util.JDBCExceptionReporter] ERROR: duplicate key violat es unique constraint "contact_pkey"
            


            the problem in in your application....

            • 3. Re: problem to add data with jboss to postgresql
              aj1m aj1m Newbie

              so why it work good; only it have a problem in the first try to add