ClassNotFoundException:org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl

时间:2017-04-04 12:24:42

标签: spring ignite

嗨,大家好,我是Apache Ignite的新手。 我试图在Windows 10 Professional上运行它。 我在ignite目录中运行了example-cache示例,如下所示:

D:\work\tools\apache ignite 1.9.0\apache-ignite-fabric-1.9.0-bin>bin\ignite.bat examples\config\example-cache.xml

我之前已将IGNITE_HOME环境变量设置为

D:\work\tools\apache ignite 1.9.0\apache-ignite-fabric-1.9.0-bin

但我有这个异常堆栈:

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:946)
        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) [component=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:637)
        at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:840)
        at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:749)
        at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:619)
        at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:589)
        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.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:264)
        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.internal.util.spring.IgniteSpringHelperImpl]
Note! You may use 'USER_LIBS' environment variable to specify your classpath.

我已尝试将IGNITE_HOME设置为D:\work\tools\apache ignite 1.9.0\apache-ignite-fabric-1.9.0-bin\libs,其中包含包含类ignite-spring-1.9.0.jar的jar文件org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl

2 个答案:

答案 0 :(得分:0)

尝试将IGNITE_HOME设置为“D:\ work \ tools \ apache ignite 1.9.0 \ apache-ignite-fabric-1.9.0-bin”。

或USER_LIBS到“D:\ work \ tools \ apache点燃1.9.0 \ apache-ignite-fabric-1.9.0-bin \ libs”,如建议的那样。

答案 1 :(得分:-1)

我只是在设置Ignite并遇到了完全相同的问题(尽管我使用的是Ignite 2.6版)。

我认为在调试$ IGNITE_HOME / bin中的shell脚本后,特别是$ IGNITE_HOME / bin / bin / include / setenv.sh

后,我找到了一个简单的解决方案

解决方法是替换此行形式setenv.sh:

IGNITE_LIBS =“ $ {IGNITE_HOME} / libs / *”

通过另一行代替:

IGNITE_LIBS =“ $ {IGNITE_HOME} / libs / *; $ {IGNITE_HOME} / libs / ignite-spring / *”

恕我直言,这是因为IGNITE_LIBS是在$ IGNITE_HOME / bin / ignite.sh的行中设置类路径的方式

CP =“ $ {IGNITE_LIBS}”

($ CP稍后在Java -cp $ CP调用中用作类路径)。

并且由于类路径通配符不是递归的(请参见例如Set folder for classpath),因此分发中基本上存在一个错误,因为$ IGNITE_HOME / libs / *的类路径永远找不到$ IGNITE_HOME / libs / ignite-spring我相信/ignite-spring-2.6.0.jar是您需要的jar。