-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Database hangs after a Mysql exception
PostPosted: Fri Aug 29, 2008 3:52 am 
Newbie

Joined: Thu Aug 07, 2008 12:03 pm
Posts: 16
Hi!
I’m having an estrange problem I don’t know how to solve.

To make a long story short: The database hangs after the underlying JDBC controller (in my case mysql-connector-java-5.1.5) throws an exception. For instance, if I try to update a record violating an unique constrain, Mysql will throw and exception that get’s propagated to my application… wonderful. But if I try any other operation after this, the application get’s blocked and after a while a get a “Lock wait timeout exceeded” exception.

It seems that somehow, the transaction that produces the Mysql exception blocks the database somehow. Even if I try to access the database with any other software (Toad, etc) these applications get blocked too!

If I don’t execute any operation that can produce a Mysql integrity exception, the application works just fine.


Let me explain the problem in detail.

I’m using TOMCAT, JOTM, HIBERNATE, SPRING (JTA). This is my spring configuration:

Code:
   <!-- data source pool - Local database -->
   <bean id="localDataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource">
     <property name="transactionManager" ref="jotm"/>
     <property name="dataSource">
      <bean class="org.enhydra.jdbc.standard.StandardXADataSource">
        <property name="driverName" value="com.mysql.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://localhost:3306/test?autoReconnect=true"/>
        <property name="maxCon" value="50"/>
        <property name="user" value="foo"/>
        <property name="password" value="bar"/>
      </bean>    
     </property>
     <property name="user" value="foo"/>   
     <property name="password" value="bar"/>
     <property name="maxSize" value="4"/>
   </bean>
   
   <!-- settings previously specified in the persistence.xml JPA configuration file are now defined with the
        LocalContainerEntityManagerFactoryBean configuration --> 
   <bean id="localEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">   
      <!-- reference to the XA datasource -->
      <property name="dataSource" ref="localDataSource"/>
      <!-- Reference the PersistenceUnit, this is very important. The DAOs will reference the UnitName to know what datasource to use -->
       <property name="persistenceUnitName" value="localPU"/>
      <!-- specify a custom "persistenceXmlLocation" on your LocalContainerEntityManagerFactoryBean  definition, e.g. "META-INF/my-persistence.xml", and only include a descriptor with that name in your application jar files. -->
      <property name="persistenceXmlLocation" value="classpath:/META-INF/persistence.xml" />
     <!-- specify Hibernate as the the JPA provider -->
     <property name="jpaVendorAdapter">
       <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
         <property name="showSql" value="false"/><!-- Don't show sql here. We show it in the LOG4J properties -->
         <property name="generateDdl" value="false"/>
         <property name="database" value="${com.cinerent.starticketmediacenter.db.local.database}"/>
         <property name="databasePlatform" value="${com.cinerent.starticketmediacenter.db.local.dialect}"/>
       </bean>
     </property>
     <!-- configure Hibernate to participate in JTA transactions using the JOTM transaction manager and
          specify further Hibernate specific configuration properties -->
     <property name="jpaPropertyMap">
       <map>
         <!-- Definition of classes and properties that this SessionFactory can map -->
         <entry key="hibernate.ejb.cfgfile" value="xmlhibenateproperties.properties"/>         
       </map>          
     </property>
     <!-- specify that the Hibernate JPA dialect should be used, probably not necessary since
          HibernateJpaVendorAdapter will most likely set this property -->
     <property name="jpaDialect">
       <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
     </property>
     <!-- custom implementation to enrich the PersistenceUnitInfo read from the persistence.xml
          JPA configuration file with the JTA datasource. specifying the JTA datasource directly in
          the Spring configuration file has the advantage that we can use a direct reference to the
          datasource instead of using a JNDI name as requied by the jta-data-source setting in the
          persistence.xml file -->
     <property name="persistenceUnitPostProcessors">
       <bean class="com.cinerent.starticketmediacenter.server.utils.jpa.JtaPersistenceUnitPostProcessor">
         <property name="jtaDataSource" ref="localDataSource"/>      
       </bean>
     </property>
   </bean>




