2 Replies Latest reply on Jul 28, 2004 7:28 AM by timshaw

    CMP/Cacheing problems

    timshaw

      Hi,

      I have an app which has infrequent (daily) updates of data, and requires high-speed read-only access by a small number of clients all the time.

      I'm not bothered (much) by the speed of loading, but retrieval needs to be as fast as possible.

      As all access is via my beans, I initially tried (with commit-option A) just loading the data sequentially (I have a number of test data-sets correesponding to a weeks worth of data). This results in the error below (or some other exception about a primary-key=0).

      It turns out that if I run the load sequence twice, it all goes horribly wrong (see trace below) ... but if I stop and restart JBoss in between the two loads it works fine!

      I've tried various commit-options (A,B,C), and they seem to make no difference to the outcome.
      I've tried flushCache on each of the EJB's after each load sequence ... same problem.

      I think this has to be a cacheing problem - mainly because the stop/restart fixes it, which implies it's not my code(?).

      Any suggestions gratefully accepted - this is crucial to my company and is not really a difficult domain. All I want to do is load some data, juggle with it a bit and then let others see the results after all!

      16:16:22,855 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract com.blueheath.common.system.CycleStatistics com.blueheath.warehouse.ejb.Loader.loadCycleData(java.lang.Long) throws java.rmi.RemoteException, causedBy:
      org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=tim.direct.local//21, BranchQual=] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: Could insert relations into cusorderitemlineitemrelation; CausedByException is:
       Duplicate key or integrity constraint violation, message from server: "Duplicate entry '29296-2170' for key 1")
       at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:415)
       at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:456)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:324)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:120)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
       at org.jboss.ejb.Container.invoke(Container.java:723)
       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:324)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
       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:324)
       at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
       at sun.rmi.transport.Transport$1.run(Transport.java:148)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
       at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
       at java.lang.Thread.run(Thread.java:534)
      


        • 1. Re: CMP/Cacheing problems
          aloubyansky

          The exception is thrown by the database driver because of constraint violation

          Could insert relations into cusorderitemlineitemrelation; CausedByException is:
          Duplicate key or integrity constraint violation, message from server: "Duplicate entry '29296-2170' for key 1")


          • 2. Re: CMP/Cacheing problems
            timshaw

            Thanks for the reply.

            I realise the error is due to a constraint violation - my problem is that this constraint violation should not occur!

            I have 2 - well, 350+ actually - datasets to load. If I load them one after the other, I get the error. If I stop JBoss after loading the first set and then restart it and load the second set, it all works fine!
            My reading of this is that the data/logic is correct - no constraints are violated.

            This is killing me as I have to load all the 350+ datasets each of which takes around 10 minutes) immediately, and then one a day from now on - whilst having the app available to other users.

            I am using Java 1.4.2_04, JBoss 3.2.5 on Linux, talking to MySQL 4.0.20.

            I can't understand why this setup doesn't work, but I will now have to spend time evaluating other App Servers ... please help.

            Thanks