使用apache的持久存储点燃xml配置

时间:2017-01-02 11:02:53

标签: apache configuration-files ignite persistent-storage

我想使用apache ignite作为我的数据库的缓存,我使用persitent store。 我的数据库是Cassandra,对于配置我使用wiki

通过初始化,我在windows中运行点燃:

  

ignite.bat cassandra-ignite-config.xml

卡桑德拉点燃-config.xml中:

<?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">

    <!-- Cassandra connection settings -->
    <import resource="connection-settings.xml" />

    <!-- Persistence settings for 'cache1' -->
    <bean id="cache1_persistence_settings" class="org.apache.ignite.cache.store.cassandra.utils.persistence.KeyValuePersistenceSettings">
        <constructor-arg type="org.springframework.core.io.Resource" value="persistence-settings-1.xml" />
    </bean>

    <!-- Persistence settings for 'cache2' -->
    <bean id="cache2_persistence_settings" class="org.apache.ignite.cache.store.cassandra.utils.persistence.KeyValuePersistenceSettings">
        <constructor-arg type="org.springframework.core.io.Resource" value="classpath:org/apache/ignite/tests/persistence/blob/persistence-settings-3.xml" />
    </bean>

    <!-- Ignite configuration -->
    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        <property name="cacheConfiguration">
            <list>
                <!-- Configuring persistence for "cache1" cache -->
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="cache1"/>
                    <property name="readThrough" value="true"/>
                    <property name="writeThrough" value="true"/>
                    <property name="cacheStoreFactory">
                        <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
                            <property name="dataSourceBean" value="cassandraAdminDataSource"/>
                            <property name="persistenceSettingsBean" value="cache1_persistence_settings"/>
                        </bean>
                    </property>
                </bean>

                <!-- Configuring persistence for "cache2" cache -->
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="cache2"/>
                    <property name="readThrough" value="true"/>
                    <property name="writeThrough" value="true"/>
                    <property name="cacheStoreFactory">
                        <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
                            <property name="dataSourceBean" value="cassandraAdminDataSource"/>
                            <property name="persistenceSettingsBean" value="cache2_persistence_settings"/>
                        </bean>
                    </property>
                </bean>
            </list>
        </property>

        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
        <property name="discoverySpi">
            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
                <property name="ipFinder">
                    <!--
                        Ignite provides several options for automatic discovery that can be used
                        instead os static IP based discovery. For information on all options refer
                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
                    -->
                    <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
                    <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                        <property name="addresses">
                            <list>
                                <!-- In distributed environment, replace with actual host IP address. -->
                                <value>127.0.0.1:47500..47509</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>
</beans>

连接Setting.xml的:

<?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 id="cassandraAdminCredentials" class="org.apache.ignite.tests.utils.CassandraAdminCredentials"/>

    <bean id="loadBalancingPolicy" class="com.datastax.driver.core.policies.RoundRobinPolicy"/>

    <bean id="contactPoints" class="org.apache.ignite.tests.utils.CassandraHelper" factory-method="getContactPointsArray"/>

    <bean id="cassandraAdminDataSource" class="org.apache.ignite.cache.store.cassandra.utils.datasource.DataSource">
        <property name="credentials" ref="cassandraAdminCredentials"/>
        <property name="contactPoints" ref="contactPoints"/>
        <property name="readConsistency" value="ONE"/>
        <property name="writeConsistency" value="ONE"/>
        <property name="loadBalancingPolicy" ref="loadBalancingPolicy"/>
    </bean>
</beans>

持久性定型-1.XML:

<persistence keyspace="test1" table="my_table">
    <keyPersistence class="java.lang.Integer" strategy="PRIMITIVE" column="my_key"/>
    <valuePersistence class="java.lang.String" strategy="PRIMITIVE" />
</persistence>

但我有这个错误:

  

