3 Replies Latest reply: Apr 23, 2012 9:57 AM by René van Wijk RSS

    How to setup coherence on tomcat instances

    931521
      VARUN_AT_INFOSYS: I am trying to setup coherence on tomcat instances. my goal is to achieve session management between two tomcat instances created at my local. i am able to install coherence and able to setup cluster also.
      also i am able to add multiple distributed caches to cluster.
      However following are the issues observed:

      1. Getting Exception during server startup :
      SEVERE: Exception sending context destroyed event to listener instance of class com.tangosol.coherence.servlet.api23.ServletContextListenerImpl
      com.tangosol.net.RequestPolicyException: No storage-enabled nodes exist for service DistributedSessions
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$BinaryMap.onMissingStorage(PartitionedCache.CDB:32)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$BinaryMap.sendStorageRequest(PartitionedCache.CDB:11)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$BinaryMap.addIndex(PartitionedCache.CDB:11)
           at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ViewMap.addIndex(PartitionedCache.CDB:1)
           at com.tangosol.coherence.component.util.SafeNamedCache.addIndex(SafeNamedCache.CDB:1)
           at com.tangosol.coherence.servlet.SplitHttpSessionCollection.configure(SplitHttpSessionCollection.java:78)
           at com.tangosol.coherence.servlet.SessionHelper.configure(SessionHelper.java:191)
           at com.tangosol.coherence.servlet.tomcat55.CookieHelper.configure(CookieHelper.java:78)
           at com.tangosol.coherence.servlet.SessionHelper.ensureSessionHelper(SessionHelper.java:542)
           at com.tangosol.coherence.servlet.api23.ServletContextListenerImpl.init(ServletContextListenerImpl.java:267)
           at com.tangosol.coherence.servlet.api23.ServletContextListenerImpl.contextDestroyed(ServletContextListenerImpl.java:140)
           at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3836)
           at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4366)
           at org.apache.catalina.core.StandardContext.start(StandardContext.java:4282)
           at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
           at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
           at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
           at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:884)
           at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:737)
           at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
           at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1203)
           at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
           at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
           at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
           at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
           at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
           at org.apache.catalina.core.StandardService.start(StandardService.java:448)
           at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
           at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
           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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
           at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

      2. Also instances getting added to cluster, however they leave the cluster. Reason not clear.

      Any pointers will be highly appreciable.

      Edited by: varunURFjavaBUG on May 12, 2012 8:20 AM

      Edited by: varunURFjavaBUG on May 12, 2012 8:26 AM
        • 1. Re: How to setup coherence on tomcat instances
          René van Wijk
          You have to make sure there is at least one storage-enabled node in the cluster before you start any clients, i.e.,
          that have the option -Dtangosol.coherence.distributed.localstorage=false.

          An example set-up that includes JBoss can be found here: http://middlewaremagic.com/weblogic/?p=7932
          • 2. Re: How to setup coherence on tomcat instances
            931521
            Thanks for replying.
            I tried as suggested by you.
            There is no option being observed on -Dtangosol.coherence.distributed.localstorage which can be set to false.
            However, i was able to locate tangosol.coherence.distributed.localstorage in one of configuration file i.e. tangosol-coherence.xml
            I tried setting it to false and provided it on classpath of one of my server. Then,i started that server firstly so that it can work as a storage enabled node.However, still i am facing same issue.
            Can you let me know if -Dtangosol.coherence.distributed.localstorage and tangosol.coherence.distributed.localstorage parameter are same ?
            Can you please elaborate the procedure to setup tangosol.coherence.distributed.localstorage variable ?
            Example set-up that includes JBoss didn't provided much help as of now.
            • 3. Re: How to setup coherence on tomcat instances
              René van Wijk
              "Can you let me know if -Dtangosol.coherence.distributed.localstorage and tangosol.coherence.distributed.localstorage parameter are same ?"

              The -D option can be used as a JVM configuration. The default (true) is being set in tangosol-coherence.xml:
              <param-value system-property="tangosol.coherence.distributed.localstorage">true</param-value>
              by using the -D option you can override this default on a JVM basis, which in done in the post (http://middlewaremagic.com/weblogic/?p=7932) by adding
              -Dtangosol.coherence.distributed.localstorage=false
              to the JBoss application server JVM conifguration. Before we can start the application server we need at least one
              storage enabled node. In the post (http://middlewaremagic.com/weblogic/?p=7932) these are separate JVM's. In this manner they do 'steal' memory from the
              application server. An example script that starts a storage enabled node is the following:
              #!/bin/sh
              
              JMX_OPTIONS="-Dcom.sun.management.jmxremote.port=7091 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
              COHERENCE_MANAGEMENT_OPTIONS="-Dtangosol.coherence.management=all -Dtangosol.coherence.management.remote=true"
              COHERENCE_OPTIONS="-Dtangosol.coherence.cacheconfig=security-cache-config.xml -Dtangosol.coherence.mode=prod ${COHERENCE_MANAGEMENT_OPTIONS} ${JMX_OPTIONS}"
              export COHERENCE_OPTIONS
              
              JAVA_HOME="/home/jboss/jdk1.6.0_31"
              export JAVA_HOME
              
              MEM_ARGS="-server -Xms512m -Xmx512m -XX:NewRatio=2 -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing"
              export MEM_ARGS
              
              CLASSPATH="/home/jboss/jboss-as-7.1.0.Final/modules/com/coherence/main/coherence.jar:/home/jboss/jboss-as-7.1.0.Final/modules/com/coherence/main/test.jar"
              export CLASSPATH
              
              ${JAVA_HOME}/bin/java ${MEM_ARGS} ${COHERENCE_OPTIONS} com.tangosol.net.DefaultCacheServer
              Note that when this is run we are also able to monitor the cluster. This is accomplished through the addition of JMX_OPTIONS and COHERENCE_MANAGEMENT_OPTIONS
              parameters. These can be left out on any other node - one node that collects management data is enough.