I have some Hibernate properties in the xmlhibenateproperties.properties file:

Code:
<hibernate-configuration>
   <session-factory>
        <!-- properties -->
        <property name="hibernate.archive.autodetection"></property>
      <!-- Automatically validate or export schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly. -->         
        <property name="hibernate.hbm2ddl.auto">validate</property>
      <!-- Write all SQL statements to console. This is an alternative to setting the log category org.hibernate.SQL  to debug. -->
      <!-- If you set DEBUG and this to TRUE, you will see the SQL duplicated! -->
        <property name="hibernate.show_sql">true</property>
      <!-- Pretty print the SQL in the log and console. -->   
        <property name="hibernate.format_sql">true</property>
      <!-- If turned on, Hibernate will generate comments inside the SQL, for easier debugging, defaults to false. -->
        <property name="hibernate.use_sql_comments">true</property>
      <!-- If enabled, Hibernate will collect statistics useful for performance tuning. -->
        <property name="hibernate.generate_statistics">false</property>
      <!-- Definition of classes that this SessionFactory can map -->

        <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JOTMTransactionManagerLookup</property>
        <property name="hibernate.transaction.flush_before_completion">true</property>
        <property name="hibernate.transaction.auto_close_session">false</property>
        <property name="hibernate.current_session_context_class">jta</property>
        <property name="hibernate.connection.release_mode">auto</property>

      <!-- Sometimes, i get exceptions of connection close from
          mysql. -->
      <property name="hibernate.autoReconnect">true</property>
      <property name="hibernate.autoReconnectForPools">true</property>
      <property name="hibernate.minEvictableIdleTimeMillis">60000</property>
      <property name="hibernate.removeAbandonedTimeout">60</property>
   
      <!-- Chache, to be configured properly... -->
      <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
      <property name="hibernate.cache.use_query_cache">true</property>
   
      <!-- mapped classes (annotated)-->
      <mapping class="com.blabla.model.impl.User" />
      <mapping class="com.blabla.model.impl.Group" />
      <mapping class="com.blabla.model.impl.Application" />
   </session-factory>
</hibernate-configuration>



I have several entity objects I use annotation instead of Hibernate XML configuration files. Here is one of them that produces the problem:

Code:
@NamedQueries({
   @NamedQuery(name="User.findAll",
            query="SELECT u FROM User u ORDER BY u.name"),
   @NamedQuery(name="User.findByName",
            query="SELECT u FROM User u WHERE u.username like :name"),
   @NamedQuery(name="User.exists",
            query="SELECT u FROM User u WHERE u.username like :name and u.password = :password"),
   @NamedQuery(name="User.count",
            query="SELECT COUNT(u) FROM User u")
})   
@Entity
@Table(name="USERS")
public class User implements IUser{
   @Transient //Not going to D.B.
   private static final long serialVersionUID = 1L;
   /**
    * Identifier.
    */
   @Id @GeneratedValue(strategy=GenerationType.AUTO)
   private Long id;
   /**
    * User Name. Cannot be null in database.
    */
   @Column(nullable=false, length=255)
   private String name;
   /**
    * Username. Cannot be null in database.
    */
   @Column(nullable=false, length=50, unique=true)
   private String username;
   /**
    * User password. Cannot be null.
    * It's a special type that allows us to encrypt its content
    */
   @Column(nullable=false, length=50)
   @org.hibernate.annotations.Type(
         type = "com.cinerent.starticketmediacenter.server.model.utils.PasswordType"
   )
   private IPassword password;
   /**
    * Email account. Cannot be null
    */
   @Column(nullable=false, length=50, unique=true)
   private String email;
   /**
    * Created value. Inserted just the first time. Cannot be null.
    */
   @Temporal(TemporalType.TIMESTAMP)
   @Column(updatable=false, insertable=true, nullable=false)
   private Date created;
   
