Feil under Apache Ignite cache skapelse

stemmer
1

Jeg prøver å skape cache (faktisk nesten kopiere lime fra eksempelkode for å forstå hvordan det fungerer) og bare skrive / lese noen data. Jeg er i stand til å starte Ignite noder, men når, men får en feilmelding med følgende stakksporingen under forsøk på å opprette cache:

 Exception in thread main class org.apache.ignite.IgniteException: Failed to instantiate Spring XML application context (make sure all classes used in Spring configuration are present at CLASSPATH) [springUrl=file:/C:/temp/apache-ignite-fabric-1.7.0-bin/examples/config/example-ignite.xml]
    at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:881)
    at org.apache.ignite.Ignition.start(Ignition.java:349)
    at ignite.HelloWorld.CacheApiExample.main(CacheApiExample.java:18)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to instantiate Spring XML application context (make sure all classes used in Spring configuration are present at CLASSPATH) [springUrl=file:/C:/temp/apache-ignite-fabric-1.7.0-bin/examples/config/example-ignite.xml]
    at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:370)
    at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:87)
    at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:81)
    at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:596)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:774)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:705)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:576)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:546)
    at org.apache.ignite.Ignition.start(Ignition.java:346)
    ... 6 more
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.h2.jdbcx.JdbcDataSource] for bean with name 'h2-example-db' defined in URL [file:/C:/temp/apache-ignite-fabric-1.7.0-bin/examples/config/example-default.xml]; nested exception is java.lang.ClassNotFoundException: org.h2.jdbcx.JdbcDataSource
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1325)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:623)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:592)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1394)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:957)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:705)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:364)
    ... 14 more
Caused by: java.lang.ClassNotFoundException: org.h2.jdbcx.JdbcDataSource
    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 org.springframework.util.ClassUtils.forName(ClassUtils.java:246)
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:395)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1346)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1317)
    ... 22 more

Koden er:

import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.spi.indexing.IndexingQueryFilter;

/**
 * Created by s.kachkin on 9/30/2016.
 */
public class CacheApiExample {
    public static void main(String[] args) throws IgniteException {
        Ignition.setClientMode(true);

        try(Ignite ignite = Ignition.start(examples/config/example-ignite.xml)) {
            CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
            cfg.setName(Democache);
            cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

            IgniteCache<Integer, String> cache = ignite.getOrCreateCache(cfg);

            cache.put(1, cache item 1);
            cache.put(2, cache item 2);

            System.out.println(cache.get(1));
            System.out.println(cache.get(2));
        }
    }
}
Publisert på 04/10/2016 klokken 12:31
bruker
På andre språk...                            


1 svar

stemmer
1

Vær sikker på at $ IGNITE_HOME / libs / antenne-indeksering / * er i klassebanen.

Eller prosjektet må inneholde avhengighet av H2:

<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <version>1.3.175</version>
</dependency>
Svarte 05/10/2016 kl. 12:42
kilden bruker

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more