远程Coherence客户端出错

时间:2016-08-08 09:56:37

标签: caching

我的远程连贯服务器(脚本来自coherence 3.6.1下载)开始使用ipaddress为169.177.81.97,端口为8088.I还没有为此启动weblogic服务器。现在我尝试将其连接到客户端在不同的机器上,它给了我一个错误:

2016-08-08 15:06:20.423/0.237 Oracle Coherence 3.6.1.0 <Info> (thread=main, member=n/a): Loaded operational configuration from "jar:file:/C:/Test/RemoteCache/lib/coherence.jar!/tangosol-coherence.xml"
2016-08-08 15:06:20.427/0.241 Oracle Coherence 3.6.1.0 <Info> (thread=main, member=n/a): Loaded operational overrides from "jar:file:/C:/Test/RemoteCache/lib/coherence.jar!/tangosol-coherence-override-dev.xml"
2016-08-08 15:06:20.429/0.243 Oracle Coherence 3.6.1.0 <Info> (thread=main, member=n/a): Loaded operational overrides from "file:/C:/Test/RemoteCache/bin/tangosol-coherence-override.xml"
2016-08-08 15:06:20.435/0.249 Oracle Coherence 3.6.1.0 <D5> (thread=main, member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified


Oracle Coherence Version 3.6.1.0 Build 19636
 Grid Edition: Development mode
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.


2016-08-08 15:06:20.618/0.432 Oracle Coherence GE 3.6.1.0 <Info> (thread=main, member=n/a): Loaded cache configuration from "file:/C:/Test/RemoteCache/bin/example-config.xml"
2016-08-08 15:06:20.900/0.714 Oracle Coherence GE 3.6.1.0 <D5> (thread=ExtendTcpCacheService:TcpInitiator, member=n/a): Started: TcpInitiator{Name=ExtendTcpCacheService:TcpInitiator, State=(SERVICE_STARTED), ThreadCount=0, Codec=Codec(Format=POF), Serializer=com.tangosol.io.DefaultSerializer, PingInterval=0, PingTimeout=5000, RequestTimeout=5000, ConnectTimeout=10000, SocketProvider=SystemSocketProvider, RemoteAddresses=[/169.177.81.97:8088], SocketOptions{LingerTimeout=0, KeepAliveEnabled=true, TcpDelayEnabled=false}}
2016-08-08 15:06:20.907/0.721 Oracle Coherence GE 3.6.1.0 <D5> (thread=main, member=n/a): Connecting Socket to 169.177.81.97:8088
2016-08-08 15:06:20.949/0.763 Oracle Coherence GE 3.6.1.0 <Info> (thread=main, member=n/a): Connected Socket to 169.177.81.97:8088
2016-08-08 15:06:30.972/10.786 Oracle Coherence GE 3.6.1.0 <Info> (thread=main, member=n/a): Error establishing a connection with 169.177.81.97:8088: ******com.tangosol.net.RequestTimeoutException: request timed out after 10000 millis
Exception in thread "main" com.tangosol.net.messaging.ConnectionException: could not establish a connection to one of the following addresses: [169.177.81.97:8088]; make sure the "remote-addresses" configuration element contains an address and port of a running TcpAcceptor****
  at** com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.initiator.TcpInitiator$TcpConnection.open(TcpInitiator.CDB:64)
  at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.Initiator.ensureConnection(Initiator.CDB:12)
  at com.tangosol.coherence.component.net.extend.remoteService.RemoteCacheService.openChannel(RemoteCacheService.CDB:5)
  at com.tangosol.coherence.component.net.extend.RemoteService.doStart(RemoteService.CDB:11)
  at com.tangosol.coherence.component.net.extend.RemoteService.start(RemoteService.CDB:5)
  at com.tangosol.coherence.component.util.SafeService.startService(SafeService.CDB:28)
  at com.tangosol.coherence.component.util.safeService.SafeCacheService.startService(SafeCacheService.CDB:5)
  at com.tangosol.coherence.component.util.SafeService.ensureRunningService(SafeService.CDB:27)
  at com.tangosol.coherence.component.util.SafeService.start(SafeService.CDB:14)
  at com.tangosol.net.DefaultConfigurableCacheFactory.ensureServiceInternal(DefaultConfigurableCacheFactory.java:1057)
  at com.tangosol.net.DefaultConfigurableCacheFactory.ensureService(DefaultConfigurableCacheFactory.java:892)
  at com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultConfigurableCacheFactory.java:874)
  at com.tangosol.net.DefaultConfigurableCacheFactory.configureCache(DefaultConfigurableCacheFactory.java:1231)
  at com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultConfigurableCacheFactory.java:290)
  at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:735)
  at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:712)
  at com.test.TestClient.main(TestClient.java:15)
