Не могу запустить Apache Зажечь клиента программно - PullRequest
0 голосов
/ 02 марта 2020

Я пытаюсь интегрировать Apache Ignite в другое приложение весенней загрузки, и я пытаюсь запустить клиент Ignite и создать кеш, как показано ниже:

TcpDiscoverySpi spi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Arrays.asList("HOST1:47500..47509", "HOST2:47500..47509", "HOST3:47500..47509"));
spi.setIpFinder(ipFinder);
Duration duration = new Duration(TimeUnit.SECONDS, 5000);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName("ignite-client-node");
cfg.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(duration));
cfg.setDiscoverySpi(spi);
cfg.setClientMode(true);
CacheConfiguration ccfg1 = new CacheConfiguration("PersonCache");
ccfg1.setIndexedTypes(String.class, String.class);
cfg.setCacheConfiguration(ccfg1);
Ignition.start(cfg);

Вот мой файл pom. xml

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

    <repositories>
        <repository>
            <id>GridGain Repository</id>
            <url>http://www.gridgainsystems.com/nexus/content/repositories/external</url>
        </repository>
    </repositories>

    <parent>
        <groupId>io.gravitee</groupId>
        <artifactId>gravitee-parent</artifactId>
        <version>15</version>
    </parent>

    <groupId>io.gravitee.resource</groupId>
    <artifactId>gravitee-resource-ignite</artifactId>
    <version>1.0.0-SNAPSHOT</version>

    <name>Gravitee.io APIM - Resource - Ignite</name>

    <properties>
        <h2.version>1.4.197</h2.version>
        <gravitee-resource-api.version>1.1.0</gravitee-resource-api.version>
        <gridgain.version>8.7.12</gridgain.version>
        <apache.ignite.version>2.7.6</apache.ignite.version>
        <maven-assembly-plugin.version>2.5.5</maven-assembly-plugin.version>
        <io-gravitee-policy-cache-version>1.6.0</io-gravitee-policy-cache-version>
    </properties>

    <dependencies>
        <!-- Gravitee.io API-->
        <dependency>
            <groupId>io.gravitee.resource</groupId>
            <artifactId>gravitee-resource-api</artifactId>
            <version>${gravitee-resource-api.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.gravitee.policy</groupId>
            <artifactId>gravitee-policy-cache</artifactId>
            <version>${io-gravitee-policy-cache-version}</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>5.2.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>5.2.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.2.3.RELEASE</version>
        </dependency>

        <!-- GridGain -->
        <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>

    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven-assembly-plugin.version}</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptors>
                        <descriptor>src/assembly/resource-assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-resource-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>copy-to-gateway</id>
                        <phase>install</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>C:\Work\Java\gravitee.io\1.30.1\graviteeio-gateway-1.30.1\plugins
                            </outputDirectory>
                            <resources>
                                <resource>
                                    <directory>/target</directory>
                                    <includes>
                                        <include>*.zip</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-to-management-api</id>
                        <phase>install</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>C:\Work\Java\gravitee.io\1.30.1\graviteeio-management-api-1.30.1\plugins
                            </outputDirectory>
                            <resources>
                                <resource>
                                    <directory>/target</directory>
                                    <includes>
                                        <include>*.zip</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Как только этот код запускается, я получаю следующую ошибку:

2020-03-02 13:38:31,649][ERROR][sync-1][IgniteKernal] Exception during start processors, node will be stopped and close connections
java.lang.NoSuchMethodError: org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager.registerExchangeAwareComponent(Lorg/apache/ignite/internal/processors/cache/distributed/dht/preloader/PartitionsExchangeAware;)V
    at org.apache.ignite.internal.processors.query.h2.twostep.PartitionReservationManager.<init>(PartitionReservationManager.java:79)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.start(IgniteH2Indexing.java:2100)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.start(GridQueryProcessor.java:248)
    at org.apache.ignite.internal.IgniteKernal.startProcessor(IgniteKernal.java:1700)
    at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1017)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:2038)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1730)
    at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1158)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:678)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:603)
    at org.apache.ignite.Ignition.start(Ignition.java:323)
    at io.gravitee.resource.ignite.CacheResource.InitializeIgniteCache(CacheResource.java:98)
    at io.gravitee.resource.ignite.CacheResource.doStart(CacheResource.java:60)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.gateway.resource.internal.ResourceManagerImpl.lambda$doStart$0(ResourceManagerImpl.java:66)
    at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1696)
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
    at io.gravitee.gateway.resource.internal.ResourceManagerImpl.doStart(ResourceManagerImpl.java:63)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.gateway.handlers.api.ApiReactorHandler.doStart(ApiReactorHandler.java:225)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.gateway.reactor.handler.impl.DefaultReactorHandlerRegistry.prepare(DefaultReactorHandlerRegistry.java:98)
    at io.gravitee.gateway.reactor.handler.impl.DefaultReactorHandlerRegistry.create(DefaultReactorHandlerRegistry.java:49)
    at io.gravitee.gateway.reactor.impl.DefaultReactor.onEvent(DefaultReactor.java:124)
    at io.gravitee.common.event.impl.EventManagerImpl.publishEvent(EventManagerImpl.java:44)
    at io.gravitee.common.event.impl.EventManagerImpl.publishEvent(EventManagerImpl.java:36)
    at io.gravitee.gateway.handlers.api.manager.impl.ApiManagerImpl.deploy(ApiManagerImpl.java:67)
    at io.gravitee.gateway.services.sync.SyncManager.lambda$computeApiEvents$11(SyncManager.java:244)
    at java.util.HashMap.forEach(HashMap.java:1289)
    at io.gravitee.gateway.services.sync.SyncManager.computeApiEvents(SyncManager.java:212)
    at io.gravitee.gateway.services.sync.SyncManager.synchronizeApis(SyncManager.java:153)
    at io.gravitee.gateway.services.sync.SyncManager.refresh(SyncManager.java:101)
    at io.gravitee.gateway.services.sync.ScheduledSyncService.run(ScheduledSyncService.java:87)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
    at java.util.concurrent.FutureTask.run(FutureTask.java)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