class org.apache.ignite.IgniteException:无法实例化Spring   XML应用程序上下文(确保在Spring中使用所有类   配置出现在CLASSPATH)   [springUrl =文件:〜/配置/卡桑德拉点燃-config.xml中]           at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:927)           在org.apache.ignite.Ignition.start(Ignition.java:350)           在org.apache.ignite.startup.cmdline.CommandLineStartup.main(CommandLineStartup.java:302)   引起:class org.apache.ignite.IgniteCheckedException:失败   实例化Spring XML应用程序上下文(确保使用所有类   在Spring配置中出现在CLASSPATH)   [springUrl =文件:〜/配置/卡桑德拉点燃-config.xml中]           at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:387)           在org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:104)           at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:98)           at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:638)           在org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:839)           在org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:748)           在org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:618)           在org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:588)           在org.apache.ignite.Ignition.start(Ignition.java:347)           ... 1更多引起:org.springframework.beans.factory.CannotLoadBeanClassException:不能   找到类[org.apache.ignite.tests.utils.CassandraAdminCredentials]   对于名称为&caCEandraAdminCredentials&#39;在URL中定义   [文件:〜/配置/连接的settings.xml];嵌套异常是   java.lang.ClassNotFoundException:org.apache.ignite.tests.utils.Cassan   draAdminCredentials           在org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1325)           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:623)           在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:592)           在org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1394)           在org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:957)           at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:705)           在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)           在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)           at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:381)           ... 9更多引起:java.lang.ClassNotFoundException:org.apache.ignite.tests.utils.CassandraAdminCredentials           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)           在org.springframework.util.ClassUtils.forName(ClassUtils.java:246)           在org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:395)           在org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1346)           在org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1317)           ... 17更多启动网格失败:无法实例化Spring XML应用程序上下文(确保Spring中使用的所有类   配置出现在CLASSPATH)   [springUrl =〜/配置/卡桑德拉点燃-config.xml中]   注意!您可以使用&#39; USER_LIBS&#39;环境变量,用于指定类路径。按任意键继续 。 。

似乎有些事情错过了,但我不明白。

更新

我使用base-conceptsexamples的第4个示例。 但是知道我有pojo示例的序列化问题。

错误:

[16:24:11,033][SEVERE][tcp-disco-msg-worker-#2%null%][TcpDiscoverySpi] Failed to unmarshal discovery data for component: 1
class org.apache.ignite.IgniteCheckedException: Failed to deserialize object with given class loader: sun.misc.Launcher$AppClassLoader@5e9f23b4
    at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:128)
    at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:94)
    at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:142)
    at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:82)
    at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9779)
    at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.onExchange(TcpDiscoverySpi.java:1716)
    at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processNodeAddedMessage(ServerImpl.java:4216)
    at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processMessage(ServerImpl.java:2538)
    at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.processMessage(ServerImpl.java:2362)
    at org.apache.ignite.spi.discovery.tcp.ServerImpl$MessageWorkerAdapter.body(ServerImpl.java:6436)
    at org.apache.ignite.spi.discovery.tcp.ServerImpl$RingMessageWorker.body(ServerImpl.java:2445)
    at org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:62)
Caused by: java.io.InvalidClassException: org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings; local class incompatible: stream classdesc serialVersionUID = -3543390829981374356, local class serialVersionUID = 4263059111698998196
    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:616)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1630)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2018)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1942)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2018)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1942)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2018)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1942)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
    at java.util.ArrayList.readObject(ArrayList.java:791)
    at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1909)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2018)
    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1942)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1808)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
    at org.apache.ignite.marshaller.jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:120)
    ... 11 more

更新2:

我的pom文件:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>

        <groupId>aryahamrah.ds</groupId>
        <artifactId>igniteHello</artifactId>
        <version>1.0-SNAPSHOT</version>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>


        <dependencies>
            <dependency>
                <groupId>org.apache.ignite</groupId>
                <artifactId>ignite-core</artifactId>
                <version>1.8.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.ignite</groupId>
                <artifactId>ignite-spring</artifactId>
                <version>1.8.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.ignite</groupId>
                <artifactId>ignite-indexing</artifactId>
                <version>1.8.0</version>
            </dependency>




            <!--for cassandra -->

            <!-- https://mvnrepository.com/artifact/org.apache.cassandra/cassandra-all -->
            <dependency>
                <groupId>org.apache.cassandra</groupId>
                <artifactId>cassandra-all</artifactId>
                <version>3.9</version>
            </dependency>
            <!--&lt;!&ndash; https://mvnrepository.com/artifact/com.datastax.cassandra/cassandra-driver-core &ndash;&gt;-->
            <dependency>
                <groupId>com.datastax.cassandra</groupId>
                <artifactId>cassandra-driver-core</artifactId>
                <version>3.1.2</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/com.google.collections/google-collections -->
            <dependency>
                <groupId>com.google.collections</groupId>
                <artifactId>google-collections</artifactId>
                <version>1.0</version>
            </dependency>

            <!--&lt;!&ndash; https://mvnrepository.com/artifact/org.apache.ignite/ignite-cassandra-store &ndash;&gt;-->
            <!--<dependency>-->
                <!--<groupId>org.apache.ignite</groupId>-->
                <!--<artifactId>ignite-cassandra-store</artifactId>-->
                <!--<version>1.8.0</version>-->
            <!--</dependency>-->

            <!-- https://mvnrepository.com/artifact/org.apache.ignite/ignite-cassandra -->
            <dependency>
                <groupId>org.apache.ignite</groupId>
                <artifactId>ignite-cassandra</artifactId>
                <version>1.7.0</version>
            </dependency>


            <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.22</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>1.7.22</version>
            </dependency>


        </dependencies>
    </project>