2016-08-08 15:06:30.973/10.787 Oracle Coherence GE 3.6.1.0 <Error> (thread=main, member=n/a): Error while starting service "ExtendTcpCacheService": com.tangosol.net.messaging.ConnectionException: could not establish a connection to one of the following addresses: [169.177.81.97:8088]; make sure the "remote-addresses" configuration element contains an address and port of a running TcpAcceptor
  at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.initiator.TcpInitiator$TcpConnection.open(TcpInitiator.CDB:64)
  at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.Initiator.ensureConnection(Initiator.CDB:12)
  at com.tangosol.coherence.component.net.extend.remoteService.RemoteCacheService.openChannel(RemoteCacheService.CDB:5)
  at com.tangosol.coherence.component.net.extend.RemoteService.doStart(RemoteService.CDB:11)
  at com.tangosol.coherence.component.net.extend.RemoteService.start(RemoteService.CDB:5)
  at com.tangosol.coherence.component.util.SafeService.startService(SafeService.CDB:28)
  at com.tangosol.coherence.component.util.safeService.SafeCacheService.startService(SafeCacheService.CDB:5)
  at com.tangosol.coherence.component.util.SafeService.ensureRunningService(SafeService.CDB:27)
  at com.tangosol.coherence.component.util.SafeService.start(SafeService.CDB:14)
  at com.tangosol.net.DefaultConfigurableCacheFactory.ensureServiceInternal(DefaultConfigurableCacheFactory.java:1057)
  at com.tangosol.net.DefaultConfigurableCacheFactory.ensureService(DefaultConfigurableCacheFactory.java:892)
  at com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultConfigurableCacheFactory.java:874)
  at com.tangosol.net.DefaultConfigurableCacheFactory.configureCache(DefaultConfigurableCacheFactory.java:1231)
  at com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultConfigurableCacheFactory.java:290)
  at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:735)
  at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:712)
  at com.test.TestClient.main(TestClient.java:15)


2016-08-08 15:06:30.974/10.788 Oracle Coherence GE 3.6.1.0 <D5> (thread=ExtendTcpCacheService:TcpInitiator, member=n/a): Stopped: TcpInitiator{Name=ExtendTcpCacheService:TcpInitiator, State=(SERVICE_STOPPED), ThreadCount=0, Codec=Codec(Format=POF), Serializer=com.tangosol.io.DefaultSerializer, PingInterval=0, PingTimeout=5000, RequestTimeout=5000, ConnectTimeout=10000, SocketProvider=SystemSocketProvider, RemoteAddresses=[/169.177.81.97:8088], SocketOptions{LingerTimeout=0, KeepAliveEnabled=true, TcpDelayEnabled=false}}

客户代码:

Tangosol的相干-Override.xml的

<cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config"
   xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config
   coherence-cache-config.xsd">
  <caching-scheme-mapping>
    <cache-mapping>
      <cache-name>dist-extend</cache-name>
      <scheme-name>remote</scheme-name>
    </cache-mapping>
  </caching-scheme-mapping>

  <caching-schemes>
    <remote-cache-scheme>
      <scheme-name>remote</scheme-name>
      <service-name>ExtendTcpCacheService</service-name>
      <initiator-config>
        <tcp-initiator>
          <remote-addresses>
            <socket-address>
              <address>169.177.81.97</address>
              <port>8088</port>
            </socket-address>
          </remote-addresses>
          <connect-timeout>10s</connect-timeout>
        </tcp-initiator>
        <outgoing-message-handler>
          <request-timeout>5s</request-timeout>
        </outgoing-message-handler>
      </initiator-config>
    </remote-cache-scheme>
    <remote-invocation-scheme>
      <scheme-name>extend-invocation</scheme-name>
      <service-name>ExtendTcpInvocationService</service-name>
      <initiator-config>
        <tcp-initiator>
          <remote-addresses>
            <socket-address>
              <address>169.177.81.97</address>
              <port>8088</port>
            </socket-address>
          </remote-addresses>
          <connect-timeout>10s</connect-timeout>
        </tcp-initiator>
        <outgoing-message-handler>
          <request-timeout>5s</request-timeout>
        </outgoing-message-handler>
      </initiator-config>
    </remote-invocation-scheme>

  </caching-schemes>
