2017-09-24 75 views
1

我是Apache Geode的新手,嘗試在我的Java應用程序中運行定位器和服務器,但啓動應用程序時出現異常。下面是我使用的起始定位器和服務器的代碼:Apache Geode在Java應用程序中啓動定位器和服務器

public static void locatorStarter() { 
    LocatorLauncher locatorLauncher = new LocatorLauncher.Builder() 
      .setMemberName("locator1") 
      .setPort(13334) 
      .build(); 
    locatorLauncher.start(); 
} 

public static void serverStarter() { 
    ServerLauncher serverLauncher = new ServerLauncher.Builder() 
      .setMemberName("server1") 
      .setServerPort(40404) 
      .build(); 
    serverLauncher.start(); 
} 

當我打電話從主功能我得到下面的異常這些方法:

Exception in thread "main" java.lang.IllegalStateException: A connection to a distributed system already exists in this VM. It has the following configuration: 
    ack-severe-alert-threshold="0" 
    ack-wait-threshold="15" 
    archive-disk-space-limit="0" 
    archive-file-size-limit="0" 
    async-distribution-timeout="0" 
    async-max-queue-size="8" 
    async-queue-timeout="60000" 
    bind-address="" 
    cache-xml-file="" ***(wanted "cache.xml")*** 
    cluster-configuration-dir="" 
    cluster-ssl-ciphers="any" 
    cluster-ssl-enabled="false" 
    cluster-ssl-keystore="" 
    cluster-ssl-keystore-password="" 
    cluster-ssl-keystore-type="" 
    cluster-ssl-protocols="any" 
    cluster-ssl-require-authentication="true" 
    cluster-ssl-truststore="" 
    cluster-ssl-truststore-password="" 
    conflate-events="server" 
    conserve-sockets="true" 
    delta-propagation="true" 
    deploy-working-dir="C:\Users\Fatih Barmanbay\IdeaProjects\geodelucene" 
    disable-auto-reconnect="false" 
    disable-tcp="false" 
    distributed-system-id="-1" 
    distributed-transactions="false" 
    durable-client-id="" 
    durable-client-timeout="300" 
    enable-cluster-configuration="true" 
    enable-network-partition-detection="true" 
    enable-time-statistics="false" 
    enforce-unique-host="false" 
    gateway-ssl-ciphers="any" 
    gateway-ssl-enabled="false" 
    gateway-ssl-keystore="" 
    gateway-ssl-keystore-password="" 
    gateway-ssl-keystore-type="" 
    gateway-ssl-protocols="any" 
    gateway-ssl-require-authentication="true" 
    gateway-ssl-truststore="" 
    gateway-ssl-truststore-password="" 
    groups="" 
    http-service-bind-address="" 
    http-service-port="7070" 
    http-service-ssl-ciphers="any" 
    http-service-ssl-enabled="false" 
    http-service-ssl-keystore="" 
    http-service-ssl-keystore-password="" 
    http-service-ssl-keystore-type="" 
    http-service-ssl-protocols="any" 
    http-service-ssl-require-authentication="false" 
    http-service-ssl-truststore="" 
    http-service-ssl-truststore-password="" 
    jmx-manager="true" ***(wanted "false")*** 
    jmx-manager-access-file="" 
    jmx-manager-bind-address="" 
    jmx-manager-hostname-for-clients="" 
    jmx-manager-http-port="7070" 
    jmx-manager-password-file="" 
    jmx-manager-port="1099" 
    jmx-manager-ssl-ciphers="any" 
    jmx-manager-ssl-enabled="false" 
    jmx-manager-ssl-keystore="" 
    jmx-manager-ssl-keystore-password="" 
    jmx-manager-ssl-keystore-type="" 
    jmx-manager-ssl-protocols="any" 
    jmx-manager-ssl-require-authentication="true" 
    jmx-manager-ssl-truststore="" 
    jmx-manager-ssl-truststore-password="" 
    jmx-manager-start="false" 
    jmx-manager-update-rate="2000" 
    load-cluster-configuration-from-dir="false" 
    locator-wait-time="0" 
    locators="192.168.1.101[13334]" ***(wanted "")*** 
    lock-memory="false" 
    log-disk-space-limit="0" 
    log-file="locator1.log" ***(wanted "server1.log")*** 
    log-file-size-limit="0" 
    log-level="config" 
    max-num-reconnect-tries="3" 
    max-wait-time-reconnect="60000" 
    mcast-address="/239.192.81.1" 
    mcast-flow-control="1048576, 0.25, 5000" 
    mcast-port="0" 
    mcast-recv-buffer-size="1048576" 
    mcast-send-buffer-size="65535" 
    mcast-ttl="32" 
    member-timeout="5000" 
    membership-port-range="[1024,65535]" 
    memcached-bind-address="" 
    memcached-port="0" 
    memcached-protocol="ASCII" 
    name="locator1" ***(wanted "server1")*** 
    off-heap-memory-size="" 
    redis-bind-address="" 
    redis-password="" 
    redis-port="0" 
    redundancy-zone="" 
    remote-locators="" 
    remove-unresponsive-client="false" 
    roles="" 
    security-client-accessor="" 
    security-client-accessor-pp="" 
    security-client-auth-init="" 
    security-client-authenticator="" 
    security-client-dhalgo="" 
    security-log-file="" 
    security-log-level="config" 
    security-manager="" 
    security-peer-auth-init="" 
    security-peer-authenticator="" 
    security-peer-verifymember-timeout="1000" 
    security-post-processor="" 
    security-shiro-init="" 
    security-udp-dhalgo="" 
    server-bind-address="" 
    server-ssl-ciphers="any" 
    server-ssl-enabled="false" 
    server-ssl-keystore="" 
    server-ssl-keystore-password="" 
    server-ssl-keystore-type="" 
    server-ssl-protocols="any" 
    server-ssl-require-authentication="true" 
    server-ssl-truststore="" 
    server-ssl-truststore-password="" 
    socket-buffer-size="32768" 
    socket-lease-time="60000" 
    ssl-ciphers="any" 
    ssl-cluster-alias="" 
    ssl-default-alias="" 
    ssl-enabled-components="[]" 
    ssl-gateway-alias="" 
    ssl-jmx-alias="" 
    ssl-keystore="" 
    ssl-keystore-password="" 
    ssl-keystore-type="" 
    ssl-locator-alias="" 
    ssl-protocols="any" 
    ssl-require-authentication="true" 
    ssl-server-alias="" 
    ssl-truststore="" 
    ssl-truststore-password="" 
    ssl-web-alias="" 
    ssl-web-require-authentication="false" 
    start-dev-rest-api="false" 
    start-locator="" 
    statistic-archive-file="" 
    statistic-sample-rate="1000" 
    statistic-sampling-enabled="true" 
    tcp-port="0" 
    udp-fragment-size="60000" 
    udp-recv-buffer-size="1048576" 
    udp-send-buffer-size="65535" 
    use-cluster-configuration="true" 
    user-command-packages="" 

    at org.apache.geode.distributed.internal.InternalDistributedSystem.validateSameProperties(InternalDistributedSystem.java:2906) 