[2020-03-02 13:38:31,651][ERROR][sync-1][IgniteKernal] Got exception while starting (will rollback startup routine).
java.lang.NoSuchMethodError: org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager.registerExchangeAwareComponent(Lorg/apache/ignite/internal/processors/cache/distributed/dht/preloader/PartitionsExchangeAware;)V
    at org.apache.ignite.internal.processors.query.h2.twostep.PartitionReservationManager.<init>(PartitionReservationManager.java:79)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.start(IgniteH2Indexing.java:2100)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.start(GridQueryProcessor.java:248)
    at org.apache.ignite.internal.IgniteKernal.startProcessor(IgniteKernal.java:1700)
    at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1017)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:2038)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1730)
    at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1158)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:678)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:603)
    at org.apache.ignite.Ignition.start(Ignition.java:323)
    at io.gravitee.resource.ignite.CacheResource.InitializeIgniteCache(CacheResource.java:98)
    at io.gravitee.resource.ignite.CacheResource.doStart(CacheResource.java:60)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.gateway.resource.internal.ResourceManagerImpl.lambda$doStart$0(ResourceManagerImpl.java:66)
    at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1696)
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
    at io.gravitee.gateway.resource.internal.ResourceManagerImpl.doStart(ResourceManagerImpl.java:63)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.gateway.handlers.api.ApiReactorHandler.doStart(ApiReactorHandler.java:225)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.gateway.reactor.handler.impl.DefaultReactorHandlerRegistry.prepare(DefaultReactorHandlerRegistry.java:98)
    at io.gravitee.gateway.reactor.handler.impl.DefaultReactorHandlerRegistry.create(DefaultReactorHandlerRegistry.java:49)
    at io.gravitee.gateway.reactor.impl.DefaultReactor.onEvent(DefaultReactor.java:124)
    at io.gravitee.common.event.impl.EventManagerImpl.publishEvent(EventManagerImpl.java:44)
    at io.gravitee.common.event.impl.EventManagerImpl.publishEvent(EventManagerImpl.java:36)
    at io.gravitee.gateway.handlers.api.manager.impl.ApiManagerImpl.deploy(ApiManagerImpl.java:67)
    at io.gravitee.gateway.services.sync.SyncManager.lambda$computeApiEvents$11(SyncManager.java:244)
    at java.util.HashMap.forEach(HashMap.java:1289)
    at io.gravitee.gateway.services.sync.SyncManager.computeApiEvents(SyncManager.java:212)
    at io.gravitee.gateway.services.sync.SyncManager.synchronizeApis(SyncManager.java:153)
    at io.gravitee.gateway.services.sync.SyncManager.refresh(SyncManager.java:101)
    at io.gravitee.gateway.services.sync.ScheduledSyncService.run(ScheduledSyncService.java:87)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
    at java.util.concurrent.FutureTask.run(FutureTask.java)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

Может кто-нибудь помочь мне выяснить, что может быть с ним не так? Я очень новичок в Java.

Когда я запускаю тонкий клиент java, он работает нормально. Проблема с тонким клиентом заключается в том, что я не могу установить TTL (пожалуйста, дайте мне знать, если это не так. Я действительно хотел бы запустить тонкий клиент для создания кэшей.) Для получения и установки я собираюсь использовать тонкий клиент, так что не проблема.

Спасибо

Спасибо

1 Ответ

0 голосов
/ 03 марта 2020

Вам нужно изменить

    <dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-rest-http</artifactId>
        <version>${apache.ignite.version}</version>
    </dependency>

на org.gridgain: ignite-rest-http: $ gridgain.version

В противном случае вы создали множество классов разных версий в вашем CLASSPATH.

...