   /**
    * Modified date updated automatically by MYSQL database.
    * It's a TIMESTAMP column
    * http://dev.mysql.com/doc/refman/5.0/en/timestamp.html
    */
   @Temporal(TemporalType.TIMESTAMP)
   @Column(updatable=false, insertable=false, nullable=false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
   //Always generated by database, not by hibernate.
   @org.hibernate.annotations.Generated(
         org.hibernate.annotations.GenerationTime.ALWAYS
   )
   private Date lastModified;

   /**
    * The version property will be mapped to
    * the OPTLOCK column, and the entity manager
    * will use it to detect conflicting updates
    */
   @Version
   @Column(name="OPTLOCK", nullable=false, columnDefinition = "integer DEFAULT 0")   
   private Integer version=0;

   
   //... Getters and setters. Not annotated
   //... equal, hash, etc methods..
}




Here a DAO, the one that performs the update and can produce the nasty lock:

Code:
@Repository("UserDAO")
@Transactional(propagation=Propagation.SUPPORTS, readOnly=true)
public class UserDAO implements IUserDAO {

   @PersistenceContext(unitName="localPU")
   private EntityManager entityManager;

   /**
    * Default DAO constructor.
    */
   public UserDAO(){
      super();
   }

   @Transactional(propagation=Propagation.REQUIRED, readOnly=false)
   public void updateUser(final IUser user){
      final IUser dbuser = this.find(user.getId());
      if(dbuser!=null){
         dbuser.setEmail(user.getEmail());
         dbuser.setName(user.getName());
         if(user.getPassword()!=null){
            dbuser.setPassword(user.getPassword());
         }
      }
   }   

   @Transactional(propagation=Propagation.SUPPORTS, readOnly=true)
   public IUser find(final Long id){
      return entityManager.find(User.class, id);
   }





I use the latest version of Spring, JOTM, and Hibernate.


The first exception I get when I try to violate a constrain is something like this:

Code:

2008-08-29 09:21:28,488 DEBUG [http-8443-1] about to open ResultSet (open ResultSets: 0, globally: 0)  [org.hibernate.jdbc.AbstractBatcher.logOpenResults(AbstractBatcher.java:382)]
2008-08-29 09:21:28,488 DEBUG [http-8443-1] result row: EntityKey[com.cinerent.starticketmediacenter.server.model.impl.User#27]  [org.hibernate.loader.Loader.getRow(Loader.java:1173)]
2008-08-29 09:21:28,488 DEBUG [http-8443-1] about to close ResultSet (open ResultSets: 1, globally: 1)  [org.hibernate.jdbc.AbstractBatcher.logCloseResults(AbstractBatcher.java:389)]
2008-08-29 09:21:28,488 DEBUG [http-8443-1] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)  [org.hibernate.jdbc.AbstractBatcher.logClosePreparedStatement(AbstractBatcher.java:374)]
2008-08-29 09:21:28,488 DEBUG [http-8443-1] aggressively releasing JDBC connection  [org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:404)]
2008-08-29 09:21:28,488 DEBUG [http-8443-1] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]  [org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:441)]
2008-08-29 09:21:28,488 DEBUG [http-8443-1] resolving associations for [com.cinerent.starticketmediacenter.server.model.impl.User#27]  [org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:111)]
2008-08-29 09:21:28,488 DEBUG [http-8443-1] done materializing entity [com.cinerent.starticketmediacenter.server.model.impl.User#27]  [org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:209)]
2008-08-29 09:21:28,503 DEBUG [http-8443-1] initializing non-lazy collections  [org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:837)]
2008-08-29 09:21:28,503 DEBUG [http-8443-1] done entity load  [org.hibernate.loader.Loader.loadEntity(Loader.java:1883)]
2008-08-29 09:21:28,503 DEBUG [http-8443-1] processing flush-time cascades  [org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:111)]
2008-08-29 09:21:28,503 DEBUG [http-8443-1] dirty checking collections  [org.hibernate.event.def.AbstractFlushingEventListener.prepareCollectionFlushes(AbstractFlushingEventListener.java:154)]
2008-08-29 09:21:28,519 DEBUG [http-8443-1] Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects  [org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:85)]
2008-08-29 09:21:28,519 DEBUG [http-8443-1] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections  [org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:91)]
2008-08-29 09:21:28,519 DEBUG [http-8443-1] listing entities:  [org.hibernate.pretty.Printer.toString(Printer.java:83)]
2008-08-29 09:21:28,519 DEBUG [http-8443-1] com.cinerent.starticketmediacenter.server.model.impl.User{id=27, username=g, lastModified=2008-08-29 09:02:38, email=c@starticket.ch, created=2008-07-25 00:00:00, name=Gamona, password=õYŠQ—?Ì»ñÍIàÑvà, version=13}  [org.hibernate.pretty.Printer.toString(Printer.java:90)]
2008-08-29 09:21:28,519 DEBUG [http-8443-1] Pre-invalidating space [USERS]  [org.hibernate.cache.UpdateTimestampsCache.preinvalidate(UpdateTimestampsCache.java:50)]
2008-08-29 09:21:28,534 DEBUG [http-8443-1] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)  [org.hibernate.jdbc.AbstractBatcher.logOpenPreparedStatement(AbstractBatcher.java:366)]
2008-08-29 09:21:28,550 DEBUG [http-8443-1] opening JDBC connection  [org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:421)]
2008-08-29 09:21:28,550 DEBUG [http-8443-1]
    /* update
        com.cinerent.starticketmediacenter.server.model.impl.User */ update
            USERS
        set
            email=?,
            name=?,
            password=?,
            username=?,
            OPTLOCK=?
        where
            id=?  [org.hibernate.jdbc.AbstractBatcher.log(AbstractBatcher.java:401)]
