Apache Ignite:无法启动网格:无法创建 Ignite 组件

Apache Ignite: Failed to start grid: Failed to create Ignite component

我正在尝试学习 Apache Ignite,但在此过程中遇到错误。

  1. 我下载了apache-ignite-fabric-2.4.0
  2. 解压到apache-ignite-fabric-2.4.0-bin
  3. 设置环境变量IGNITE_HOME
C:\devTools\apache-ignite-fabric-2.4.0-bin>echo %IGNITE_HOME%
C:\devTools\apache-ignite-fabric-2.4.0-bin

然后我尝试执行 C:\devTools\apache-ignite-fabric-2.4.0-bin>sh bin/ignite.sh examples/config/example-ignite.xml,然后 C:\devTools\apache-ignite-fabric-2.4.0-bin>sh bin/ignite.sh,但得到了同样的错误。

C:\devTools\apache-ignite-fabric-2.4.0-bin>sh bin/ignite.sh
class org.apache.ignite.IgniteException: Failed to create Ignite component (consider adding ignite-spring module to classpath) [component=SPRING, cls=
org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl]
        at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:980)
        at org.apache.ignite.Ignition.start(Ignition.java:350)
        at org.apache.ignite.startup.cmdline.CommandLineStartup.main(CommandLineStartup.java:302)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to create Ignite component (consider adding ignite-spring module to classpath) [comp
onent=SPRING, cls=org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl]
        at org.apache.ignite.internal.IgniteComponentType.componentException(IgniteComponentType.java:320)
        at org.apache.ignite.internal.IgniteComponentType.create0(IgniteComponentType.java:296)
        at org.apache.ignite.internal.IgniteComponentType.create(IgniteComponentType.java:207)
        at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:735)
        at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:938)
        at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:847)
        at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:717)
        at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:686)
        at org.apache.ignite.Ignition.start(Ignition.java:347)
        ... 1 more
Caused by: java.lang.ClassNotFoundException: org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl
        at java.net.URLClassLoader.run(URLClassLoader.java:372)
        at java.net.URLClassLoader.run(URLClassLoader.java:361)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:259)
        at org.apache.ignite.internal.IgniteComponentType.create0(IgniteComponentType.java:282)
        ... 8 more
Failed to start grid: Failed to create Ignite component (consider adding ignite-spring module to classpath) [component=SPRING, cls=org.apache.ignite.i
nternal.util.spring.IgniteSpringHelperImpl]
Note! You may use 'USER_LIBS' environment variable to specify your classpath.

我只是按照 http://ggfabric.blogspot.com/2015/12/apache-ignite-hello-world-example.html 的说明进行操作 和 https://apacheignite.readme.io/docs/getting-started#launching-first-ignite-cluster

SO 上也有类似的问题:ClassNotFoundException: org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl 但帮助不大。

有 Windows 的 .bat 脚本,您应该使用它们而不是 .sh

尝试将配置添加为参数。

ignite.sh examples/config/example-ignite.xml

我在 Windows 10 上使用了 Cygwin,如果您将 USER_LIBS 环境变量设置为下一个,Ignite 工作正常:

/cygdrive/c/GridGain/2.5/apache-ignite-fabric-2.5.0-bin/bin
$ ./ignite.sh
[09:55:31]    __________  ________________
[09:55:31]   /  _/ ___/ |/ /  _/_  __/ __/
[09:55:31]  _/ // (7 7    // /  / / / _/
[09:55:31] /___/\___/_/|_/___/ /_/ /___/
[09:55:31]
[09:55:31] ver. 2.5.0#20180523-sha1:86e110c7
[09:55:31] 2018 Copyright(C) Apache Software Foundation
[09:55:31]
[09:55:31] Ignite documentation: http://ignite.apache.org