连接Setting.xml的:

<?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 id="loadBalancingPolicy" class="com.datastax.driver.core.policies.TokenAwarePolicy">
        <constructor-arg type="com.datastax.driver.core.policies.LoadBalancingPolicy">
            <bean class="com.datastax.driver.core.policies.RoundRobinPolicy"/>
        </constructor-arg>
    </bean>

    <bean id="cassandraAdminDataSource" class="org.apache.ignite.cache.store.cassandra.datasource.DataSource">
        <property name="readConsistency" value="ONE"/>
        <property name="writeConsistency" value="ONE"/>
        <property name="loadBalancingPolicy" ref="loadBalancingPolicy"/>
    </bean>

    <bean id="cassandraRegularDataSource" class="org.apache.ignite.cache.store.cassandra.datasource.DataSource">
        <property name="readConsistency" value="ONE"/>
        <property name="writeConsistency" value="ONE"/>
        <property name="loadBalancingPolicy" ref="loadBalancingPolicy"/>
    </bean>
</beans>

更新3:

当我放入缓存时没有任何反应,但是当我想要获取时,我有这些错误:

[15:16:16,008][SEVERE][pub-#53%null%][GridTaskWorker] Failed to obtain remote job result policy for result from ComputeTask.result(..) method (will fail the whole task): GridJobResultImpl [job=C4V2 [r=HelloWorld$$Lambda$8/98974893@5977d9a0], sib=GridJobSiblingImpl [sesId=c92fc496951-0257bdb2-3066-4861-8c60-47febea167d5, jobId=d92fc496951-0257bdb2-3066-4861-8c60-47febea167d5, nodeId=f2c7d14b-401f-4aea-a9af-50deeb7cb85e, isJobDone=false], jobCtx=GridJobContextImpl [jobId=d92fc496951-0257bdb2-3066-4861-8c60-47febea167d5, timeoutObj=null, attrs={}], node=TcpDiscoveryNode [id=f2c7d14b-401f-4aea-a9af-50deeb7cb85e, addrs=[0:0:0:0:0:0:0:1, 127.0.0.1, 192.168.1.113], sockAddrs=[LT-88273/169.254.247.78:47500, /0:0:0:0:0:0:0:1:47500, /127.0.0.1:47500, /192.168.1.113:47500], discPort=47500, order=1, intOrder=1, lastExchangeTime=1483530374957, loc=false, ver=1.8.0#20161205-sha1:9ca40dbe, isClient=false], ex=class o.a.i.IgniteException: HelloWorld, hasRes=true, isCancelled=false, isOccupied=true]
class org.apache.ignite.IgniteException: Remote job threw user exception (override or implement ComputeTask.result(..) method if you would like to have automatic failover for this exception).
    at org.apache.ignite.compute.ComputeTaskAdapter.result(ComputeTaskAdapter.java:101)
    at org.apache.ignite.internal.processors.task.GridTaskWorker$5.apply(GridTaskWorker.java:1030)
    at org.apache.ignite.internal.processors.task.GridTaskWorker$5.apply(GridTaskWorker.java:1023)
    at org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6596)
    at org.apache.ignite.internal.processors.task.GridTaskWorker.result(GridTaskWorker.java:1023)
    at org.apache.ignite.internal.processors.task.GridTaskWorker.onResponse(GridTaskWorker.java:841)
    at org.apache.ignite.internal.processors.task.GridTaskProcessor.processJobExecuteResponse(GridTaskProcessor.java:996)
    at org.apache.ignite.internal.processors.job.GridJobWorker.finishJob(GridJobWorker.java:843)
    at org.apache.ignite.internal.processors.job.GridJobWorker.finishJob(GridJobWorker.java:745)
    at org.apache.ignite.internal.processors.job.GridJobWorker.execute0(GridJobWorker.java:608)
    at org.apache.ignite.internal.processors.job.GridJobWorker.body(GridJobWorker.java:479)
    at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: class org.apache.ignite.IgniteException: HelloWorld
    at org.apache.ignite.internal.processors.job.GridJobWorker.initialize(GridJobWorker.java:447)
    at org.apache.ignite.internal.processors.job.GridJobProcessor.processJobExecuteRequest(GridJobProcessor.java:1108)
    at org.apache.ignite.internal.processors.job.GridJobProcessor$JobExecutionListener.onMessage(GridJobProcessor.java:1894)
    at org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1082)
    at org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:710)
    at org.apache.ignite.internal.managers.communication.GridIoManager.access$1700(GridIoManager.java:102)
    at org.apache.ignite.internal.managers.communication.GridIoManager$5.run(GridIoManager.java:673)
    ... 3 more
