今天我正在尝试使用 spring 来初始化一些 Geode 组件。我创建的xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd">
<beans>
<gfe:client-cache id="my-cache" pool-name="my-pool"/>
<gfe:pool id="my-pool" subscription-enabled="true">
<gfe:locator host="max" port="10334"/>
</gfe:pool>
</beans>
</beans>
我只是想获取 Geode 的客户端缓存。当我运行下面的代码时:
public class GeodeLauncher {
public static void main(String[] args){
ApplicationContext ac = new FileSystemXmlApplicationContext("classpath:geodeConfig.xml");
ac.getBean("my-cache");
}
}
异常抛出:
Caused by: java.lang.ClassNotFoundException: com.gemstone.gemfire.distributed.DistributedSystem
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 31 more
我在 pom.xml 中添加了依赖项
<dependency>
<groupId>org.apache.geode</groupId>
<artifactId>geode-core</artifactId>
<version>1.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-gemfire -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-geode</artifactId>
<version>1.0.0.APACHE-GEODE-INCUBATING-M2</version>
</dependency>
我注意到包 org.apache.geode.distributed 下有一个名为 DistributedSystem 的同名类。 应该使用这个类吗?为什么需要 com.gemstone.gemfire.distributed.DistributedSystem ?我是不是把xml配置错了?