2008-08-29 09:21:28,550 DEBUG [http-8443-1] Executing batch size: 1  [org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:44)]
2008-08-29 09:21:28,566 DEBUG [http-8443-1] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)  [org.hibernate.jdbc.AbstractBatcher.logClosePreparedStatement(AbstractBatcher.java:374)]
2008-08-29 09:21:28,566 DEBUG [http-8443-1] skipping aggressive-release due to flush cycle  [org.hibernate.jdbc.ConnectionManager.afterStatement(ConnectionManager.java:272)]
2008-08-29 09:21:28,581 DEBUG [http-8443-1] Could not execute JDBC batch update [/* update com.cinerent.starticketmediacenter.server.model.impl.User */ update USERS set email=?, name=?, password=?, username=?, OPTLOCK=? where id=?]  [org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:69)]
java.sql.BatchUpdateException: Duplicate entry 'c@starticket.ch' for key 'email'
   at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1669)
   at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1085)
   at org.enhydra.jdbc.core.CorePreparedStatement.executeBatch(CorePreparedStatement.java:410)
   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
   at org.hibernate.persister.entity.AbstractEntityPersister.processGeneratedProperties(AbstractEntityPersister.java:3698)
   at org.hibernate.persister.entity.AbstractEntityPersister.processUpdateGeneratedProperties(AbstractEntityPersister.java:3687)
   at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:128)
   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:168)
   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)
   at org.objectweb.jotm.SubCoordinator.doBeforeCompletion(SubCoordinator.java:1487)
   at org.objectweb.jotm.SubCoordinator.commit_one_phase(SubCoordinator.java:416)
   at org.objectweb.jotm.TransactionImpl.commit(TransactionImpl.java:239)
   at org.objectweb.jotm.Current.commit(Current.java:488)
   at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1028)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:678)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy40.updateUser(Unknown Source)
   at com.cinerent.starticketmediacenter.server.rpccontrollers.UserDataController.updateUser(UserDataController.java:168)
   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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy43.updateUser(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 com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
   at com.cinerent.starticketmediacenter.server.utils.annotations.GwtRpcEndPointHandlerAdapter.processCall(GwtRpcEndPointHandlerAdapter.java:97)
   at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:85)
   at com.cinerent.starticketmediacenter.server.utils.annotations.GwtRpcEndPointHandlerAdapter.handle(GwtRpcEndPointHandlerAdapter.java:53)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
   at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
   at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:173)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:271)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.concurrent.ConcurrentSessionFilter.doFilterHttp(ConcurrentSessionFilter.java:99)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.securechannel.ChannelProcessingFilter.doFilterHttp(ChannelProcessingFilter.java:116)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
   at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
   at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Thread.java:619)
