4 Replies Latest reply on Mar 9, 2012 3:18 PM by 798480

    Push Replication - Centralized

    798480
      Hi,

      I have setup the Push Replication example from the Incubator (Release 10) for the Centralized example - pretty straight-forward! I am now trying to run up some console clients (i.e. com.tangosol.net.CacheFactory) connecting to each of the "sites" so that I can get/put my own things and watch them replicate. After this I would then like to go on and see if I can write my own publisher classes that can filter the messages before sending them for replication as I would only like to send objects of a certain type from my one cluster's cache to another.

      I am running the client using the following cmd script. It starts up and connects to the HUB cluster, the others start up and connect to the leaf clusters as appropriate. When I am prompted with the 'Map(?):' prompt I type 'cache publishing-cache' and in the log I see the error as shown below. All of the other configurations are from the central example in the PR incubator.

      I am using the configurations as supplied through the incubator 10, coh 3.7.1, java 1.7. Any help would be much appreciated.

      Thanks,
      Ku

      Command Script for HUB Client
      set MEMORY=256m
      
      set CLUSTERPORT=9000
      set CLUSTERADDRESS=239.255.9.99
      set SERVERTYPE=hub
      set SERVER_CLIENT=client
      set JMXPORT=50000
      set MAIN_CLASS=com.tangosol.net.CacheFactory
      set STORAGE=false
      
      set LOG4J="R:\MBS\PNG\Server\ThirdParty\log4j-1.2.15"
      
      if "%CACHE_SERVER%"=="" set CACHE_SERVER="D:\zCoherence\coherence-incubator-examples-1.3.4.31472\resource\pushreplicationpattern\central"
      
      if "%COHERENCE_SERVERLOG%"=="" set COHERENCE_SERVERLOG="D:\zCoherence\coherence-incubator-examples-1.3.4.31472\log"
      
      set JAVA_EXEC="%JAVA_HOME%\bin\java"
      set JAVA_OPTS=-Xms%MEMORY% -Xmx%MEMORY% -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=%JMXPORT% -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
      
      set SYS_OPTS=-Dtangosol.coherence.cacheconfig=%SERVERTYPE%-cache-clientconfig.xml -Dtangosol.coherence.distributed.localstorage=%STORAGE% -Dtangosol.coherence.clusteraddress=%CLUSTERADDRESS% -Dtangosol.coherence.clusterport=%CLUSTERPORT% -Dtangosol.coherence.log=log4j -Dlogfilepath=%COHERENCE_SERVERLOG%\%SERVERTYPE%-%SERVER_CLIENT%-%CLUSTERPORT%.log -Dtangosol.coherence.log.level=9 -Dtangosol.coherence.site=%SERVERTYPE%%SERVER_CLIENT% -Dtangosol.pof.config=central-example-pof-config.xml
      
      TITLE Cache Client on %SERVERTYPE%
      
      %JAVA_EXEC% -showversion %JAVA_OPTS% %SYS_OPTS% -cp "%CACHE_SERVER%\;%COHERENCE_HOME%\lib\coherence.jar;%LOG4J%\log4j-1.2.15.jar" %MAIN_CLASS%
      Error after attempting to map cache
      2012-03-08 16:46:08.209/10.434 Oracle Coherence GE 3.7.1.0 <Info> (thread=main, member=4): Loaded cache configuration from "file:/D:/zCoherence/coherence-incubator-examples-1.3.4.31472/resource/pushreplicationpattern/central/hub-cache-clientconfig.xml"; this document does not refer to any schema definition and has not been validated.
      2012-03-08 16:46:08.217/10.442 Oracle Coherence GE 3.7.1.0 <Error> (thread=main, member=4): 
      java.lang.IllegalArgumentException: No scheme for cache: "publishing-cache"
           at com.tangosol.net.DefaultConfigurableCacheFactory.findSchemeMapping(DefaultConfigurableCacheFactory.java:542)
           at com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultConfigurableCacheFactory.java:290)
           at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:204)
           at com.tangosol.coherence.component.application.console.Coherence.doCache(Coherence.CDB:18)
           at com.tangosol.coherence.component.application.console.Coherence.processCommand(Coherence.CDB:212)
           at com.tangosol.coherence.component.application.console.Coherence.run(Coherence.CDB:37)
           at com.tangosol.coherence.component.application.console.Coherence.main(Coherence.CDB:3)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at com.tangosol.net.CacheFactory.main(CacheFactory.java:827)
      Edited by: Kunal on Mar 8, 2012 10:24 PM
        • 1. Re: Push Replication - Centralized
          User738616-Oracle
          Hi Kunal,

          Include the binaries residing in the lib folder of the coherence-incubator-examples-1.3.4.31472 in your HUB client classpath. From your error, it is clear that Coherence is unable to find one of the configuration files that defines publishing-cache and if you look into your "hub-cache-clientconfig.xml" , there will be a cache configuration included which resides in some other jar (I think coherence-messagingpattern).

          Hope this helps!

          Cheers,
          NJ
          • 2. Re: Push Replication - Centralized
            798480
            Thanks for replying. I added 'coherence-messagingpattern-2.8.3.31472.jar' and re-ran the client cmd and still got the same error. I then thought it may be missing another JAR that Push Replication (PR) depends on so I added them all to the CP. This gave me a different error message; it loads the cache config, then displays it and then shows an error with the method setConfig... huh? see below.

            Your idea that the publishing cache is not defined got me thinking. I went back to my original cmd script (removing those incubator JARs from the CP), then changed the cache config by removing the event distributor part and the remote schemes leaving just a mapping:
            <caching-scheme-mapping>
                        <cache-mapping>
                            <cache-name>publishing-cache</cache-name>
                            <scheme-name>distributed-scheme-with-publishing-cachestore</scheme-name>
                        </cache-mapping>
                    </caching-scheme-mapping>
            with the distributed scheme and proxy scheme as is. This got a bit further than the previous attempts - this time it loaded the pof config from the example and from the coherence jar. now it showed an error saying it could not find coherence-common-pof-config.xml. Added the coherence-common-2.1.2.31472.jar and got back to a similar error message as before when i added ALL the JARs.

            Any more ideas?

            Error after adding the other incubator JARs
            2012-03-08 18:18:58.847/9.789 Oracle Coherence GE 3.7.1.0 <Info> (thread=main, member=4): Loaded cache configuration from "file:/D:/zCoherence/coherence-incubator-examples-1.3.4.31472/resource/pushreplicationpattern/central/hub-cache-clientconfig.xml"; this document does not refer to any schema definition and has not been validated.
            2012-03-08 18:18:58.860/9.802 Oracle Coherence GE 3.7.1.0 <D7> (thread=main, member=4): ENTRY <?xml version='1.0'?>
            <!DOCTYPE cache-config SYSTEM
             'cache-config.dtd'>
            <!--
            File: active-
            pof-
            cache-
            config.xml Copyright (c) 2008-
            2009. All Rights
            Reserved. Oracle Corporation. Oracle is a registered trademark of
            Oracle Corporation and/or its affiliates. This software is the
            confidential and proprietary information of Oracle Corporation. You
            shall not disclose such confidential and proprietary information and
            shall use it only in accordance with the terms of the license
            agreement you entered into with Oracle Corporation. Oracle Corporation
            makes no representations or warranties about the suitability of the
            software, either express or implied, including but not limited to the
            implied warranties of merchantability, fitness for a particular
            purpose, or non-
            infringement. Oracle Corporation shall not be liable
            for any damages suffered by licensee as a result of using, modifying
            or distributing this software or its derivatives. This notice may not
            be removed or altered.
            -->
            <cache-config xmlns:event='class://com.oracle.coherence.patterns.eventdistribution.configuration.EventDistributionNamespaceContentHandler' xmlns:element='class://com.oracle.coherence.environment.extensible.namespaces.XmlElementProcessingNamespaceContentHandler' element:introduce-cache-config='coherence-messagingpattern-cache-config.xml'>
              <defaults>
                <serializer>pof</serializer>
              </defaults>
              <caching-schemes>
                <!--
                The following scheme is required for each remote-
                site when
                using a RemoteInvocationPublisher
                END: com.oracle.coherence.patterns.pushreplication
                -->
                <caching-scheme-mapping>
                  <cache-mapping>
                    <cache-name>publishing-cache</cache-name>
                    <scheme-name>distributed-scheme-with-publishing-cachestore</scheme-name>
                    <event:distributor>
                      <event:distributor-name>{cache-name}</event:distributor-name>
                      <event:distributor-external-name>{site-name}-{cluster-name}-{cache-name}</event:distributor-external-name>
                      <event:distributor-scheme>
                        <event:coherence-based-distributor-scheme/>
                      </event:distributor-scheme>
                      <event:distribution-channels>
                        <event:distribution-channel>
                          <event:channel-name>Leaf1Channel</event:channel-name>
                          <event:starting-mode system-property='channel.starting.mode'>enabled</event:starting-mode>
                          <event:channel-scheme>
                            <event:remote-cluster-channel-scheme>
                              <event:remote-invocation-service-name>leaf-site1</event:remote-invocation-service-name>
                              <distribution-role>HUB</distribution-role>
                              <event:remote-channel-scheme>
                                <event:local-cache-channel-scheme>
                                  <event:target-cache-name>publishing-cache</event:target-cache-name>
                                </event:local-cache-channel-scheme>
                              </event:remote-channel-scheme>
                            </event:remote-cluster-channel-scheme>
                          </event:channel-scheme>
                        </event:distribution-channel>
                        <event:distribution-channel>
                          <event:channel-name>Leaf3Channel</event:channel-name>
                          <event:starting-mode system-property='channel.starting.mode'>enabled</event:starting-mode>
                          <event:channel-scheme>
                            <event:remote-cluster-channel-scheme>
                              <event:remote-invocation-service-name>leaf-site2</event:remote-invocation-service-name>
                              <distribution-role>HUB</distribution-role>
                              <event:remote-channel-scheme>
                                <event:local-cache-channel-scheme>
                                  <event:target-cache-name>publishing-cache</event:target-cache-name>
                                </event:local-cache-channel-scheme>
                              </event:remote-channel-scheme>
                            </event:remote-cluster-channel-scheme>
                          </event:channel-scheme>
                        </event:distribution-channel>
                        <event:distribution-channel>
                          <event:channel-name>Leaf2Channel</event:channel-name>
                          <event:starting-mode system-property='channel.starting.mode'>enabled</event:starting-mode>
                          <event:channel-scheme>
                            <event:remote-cluster-channel-scheme>
                              <event:remote-invocation-service-name>leaf-site3</event:remote-invocation-service-name>
                              <distribution-role>HUB</distribution-role>
                              <event:remote-channel-scheme>
                                <event:local-cache-channel-scheme>
                                  <event:target-cache-name>publishing-cache</event:target-cache-name>
                                </event:local-cache-channel-scheme>
                              </event:remote-channel-scheme>
                            </event:remote-cluster-channel-scheme>
                          </event:channel-scheme>
                        </event:distribution-channel>
                      </event:distribution-channels>
                    </event:distributor>
                  </cache-mapping>
                </caching-scheme-mapping>
                <remote-invocation-scheme>
                  <service-name>leaf-site1</service-name>
                  <initiator-config>
                    <tcp-initiator>
                      <remote-addresses>
                        <socket-address>
                          <address>localhost</address>
                          <port>20001</port>
                        </socket-address>
                      </remote-addresses>
                      <connect-timeout>2s</connect-timeout>
                    </tcp-initiator>
                    <outgoing-message-handler>
                      <request-timeout>5s</request-timeout>
                    </outgoing-message-handler>
                  </initiator-config>
                </remote-invocation-scheme>
                <remote-invocation-scheme>
                  <service-name>leaf-site2</service-name>
                  <initiator-config>
                    <tcp-initiator>
                      <remote-addresses>
                        <socket-address>
                          <address>localhost</address>
                          <port>20002</port>
                        </socket-address>
                      </remote-addresses>
                      <connect-timeout>2s</connect-timeout>
                    </tcp-initiator>
                    <outgoing-message-handler>
                      <request-timeout>5s</request-timeout>
                    </outgoing-message-handler>
                  </initiator-config>
                </remote-invocation-scheme>
                <remote-invocation-scheme>
                  <service-name>leaf-site3</service-name>
                  <initiator-config>
                    <tcp-initiator>
                      <remote-addresses>
                        <socket-address>
                          <address>localhost</address>
                          <port>20003</port>
                        </socket-address>
                      </remote-addresses>
                      <connect-timeout>2s</connect-timeout>
                    </tcp-initiator>
                    <outgoing-message-handler>
                      <request-timeout>5s</request-timeout>
                    </outgoing-message-handler>
                  </initiator-config>
                </remote-invocation-scheme>
                <distributed-scheme>
                  <scheme-name>distributed-scheme-with-publishing-cachestore</scheme-name>
                  <service-name>DistributedCacheWithPublishingCacheStore</service-name>
                  <backing-map-scheme>
                    <read-write-backing-map-scheme>
                      <internal-cache-scheme>
                        <local-scheme/>
                      </internal-cache-scheme>
                      <cachestore-scheme>
                        <class-scheme>
                          <class-name>com.oracle.coherence.patterns.pushreplication.PublishingCacheStore</class-name>
                          <init-params>
                            <init-param>
                              <param-type>java.lang.String</param-type>
                              <param-value>{cache-name}</param-value>
                            </init-param>
                          </init-params>
                        </class-scheme>
                      </cachestore-scheme>
                    </read-write-backing-map-scheme>
                  </backing-map-scheme>
                  <autostart>true</autostart>
                </distributed-scheme>
                <proxy-scheme>
                  <service-name>ExtendTcpProxyService</service-name>
                  <acceptor-config>
                    <tcp-acceptor>
                      <local-address>
                        <address>localhost</address>
                        <port>20000</port>
                      </local-address>
                    </tcp-acceptor>
                  </acceptor-config>
                  <autostart>true</autostart>
                </proxy-scheme>
              </caching-schemes>
            </cache-config>
             Class:com.oracle.coherence.environment.extensible.ExtensibleEnvironment Method:setConfig
            
            Using the Incubator Extensible Environment for Coherence Cache Configuration
            Copyright (c) 2011, Oracle Corporation. All Rights Reserved.
            
            2012-03-08 18:18:58.881/9.823 Oracle Coherence GE 3.7.1.0 <Error> (thread=main, member=4): 
            (Wrapped: Failed to load the factory) (Wrapped: Missing or inaccessible constructor "com.oracle.coherence.environment.extensible.ExtensibleEnvironment(String)"
            <configurable-cache-factory-config>
              <class-name>com.oracle.coherence.environment.extensible.ExtensibleEnvironment</class-name>
              <init-params>
                <init-param>
                  <param-type>java.lang.String</param-type>
                  <param-value>hub-cache-clientconfig.xml</param-value>
                </init-param>
              </init-params>
            </configurable-cache-factory-config>) java.lang.reflect.InvocationTargetException
                 at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)
                 at com.tangosol.net.ScopedCacheFactoryBuilder.getDefaultFactory(ScopedCacheFactoryBuilder.java:311)
                 at com.tangosol.net.DefaultCacheFactoryBuilder.getSingletonFactory(DefaultCacheFactoryBuilder.java:48)
                 at com.tangosol.net.DefaultCacheFactoryBuilder.getFactory(DefaultCacheFactoryBuilder.java:121)
                 at com.tangosol.net.ScopedCacheFactoryBuilder.getConfigurableCacheFactory(ScopedCacheFactoryBuilder.java:112)
                 at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactory.java:126)
                 at com.tangosol.net.CacheFactory.getConfigurableCacheFactory(CacheFactory.java:109)
                 at com.tangosol.coherence.component.application.console.Coherence.doCache(Coherence.CDB:9)
                 at com.tangosol.coherence.component.application.console.Coherence.processCommand(Coherence.CDB:212)
                 at com.tangosol.coherence.component.application.console.Coherence.run(Coherence.CDB:37)
                 at com.tangosol.coherence.component.application.console.Coherence.main(Coherence.CDB:3)
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                 at java.lang.reflect.Method.invoke(Method.java:601)
                 at com.tangosol.net.CacheFactory.main(CacheFactory.java:827)
            Caused by: (Wrapped: Missing or inaccessible constructor "com.oracle.coherence.environment.extensible.ExtensibleEnvironment(String)"
            <configurable-cache-factory-config>
              <class-name>com.oracle.coherence.environment.extensible.ExtensibleEnvironment</class-name>
              <init-params>
                <init-param>
                  <param-type>java.lang.String</param-type>
                  <param-value>hub-cache-clientconfig.xml</param-value>
                </init-param>
              </init-params>
            </configurable-cache-factory-config>) java.lang.reflect.InvocationTargetException
                 at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)
                 at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2652)
                 at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2536)
                 at com.tangosol.net.ScopedCacheFactoryBuilder.getDefaultFactory(ScopedCacheFactoryBuilder.java:273)
                 ... 14 more
            Caused by: java.lang.reflect.InvocationTargetException
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                 at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
                 at com.tangosol.util.ClassHelper.newInstance(ClassHelper.java:694)
                 at com.tangosol.run.xml.XmlHelper.createInstance(XmlHelper.java:2611)
                 ... 16 more
            Caused by: java.lang.NoClassDefFoundError: javax/jms/JMSException
                 at com.oracle.coherence.patterns.eventdistribution.configuration.EventDistributionNamespaceContentHandler.<init>(EventDistributionNamespaceContentHandler.java:150)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                 at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
                 at java.lang.Class.newInstance0(Class.java:372)
                 at java.lang.Class.newInstance(Class.java:325)
                 at com.oracle.coherence.environment.extensible.DefaultConfigurationContext$Scope.establishNamespaceContentHandlerFor(DefaultConfigurationContext.java:1132)
                 at com.oracle.coherence.environment.extensible.DefaultConfigurationContext.ensureNamespaceContentHandler(DefaultConfigurationContext.java:120)
                 at com.oracle.coherence.environment.extensible.DefaultConfigurationContext.processElement(DefaultConfigurationContext.java:283)
                 at com.oracle.coherence.environment.extensible.DefaultConfigurationContext.processDocument(DefaultConfigurationContext.java:231)
                 at com.oracle.coherence.environment.extensible.ExtensibleEnvironment.setConfig(ExtensibleEnvironment.java:468)
                 at com.tangosol.net.DefaultConfigurableCacheFactory.<init>(DefaultConfigurableCacheFactory.java:193)
                 at com.tangosol.net.DefaultConfigurableCacheFactory.<init>(DefaultConfigurableCacheFactory.java:179)
                 at com.tangosol.net.DefaultConfigurableCacheFactory.<init>(DefaultConfigurableCacheFactory.java:155)
                 at com.oracle.coherence.environment.extensible.ExtensibleEnvironment.<init>(ExtensibleEnvironment.java:154)
                 ... 22 more
            Caused by: java.lang.ClassNotFoundException: javax.jms.JMSException
                 at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
                 at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
                 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
                 ... 38 more
            • 3. Re: Push Replication - Centralized
              User738616-Oracle
              Hi Varun,

              I think you have not added all the jars in the lib folder of the incubator-examples project. Unfortunate but, eventdistribution project has the dependency on "geronimo-jms" and "activemq" and that is the reason for the exception. I have not seen any documentation on dependency for incubator projects and the only way is to include all of them or figure it out yourself.

              Also, I am assuming you have changed the "hub-cache-config.xml" and renamed it to "hub-cache-clientconfig.xml" otherwise, make sure the file is present at the specified location.

              Hope this helps!

              Cheers,
              NJ
              1 person found this helpful
              • 4. Re: Push Replication - Centralized
                798480
                Thanks NJ. You were right, I needed to include activemq-core-5.3.1.jar and geronimo-jms_1.1_spec-1.1.1.jar as well as the respective incubator dependencies. Now my client has managed to connect to the publishing-cache.

                It would be great if the documentation was updated to reflect this....if you had not mentioned it then I would still be stuck here. Thanks again.
                Kunal