Caused by: class org.apache.ignite.IgniteCheckedException: HelloWorld
    at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9785)
    at org.apache.ignite.internal.processors.job.GridJobWorker.initialize(GridJobWorker.java:428)
    ... 9 more
Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException: HelloWorld
    at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:689)
    at org.apache.ignite.internal.binary.BinaryUtils.doReadClass(BinaryUtils.java:1480)
    at org.apache.ignite.internal.binary.BinaryUtils.doReadClass(BinaryUtils.java:1418)
    at org.apache.ignite.internal.binary.BinaryReaderExImpl.readClass(BinaryReaderExImpl.java:370)
    at org.apache.ignite.internal.binary.BinaryFieldAccessor$DefaultFinalClassAccessor.readFixedType(BinaryFieldAccessor.java:828)
    at org.apache.ignite.internal.binary.BinaryFieldAccessor$DefaultFinalClassAccessor.read(BinaryFieldAccessor.java:639)
    at org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:829)
    at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1498)
    at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1450)
    at org.apache.ignite.internal.binary.BinaryUtils.doReadObject(BinaryUtils.java:1634)
    at org.apache.ignite.internal.binary.BinaryReaderExImpl.readObject(BinaryReaderExImpl.java:1124)
    at org.apache.ignite.internal.processors.closure.GridClosureProcessor$C4V2.readBinary(GridClosureProcessor.java:2230)
    at org.apache.ignite.internal.binary.BinaryClassDescriptor.read(BinaryClassDescriptor.java:819)
    at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1498)
    at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1450)
    at org.apache.ignite.internal.binary.GridBinaryMarshaller.deserialize(GridBinaryMarshaller.java:298)
    at org.apache.ignite.internal.binary.BinaryMarshaller.unmarshal0(BinaryMarshaller.java:100)
    at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:82)
    at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:9779)
    ... 10 more
Caused by: java.lang.ClassNotFoundException: HelloWorld
    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)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8393)
    at org.apache.ignite.internal.MarshallerContextAdapter.getClass(MarshallerContextAdapter.java:185)
    at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:680)
    ... 28 more

2 个答案:

答案 0 :(得分:1)

对于使用ignite作为cassandra数据库的缓存,首先,最好阅读这些文档:

现在,您可以使用您想要的任何节点运行点火,但您必须考虑两件事:

  1. 首先,你必须使用为cassandra配置的xml运行点火 连接
  2. 第二,您必须添加相关的jar文件才能运行 点燃-卡桑德拉
  3. 对于简单的cassandra配置,您可以使用this并为您的代码生成依赖jar文件,您可以使用maven-dependency-plugin copy-dependency目标在依赖文件夹中生成jar文件你的目标文件。

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
            <execution>
                <id>copy</id>
                <phase>package</phase>
                <goals>
                    <goal>copy-dependencies</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    

    编译代码后,可以将依赖项文件夹添加到点燃库的路径或添加到USER_LIBS路径。现在,您需要实现您的Java代码。为此,我使用class PersonId并将其配置为this xml。 [提示:您需要将项目jar文件添加到点火路径。]

    现在,你可以运行你的点燃,然后运行your code并查看结果。

答案 1 :(得分:0)

对于使用Cassandra作为持久存储,您不需要CassandraAdminCredentials,因为它仅用于测试。您可以查看https://apacheignite-mix.readme.io/docs/ignite-with-apache-cassandrahttps://apacheignite-mix.readme.io/docs/base-concepts

的示例配置

CassandraAdminCredentials类仅适用于Ignite单元测试源。如果您想使用它,您应该从源代码构建Ignite。这样,它将创建ignite-cassandra-tests - $ {project.version} .zip,其中jar可以找到包含所有测试类的jar文件。