2008-08-29 09:21:28,581  WARN [http-8443-1] SQL Error: 1062, SQLState: 23000  [org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:77)]
2008-08-29 09:21:28,581 ERROR [http-8443-1] Duplicate entry 'c@starticket.ch' for key 'email'  [org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:78)]
2008-08-29 09:21:28,597 ERROR [http-8443-1] Could not synchronize database state with session  [org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:301)]






If I try to do now any other operation (or the same) mysql hangs for a while. Eventually it throws an execption, here the details:

Code:
2008-08-29 09:21:33,050 DEBUG [http-8443-1] Looking for a JTA transaction to join  [org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:458)]
2008-08-29 09:21:33,050 DEBUG [http-8443-1] successfully registered Synchronization  [org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:176)]
2008-08-29 09:21:33,050 DEBUG [http-8443-1] loading entity: [com.cinerent.starticketmediacenter.server.model.impl.User#27]  [org.hibernate.loader.Loader.loadEntity(Loader.java:1852)]
2008-08-29 09:21:33,050 DEBUG [http-8443-1] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)  [org.hibernate.jdbc.AbstractBatcher.logOpenPreparedStatement(AbstractBatcher.java:366)]
2008-08-29 09:21:33,050 DEBUG [http-8443-1] opening JDBC connection  [org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:421)]
2008-08-29 09:21:33,050 DEBUG [http-8443-1]
    /* load com.cinerent.starticketmediacenter.server.model.impl.User */ select
        user0_.id as id2_0_,
        user0_.created as created2_0_,
        user0_.email as email2_0_,
        user0_.lastModified as lastModi4_2_0_,
        user0_.name as name2_0_,
        user0_.password as password2_0_,
        user0_.username as username2_0_,
        user0_.OPTLOCK as OPTLOCK2_0_
    from
        USERS user0_
    where
        user0_.id=?  [org.hibernate.jdbc.AbstractBatcher.log(AbstractBatcher.java:401)]
