9 Replies Latest reply on Jul 27, 2004 7:37 AM by analogueboy

    Getting started problems

    kjc5664

      Attempting this code from within a Web collaborator

      public void init(){
      try {
      //: cache is an inst var
      cache = new TreeCacheAop();
      }

      catch(Exception e){
      logger.error(e);
      }
      }
      give me the following exception. I can see that Tomcat is attempting
      to save the session. Can TreeCacheAop be used inside a Web component in JB 3.2.3 ??

      Or am I just missing something.



      2004-07-07 14:18:50,740 WARN [org.jboss.web.tomcat.session.InstantSnapshotManager] Failed to replicate sessionID:HGZ9u9osi4M3ZO+-KdrtDg**
      javax.ejb.EJBException: Exception in setHttpSession: javax.ejb.EJBException: Exception in setHttpSession: RuntimeMBeanException: RuntimeException in MBean operation 'invoke(org.jboss.invocation.Invocation)'
      Cause: javax.ejb.EJBException: java.io.NotSerializableException: org.jboss.cache.aop.TreeCacheAop
      at org.jboss.ha.httpsession.server.ClusteredHTTPSessionService.setHttpSession(ClusteredHTTPSessionService.java:117)
      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.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy157.setHttpSession(Unknown Source)
      at org.jboss.web.tomcat.session.ClusterManager.storeSession(ClusterManager.java:615)
      at org.jboss.web.tomcat.session.InstantSnapshotManager.snapshot(InstantSnapshotManager.java:39)
      at org.jboss.web.tomcat.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:89)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
      at java.lang.Thread.run(Thread.java:534)

        • 1. Re: Getting started problems

          Couple points here:

          1. Are you trying to put cache insto session data for clustering as well? Looks like Tomcat is trying to serialize TreeCacheAop which I don't think is the way to use it. :-)

          2. TreeCacheAop is for fine grain replication, so make sure it is the one you want (instead of plain TreeCache).

          3. I am currently working on HttpSession replication under Tomcat 5 using JBossCache. THis will replcate our current replication layer for tc5. It should be done in 3.2.6 release. So stay tuned if this is what you want. It will expose cache as a clustering session MBean service as well. So you can inovke it from your web container and replicate other user data.

          -Ben

          • 2. Re: Getting started problems
            kjc5664

            I appreciate the response, however using the regular TreeCache results in the same excaption since it also isn't serializable. I'm using this with Struts 1.1. I don't need or want to use EJB on the back end. In my ActionForm instance is an instance var TreeCache cache. Nothing unsual about this pattern.

            • 3. Re: Getting started problems
              ccaprar

              Are you somewhere trying to place an instance of the TreeCache in the HttpSession or in an object already placed in the HttpSession? This seems to cause the problem.

              Regards,
              Cristi

              • 4. Re: Getting started problems

                My guess is ActionForm is being replicated by the HttpSession. If this is the case, I don't think you want to replication the cache instance itself. You can delcare it transient to prevent that.

                • 5. Re: Getting started problems
                  kjc5664

                  Yes, I could declare it transient, but that would mean creating a new object each time I wanted to have access to the cache. It appears that using JBossCache in this fashion was not considered during the design. If that is true, please provide a caveat, stating that JBossCache cannot be used as an inst var in a Struts/Servlet session context.

                  • 6. Re: Getting started problems

                    I fail to see why declare a cache variable transient will create a new cache inside each session. If running inside JBoss, JBossCache is a MBean service. You can always get that instance (so in effect you only have one cache per server).

                    Besides, I haven't heard any use case so far that when replicating a session, you also need to replicate the whole cache instance as well. Use JBossCache for its own replication! In essence, you are creating a cache per session. Is this really what you want? JBossCache (or any cache system is not meant to be used like that).

                    Please convince me and I will then be happy to state our deficiency. :-)

                    -Ben

                    • 7. Re: Getting started problems
                      kjc5664

                      Maybe I misunderstood something. But, I thought JBossCache as an MBean service was only available in JBoss 4. Correct me if that is an incorrect assertion.

                      • 8. Re: Getting started problems

                        It is available in JBoss3.2.3 and later as well.

                        -ben

                        • 9. Re: Getting started problems
                          analogueboy


                          If running inside JBoss, JBossCache is a MBean service. You can always get that instance (so in effect you only have one cache per server).

                          I'm missing something fundamental here, how do u obtain a reference to the MBean? Is it static within the JVM?