</cache-config>

例如-config.xml中

<?xml version="1.0"?>


<cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config"
   xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config
   coherence-cache-config.xsd">
  <caching-scheme-mapping>
    <cache-mapping>
      <cache-name>dist-extend</cache-name>
      <scheme-name>remote</scheme-name>
    </cache-mapping>
  </caching-scheme-mapping>

  <caching-schemes>
    <remote-cache-scheme>
      <scheme-name>remote</scheme-name>
      <service-name>ExtendTcpCacheService</service-name>
      <initiator-config>
        <tcp-initiator>
          <remote-addresses>
            <socket-address>
              <address>169.177.81.97</address>
              <port>8088</port>
            </socket-address>
          </remote-addresses>
          <connect-timeout>10s</connect-timeout>
        </tcp-initiator>
        <outgoing-message-handler>
          <request-timeout>5s</request-timeout>
        </outgoing-message-handler>
      </initiator-config>
    </remote-cache-scheme>
    <remote-invocation-scheme>
      <scheme-name>extend-invocation</scheme-name>
      <service-name>ExtendTcpInvocationService</service-name>
      <initiator-config>
        <tcp-initiator>
          <remote-addresses>
            <socket-address>
              <address>169.177.81.97</address>
              <port>8088</port>
            </socket-address>
          </remote-addresses>
          <connect-timeout>10s</connect-timeout>
        </tcp-initiator>
        <outgoing-message-handler>
          <request-timeout>5s</request-timeout>
        </outgoing-message-handler>
      </initiator-config>
    </remote-invocation-scheme>
  </caching->
</cache-config>

TestClient.java

package com.test;


import com.tangosol.net.AbstractInvocable;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.InvocationService;
import com.tangosol.net.NamedCache;
import java.util.Map;


public class TestClient {
    public static void main(String[] asArgs)
            throws Throwable
        {


        NamedCache cache  = CacheFactory.getCache("dist-extend");
        Integer IValue = (Integer) cache.get("key");
        if (IValue == null)
            {
            IValue = new Integer(2);
            }
        else
            {
            IValue = new Integer(IValue.intValue() + 1);
            }
        cache.put("key", 5);


        System.out.print("The value of the key is " + cache.get("key"));
        }
}

服务器启动脚本:

#!/bin/sh


# This will start a cache server


# specify the Coherence installation directory
COHERENCE_HOME=/apps/p1devbDomain/coherence


# specify the JVM heap size
MEMORY=512m


if [ ! -f ${COHERENCE_HOME}/bin/cache-server.sh ]; then
  echo "coherence.sh: must be run from the Coherence installation directory."
  exit
fi


if [ -f $JAVA_HOME/bin/java ]; then
  JAVAEXEC=$JAVA_HOME/bin/java
else
  JAVAEXEC=java
fi


JAVA_OPTS="-Xms$MEMORY -Xmx$MEMORY -Djava.net.preferIPv4Stack=true"
echo $COHERENCE_HOME
echo starting with 



echo  $JAVAEXEC -server -showversion $JAVA_OPTS -cp "$COHERENCE_HOME/lib/coherence.jar;$COHERENCE_HOME/lib/coherence-web-spi.war" -Dtangosol.coherence.management.remote=true -Dtangosol.coherence.cacheconfig=WEB-INF/classes/session-cache-config.xml  -Dtangosol.coherence.distributed.localstorage=true -Dtangosol.coherence.session.localstorage=true com.tangosol.net.DefaultCacheServer $1
echo ----------------------------------------------------
$JAVAEXEC -server -showversion $JAVA_OPTS -cp "$COHERENCE_HOME/lib/coherence.jar:$COHERENCE_HOME/lib/coherence-web-spi.war" -Dtangosol.coherence.management.remote=true  -Dtangosol.coherence.extend.enabled=true -Dtangosol.coherence.cacheconfig=WEB-INF/classes/session-cache-config.xml  -Dtangosol.coherence.distributed.localstorage=true -Dtangosol.coherence.session.localstorage=true com.tangosol.net.DefaultCacheServer $1 &

有人可以为此提供帮助吗。

0 个答案:

没有答案