2008-08-29 09:21:33,066 DEBUG [http-8443-1] about to open ResultSet (open ResultSets: 0, globally: 0)  [org.hibernate.jdbc.AbstractBatcher.logOpenResults(AbstractBatcher.java:382)]
2008-08-29 09:21:33,066 DEBUG [http-8443-1] result row: EntityKey[com.cinerent.starticketmediacenter.server.model.impl.User#27]  [org.hibernate.loader.Loader.getRow(Loader.java:1173)]
2008-08-29 09:21:33,066 DEBUG [http-8443-1] about to close ResultSet (open ResultSets: 1, globally: 1)  [org.hibernate.jdbc.AbstractBatcher.logCloseResults(AbstractBatcher.java:389)]
2008-08-29 09:21:33,081 DEBUG [http-8443-1] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)  [org.hibernate.jdbc.AbstractBatcher.logClosePreparedStatement(AbstractBatcher.java:374)]
2008-08-29 09:21:33,113 DEBUG [http-8443-1] aggressively releasing JDBC connection  [org.hibernate.jdbc.ConnectionManager.aggressiveRelease(ConnectionManager.java:404)]
2008-08-29 09:21:33,113 DEBUG [http-8443-1] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]  [org.hibernate.jdbc.ConnectionManager.closeConnection(ConnectionManager.java:441)]
2008-08-29 09:21:33,113 DEBUG [http-8443-1] resolving associations for [com.cinerent.starticketmediacenter.server.model.impl.User#27]  [org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:111)]
2008-08-29 09:21:33,113 DEBUG [http-8443-1] done materializing entity [com.cinerent.starticketmediacenter.server.model.impl.User#27]  [org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:209)]
2008-08-29 09:21:33,113 DEBUG [http-8443-1] initializing non-lazy collections  [org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:837)]
2008-08-29 09:21:33,113 DEBUG [http-8443-1] done entity load  [org.hibernate.loader.Loader.loadEntity(Loader.java:1883)]
2008-08-29 09:21:33,128 DEBUG [http-8443-1] processing flush-time cascades  [org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:111)]
2008-08-29 09:21:33,128 DEBUG [http-8443-1] dirty checking collections  [org.hibernate.event.def.AbstractFlushingEventListener.prepareCollectionFlushes(AbstractFlushingEventListener.java:154)]
2008-08-29 09:21:33,128 DEBUG [http-8443-1] Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects  [org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:85)]
2008-08-29 09:21:33,128 DEBUG [http-8443-1] Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections  [org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:91)]
2008-08-29 09:21:33,128 DEBUG [http-8443-1] listing entities:  [org.hibernate.pretty.Printer.toString(Printer.java:83)]
2008-08-29 09:21:33,128 DEBUG [http-8443-1] com.cinerent.starticketmediacenter.server.model.impl.User{id=27, username=g, lastModified=2008-08-29 09:02:38, email=c@starticket.ch, created=2008-07-25 00:00:00, name=Gamona, password=õYŠQ—?Ì»ñÍIàÑvà, version=13}  [org.hibernate.pretty.Printer.toString(Printer.java:90)]
2008-08-29 09:21:33,128 DEBUG [http-8443-1] Pre-invalidating space [USERS]  [org.hibernate.cache.UpdateTimestampsCache.preinvalidate(UpdateTimestampsCache.java:50)]
2008-08-29 09:21:33,128 DEBUG [http-8443-1] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)  [org.hibernate.jdbc.AbstractBatcher.logOpenPreparedStatement(AbstractBatcher.java:366)]
2008-08-29 09:21:33,128 DEBUG [http-8443-1] opening JDBC connection  [org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:421)]
2008-08-29 09:21:33,253 DEBUG [http-8443-1]
    /* update
        com.cinerent.starticketmediacenter.server.model.impl.User */ update
            USERS
        set
            email=?,
            name=?,
            password=?,
            username=?,
            OPTLOCK=?
        where
            id=?  [org.hibernate.jdbc.AbstractBatcher.log(AbstractBatcher.java:401)]





********* here the application blocks for about 1 or 2 minutes **********


