12 Replies Latest reply on Apr 1, 2005 12:56 PM by nsakiya

    commit() should not be called on TreeCache directly Being th

    xavierpayne2

      I have services deployed in jboss 4.0.1 which use the jboss cache mbean service.

      I am using the REPL_SYNC mode and now recieve the following error on all cache writes which occur within a transaction. My code NEVER calls a comit() method and I can deploy this same code in jboss 4.0.0 using the jboss-cache 1.2 jar and do not recieve this error.

      Also of interest is the fact that My code appears to continue working in spite of this error. Below is the complete stack trace that is appear in my log with every transactional cache write.:

      11:18:54,287 ERROR [RpcDispatcher] failed invoking method
      java.lang.UnsupportedOperationException: commit() should not be called on TreeCache directly
       at org.jboss.cache.TreeCache.commit(TreeCache.java:2729)
       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.jgroups.blocks.MethodCall.invoke(MethodCall.java:236)
       at org.jboss.cache.interceptors.CallInterceptor.invoke(CallInterceptor.java:37)
       at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:40)
       at org.jboss.cache.interceptors.LockInterceptor.invoke(LockInterceptor.java:126)
       at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:40)
       at org.jboss.cache.interceptors.CreateIfNotExistsInterceptor.invoke(CreateIfNotExistsInterceptor.java:47)
       at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:40)
       at org.jboss.cache.interceptors.ReplicationInterceptor.replicate(ReplicationInterceptor.java:210)
       at org.jboss.cache.TreeCache._replicate(TreeCache.java:2679)
       at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jgroups.blocks.MethodCall.invoke(MethodCall.java:236)
       at org.jgroups.blocks.RpcDispatcher.handle(RpcDispatcher.java:220)
       at org.jgroups.blocks.RequestCorrelator.handleRequest(RequestCorrelator.java:615)
       at org.jgroups.blocks.RequestCorrelator.receiveMessage(RequestCorrelator.java:512)
       at org.jgroups.blocks.RequestCorrelator.receive(RequestCorrelator.java:326)
       at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.handleUp(MessageDispatcher.java:722)
       at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.access$300(MessageDispatcher.java:554)
       at org.jgroups.blocks.MessageDispatcher$1.run(MessageDispatcher.java:691)
       at java.lang.Thread.run(Thread.java:534)


        • 1. errors: Caller pointcuts on servlets
          belaban

          I'm trying to apply the caller pointcut below to show me the parameters sent to the servlet by the http request:

           <aspect class="br.com.ilheus.hotels.aspects.LoggingAspectPER_CLASS" scope="PER_CLASS" />
           <bind pointcut="call(java.lang.String javax.servlet.ServletRequest->getParameter(java.lang.String)) AND withincode(void br.com.ilheus.hotels.web.ReservaServlet->doPost(..))">
           <advice name="servletRequestGetParameterAdvice" aspect="br.com.ilheus.hotels.aspects.LoggingAspectPER_CLASS" />
           </bind>
          

          It seems to compile but when I execute the report mode of AopC the error "Unable to figure out calledmethod of a caller
          pointcut" appears:

          [aopc] java.lang.ExceptionInInitializerError
          [aopc] at sun.misc.Unsafe.ensureClassInitialized(Native Method)
          [aopc] at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:20)
          [aopc] at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
          [aopc] at java.lang.reflect.Field.acquireFieldAccessor(Field.java:779)
          [aopc] at java.lang.reflect.Field.getFieldAccessor(Field.java:760)
          [aopc] at java.lang.reflect.Field.get(Field.java:228)
          [aopc] at org.jboss.aop.standalone.Compiler.loadFile(Compiler.java:173)
          [aopc] at org.jboss.aop.standalone.Compiler.compile(Compiler.java:140)
          [aopc] at org.jboss.aop.standalone.Compiler.main(Compiler.java:61)
          [aopc] Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unable to figure out calledmethod of a caller pointcut

          Also, the web container could not instantiate the servlet after the compilation:

          16:57:44,982 INFO [Engine] StandardContext[/ilheus]Marking servlet Reserva as u
          navailable
          16:57:44,982 ERROR [Engine] StandardWrapperValve[Reserva]: Allocate exception fo
          r servlet Reserva
          javax.servlet.ServletException: Error instantiating servlet class br.com.ilheus.
          hotels.web.ReservaServlet
          at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
          java:986)


          I had applied other caller pointcut to the servlet successfully. Does anybody know why I could not intercept the
          HttpServletRequest object?

          Another abnormal end I had was that a NullPointerException occurs when my servlet processes if I configure my aspect as
          per instance:
           <aspect class="br.com.ilheus.hotels.aspects.LoggingAspect" scope="PER_INSTANCE" />
          


          The error is:

          23:21:09,233 ERROR [Engine] StandardWrapperValve[Reserva]: Servlet.service() for
          servlet Reserva threw exception
          java.lang.NullPointerException
          at org.jboss.aop.ClassInstanceAdvisor.getPerInstanceAspect(ClassInstance
          Advisor.java:98)
          at org.jboss.aop.advice.PerInstanceAdvice.invoke(PerInstanceAdvice.java:
          48)
          at org.jboss.aop.joinpoint.MethodCalledByMethodInvocation.invokeNext(Met
          hodCalledByMethodInvocation.java:60)
          at org.jboss.aop.ClassAdvisor.invokeCaller(ClassAdvisor.java:1453)
          at br.com.ilheus.hotels.web.ReservaServlet.br$com$ilheus$hotels$web$Rese
          rvaServlet$doPost$aop(ReservaServlet.java)
          at br.com.ilheus.hotels.web.ReservaServlet.doPost(ReservaServlet.java)
          at br.com.ilheus.hotels.web.ReservaServlet.br$com$ilheus$hotels$web$Rese
          rvaServlet$doGet$aop(ReservaServlet.java)
          at br.com.ilheus.hotels.web.ReservaServlet.doGet(ReservaServlet.java)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          ...

          In this case none pointcut works.

          • 2. Re: commit() should not be called on TreeCache directly Bein
            xavierpayne2

            Probably also worth mention is that I have this running in a 2 node cluster.

            • 3. Re: commit() should not be called on TreeCache directly Bein
              belaban

              known bug, fixed in 1.2.1

              There are *no* side-effects though, the cache is still correct. Just ignore the error for now

              • 4. Re: commit() should not be called on TreeCache directly Bein
                xavierpayne2

                Great to hear! Thanks for the swift reply.

                When jboss-cache 1.2.1 is released will I be able to just drop it into JBoss 4.0.1 as a replacement for its existing jboss-cache.jar? Or is that a bad idea?

                Can I get my hands on a cvs nightly build which has this fix? Or should I just wait patiently like everyone else? ;)

                We upgraded to jboss 4.0.1 because it fixed problems we were having with jboss-net under 4.0.0 :) But it seems we traded one bug for another. :)

                • 5. Re: commit() should not be called on TreeCache directly Bein
                  bechara

                  Any idea about when jboss-cache 1.2.1 will be released ?

                  • 6. Re: commit() should not be called on TreeCache directly Bein
                    belaban

                    we're shooting 2-3 weeks from now

                    • 7. Re: commit() should not be called on TreeCache directly Bein
                      nsakiya

                      I replaced the new jboss-cache.jar (1.2.1) into $JBOSS_HOME/server/all/lib, restarted the server, but I still keep getting the same error stack. Am I missing something?
                      Thanx,

                      • 8. Re: commit() should not be called on TreeCache directly Bein
                        belaban

                        Are you starting with run -c *all* ? I tested this when I fixed it.

                        • 9. Re: commit() should not be called on TreeCache directly Bein
                          belaban

                          and I checked the code again. This error does *not* occur in 1.2.1 !

                          • 10. Re: commit() should not be called on TreeCache directly Bein
                            belaban

                            what is your cluster-service.xml configuration ?

                            • 11. Re: commit() should not be called on TreeCache directly Bein
                              xavierpayne2

                              Bela> 1.2.1 is working here fine for us too. You fixed that bug several weeks ago.

                              From what I've experienced 1.2.1 is rock solid.

                              nsakiya> Are you sure you replaced the jar?

                              • 12. Re: commit() should not be called on TreeCache directly Bein
                                nsakiya

                                Wow... thanks for all response, guys. What I did were the following:
                                - renamed the old $JBOSS_HOME/server/all/lib/jboss-cache.jar to old $JBOSS_HOME/server/all/lib/jboss-cache.jar.bak
                                - downloaded JBossCache-1.2.1 and extracted it
                                - put lib/jboss-cache.jar from JBossCache-1.2.1 into $JBOSS_HOME/server/all/lib
                                - renamed it to jboss-cache-1.2.1.jar
                                - Restarted both server in the cluster
                                I'm not certain that I did it right, and do you see anything wrong here? Maybe I use the wrong jar... Or Maybe I put iit in the wrong place?
                                Thanx,