enter image description here公共类GemfireTest {
public static void main(String[] args) throws NameResolutionException, TypeMismatchException, QueryInvocationTargetException, FunctionDomainException {
ServerLauncher serverLauncher = new ServerLauncher.Builder()
.setMemberName("server1")
.setServerPort(40404)
.set("start-locator", "127.0.0.1[9090]")
.build();
serverLauncher.start();
String queryString = "SELECT * FROM /gemregion";
ClientCache cache = new ClientCacheFactory().create();
QueryService queryService = cache.getQueryService();
Query query = queryService.newQuery(queryString);
SelectResults results = (SelectResults)query.execute();
int size = results.size();
System.out.println(size);
}
}
试图在我的Java应用程序内部运行定位器和服务器,但出现以下异常:
线程“主”中的异常java.lang.IllegalStateException:A 此VM中已存在与分布式系统的连接。它有 以下配置: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 =“ 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 =“服务器”
conserve-sockets =“ true” delta-propagation =“ true”
deploy-working-dir =“ C:\ Users \ Saranya \ IdeaProjects \ Gemfire”
disable-auto-reconnect =“ false” disable-tcp =“ false”
分布式系统ID =“-1”,分布式事务=“ false”
持久客户端ID =“”持久客户端超时=“ 300”
enable-cluster-configuration =“ true”
enable-network-partition-detection =“ true”
enable-time-statistics =“ false” force-unique-host =“ false”
gateway-ssl-ciphers =“ any” gateway-ssl-enabled =“ false”
gateway-ssl-keystore =“” gateway-ssl-keystore-pass =“ =”
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-pass =“ =”
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 =“ 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 =“ 127.0.0.1 [9090]” (需要““) lock-memory =” false“
log-disk-space-limit =“ 0”
log-file =“ C:\ Users \ Saranya \ IdeaProjects \ Gemfire \ 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 =“ server1” (需要““)
off-heap-memory-size =“” redis-bind-address =“” redis-password =“”
redis-port =“ 0” Redundancy-zone =“” remote-locators =“”
remove-unsensitive-client =“ false” role =“”
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 =“”
serializable-object-filter =“!”服务器绑定地址=“”
server-ssl-ciphers =“ any” server-ssl-enabled =“ false”
server-ssl-keystore =“” server-ssl-keystore-pass =“ =”
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-truststore-type =“” ssl-web-alias =“”
ssl-web-require-authentication =“ false” start-dev-rest-api =“ false”
start-locator =“ 127.0.0.1 [9090]” (需要“”)*
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 =“ =” validate-serializable-objects =“ false”org.apache.geode.distributed.internal.InternalDistributedSystem.validateSameProperties(InternalDistributedSystem.java:2959) 在 org.apache.geode.distributed.DistributedSystem.connect(DistributedSystem.java:199) 在 org.apache.geode.cache.client.ClientCacheFactory.basicCreate(ClientCacheFactory.java:243) 在 org.apache.geode.cache.client.ClientCacheFactory.create(ClientCacheFactory.java:214) 在GemfireTest.main(GemfireTest.java:61)
如何解决此异常?
答案 0 :(得分:0)
这里的错误很容易解释:在一个JVM中,与分布式系统的连接不能超过一个。在这种特殊情况下,您将在同一JVM中同时启动服务器缓存(ServerLauncher
)和客户端缓存(ClientCacheFactory
)。
要解决此问题,请使用两个不同的应用程序或JVM,一个用于服务器,另一个用于执行查询的客户端。
干杯。