2008-08-29 09:21:33,253 DEBUG [http-8443-1] Executing batch size: 1  [org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:44)]
2008-08-29 09:22:24,769 DEBUG [http-8443-1] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)  [org.hibernate.jdbc.AbstractBatcher.logClosePreparedStatement(AbstractBatcher.java:374)]
2008-08-29 09:22:24,769 DEBUG [http-8443-1] skipping aggressive-release due to flush cycle  [org.hibernate.jdbc.ConnectionManager.afterStatement(ConnectionManager.java:272)]
2008-08-29 09:22:24,769 DEBUG [http-8443-1] Could not execute JDBC batch update [/* update com.cinerent.starticketmediacenter.server.model.impl.User */ update USERS set email=?, name=?, password=?, username=?, OPTLOCK=? where id=?]  [org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:69)]
java.sql.BatchUpdateException: Lock wait timeout exceeded; try restarting transaction
   at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1669)
   at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1085)
   at org.enhydra.jdbc.core.CorePreparedStatement.executeBatch(CorePreparedStatement.java:410)
   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
   at org.hibernate.persister.entity.AbstractEntityPersister.processGeneratedProperties(AbstractEntityPersister.java:3698)
   at org.hibernate.persister.entity.AbstractEntityPersister.processUpdateGeneratedProperties(AbstractEntityPersister.java:3687)
   at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:128)
   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:168)
   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)
   at org.objectweb.jotm.SubCoordinator.doBeforeCompletion(SubCoordinator.java:1487)
   at org.objectweb.jotm.SubCoordinator.commit_one_phase(SubCoordinator.java:416)
   at org.objectweb.jotm.TransactionImpl.commit(TransactionImpl.java:239)
   at org.objectweb.jotm.Current.commit(Current.java:488)
   at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1028)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:678)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy40.updateUser(Unknown Source)
   at com.cinerent.starticketmediacenter.server.rpccontrollers.UserDataController.updateUser(UserDataController.java:168)
   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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy43.updateUser(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 com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
   at com.cinerent.starticketmediacenter.server.utils.annotations.GwtRpcEndPointHandlerAdapter.processCall(GwtRpcEndPointHandlerAdapter.java:97)
   at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:85)
   at com.cinerent.starticketmediacenter.server.utils.annotations.GwtRpcEndPointHandlerAdapter.handle(GwtRpcEndPointHandlerAdapter.java:53)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
   at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
   at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:173)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:271)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.concurrent.ConcurrentSessionFilter.doFilterHttp(ConcurrentSessionFilter.java:99)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.securechannel.ChannelProcessingFilter.doFilterHttp(ChannelProcessingFilter.java:116)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
   at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
   at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Thread.java:619)
2008-08-29 09:22:24,800  WARN [http-8443-1] SQL Error: 1205, SQLState: 41000  [org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:77)]
2008-08-29 09:22:24,800 ERROR [http-8443-1] Lock wait timeout exceeded; try restarting transaction  [org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:78)]
2008-08-29 09:22:24,800 ERROR [http-8443-1] Could not synchronize database state with session  [org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:301)]
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
   at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
   at org.hibernate.persister.entity.AbstractEntityPersister.processGeneratedProperties(AbstractEntityPersister.java:3698)
   at org.hibernate.persister.entity.AbstractEntityPersister.processUpdateGeneratedProperties(AbstractEntityPersister.java:3687)
   at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:128)
   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:168)
   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)
   at org.objectweb.jotm.SubCoordinator.doBeforeCompletion(SubCoordinator.java:1487)
   at org.objectweb.jotm.SubCoordinator.commit_one_phase(SubCoordinator.java:416)
   at org.objectweb.jotm.TransactionImpl.commit(TransactionImpl.java:239)
   at org.objectweb.jotm.Current.commit(Current.java:488)
   at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1028)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:678)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy40.updateUser(Unknown Source)
   at com.cinerent.starticketmediacenter.server.rpccontrollers.UserDataController.updateUser(UserDataController.java:168)
   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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy43.updateUser(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 com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
   at com.cinerent.starticketmediacenter.server.utils.annotations.GwtRpcEndPointHandlerAdapter.processCall(GwtRpcEndPointHandlerAdapter.java:97)
   at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:85)
   at com.cinerent.starticketmediacenter.server.utils.annotations.GwtRpcEndPointHandlerAdapter.handle(GwtRpcEndPointHandlerAdapter.java:53)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
   at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
   at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:173)
   at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
   at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
   at org.springframework.security.





I'm using MYSQL version 6.


I really would appreciate any help. Actually, I don't know what to try.
Thanks!

[/code]


Top
 Profile  
 
 Post subject: Use Atomikos instead of JOTM
PostPosted: Mon Sep 01, 2008 10:24 am 
Newbie

Joined: Thu Nov 29, 2007 2:18 pm
Posts: 2
Hi,

This looks like a pooling problem, in my guess the connection is pending and keeps an open transaction (and dito locks in the DBMS).

Did you try with Atomikos (www.atomikos.com) and its AtomikosNonXADataSourceBean? You can force rollback by calling rollback on the JTA transaction (or have Spring/Hibernate do it for you).

Best


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.