我正在尝试将Apache Ignite集成到我的另一个Spring Boot Java应用程序中,这是我的pom.xml依赖项看起来像
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-core</artifactId>
<version>${gridgain.version}</version>
</dependency>
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-spring</artifactId>
<version>${gridgain.version}</version>
</dependency>
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-indexing</artifactId>
<version>${gridgain.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-rest-http</artifactId>
<version>${apache.ignite.version}</version>
</dependency>
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-log4j</artifactId>
<version>${gridgain.version}</version>
</dependency>
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-spring-data_2.0</artifactId>
<version>${gridgain.version}</version>
</dependency>
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-ml</artifactId>
<version>${gridgain.version}</version>
</dependency>
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-ml-xgboost-model-parser</artifactId>
<version>${gridgain.version}</version>
</dependency>
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-ml-spark-model-parser</artifactId>
<version>${gridgain.version}</version>
</dependency>
<dependency>
<groupId>org.gridgain</groupId>
<artifactId>ignite-ml-tensorflow-model-parser</artifactId>
<version>${gridgain.version}</version>
</dependency>
在绝望中,我包括了gridgain示例项目中包含的所有依赖项。 这是我尝试创建缓存的非常简单的代码:
try (Ignite ignite = Ignition.start("config/dev.config.client.xml"))
{
ignite.configuration().setClientMode(true);
//I have ccfg defined in code where I create a cache configuration
ignite.addCacheConfiguration(ccfg);
try (IgniteCache<String, CacheResponse> cache = ignite.getOrCreateCache(ccfg))
{
LOGGER.debug("Should have created a cache now");
}
}
这是我的点火配置文件。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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">
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="clientMode" value="true"/>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<value>HOST1:47500..47509</value>
<value>HOST2:47500..47509</value>
<value>HOST3:47500..47509</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
运行应用程序时,出现以下异常:
原因: org.springframework.beans.factory.CannotLoadBeanClassException:无法 查找类[org.apache.ignite.configuration.IgniteConfiguration] 名称为“ org.apache.ignite.configuration.IgniteConfiguration#0”的bean 在URL中定义 [文件:/ C:/Work/Java/gravitee.io/1.30.1/graviteeio-gateway-1.30.1/config/dev.config.client.xml]; 嵌套的异常是java.lang.ClassNotFoundException: org.apache.ignite.configuration.IgniteConfiguration