at org.apache.geode.distributed.DistributedSystem.connect(DistributedSystem.java:193) 
at org.apache.geode.cache.CacheFactory.create(CacheFactory.java:210) 
at org.apache.geode.distributed.internal.DefaultServerLauncherCacheProvider.createCache(DefaultServerLauncherCacheProvider.java:52) 
at org.apache.geode.distributed.ServerLauncher.createCache(ServerLauncher.java:860) 
at org.apache.geode.distributed.ServerLauncher.start(ServerLauncher.java:772) 
at demo.Application.serverStarter(Application.java:25) 
at demo.Application.main(Application.java:9) 
    WARNING: An illegal reflective access operation has occurred 
    WARNING: Illegal reflective access by org.apache.geode.internal.shared.NativeCalls (file:/C:/Users/Fatih%20Barmanbay/.m2/repository/org/apache/geode/geode-core/1.2.1/geode-core-1.2.1.jar) to field java.lang.ProcessEnvironment.theCaseInsensitiveEnvironment 
    WARNING: Please consider reporting this to the maintainers of org.apache.geode.internal.shared.NativeCalls 
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations 
    WARNING: All illegal access operations will be denied in a future release 

是什麼原因造成這個錯誤,怎麼辦我解決了它?

回答

0

當您啓動服務器時,添加start-locator屬性以啓動服務器進程內的嵌入式定位器。有關文檔中的屬性的更多信息。

ServerLauncher serverLauncher = new ServerLauncher.Builder() 
     .setMemberName("server1") 
     .setServerPort(40404) 
     **.set("start-locator", "address[port1]")** 
     .build(); 
    serverLauncher.start(); 
+0

感謝您的回答。對於那些遇到同樣問題的人可以通過在不同的java進程中啓動定位器,服務器和客戶端來解決問題(在自己的主函數或java項目中開始) –

相關問題