问题
Hi Guys I'm newbie in Apache Ignite. I've tried to run it on Windows 10 Professional. I've run example-cache example in ignite directory as follows :
D:\work\tools\apache ignite 1.9.0\apache-ignite-fabric-1.9.0-bin>bin\ignite.bat examples\config\example-cache.xml
I've previously set IGNITE_HOME environment variable to
D:\work\tools\apache ignite 1.9.0\apache-ignite-fabric-1.9.0-bin
But I have this exception stack :
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.
I've tried to set IGNITE_HOME to D:\work\tools\apache ignite 1.9.0\apache-ignite-fabric-1.9.0-bin\libs
which contains the jar file ignite-spring-1.9.0.jar
containing the class org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl
回答1:
Try to set IGNITE_HOME to "D:\work\tools\apache ignite 1.9.0\apache-ignite-fabric-1.9.0-bin".
Or USER_LIBS to "D:\work\tools\apache ignite 1.9.0\apache-ignite-fabric-1.9.0-bin\libs" as it was suggested.
回答2:
I am just setting up Ignite and had exactly the same problem (I am in Ignite version 2.6 though).
I think I found a simple solution after debugging the shell scripts in $IGNITE_HOME/bin, particularly $IGNITE_HOME/bin/include/setenv.sh
The fix is to replace this line form setenv.sh:
IGNITE_LIBS="${IGNITE_HOME}/libs/*"
by this other line instead:
IGNITE_LIBS="${IGNITE_HOME}/libs/*;${IGNITE_HOME}/libs/ignite-spring/*"
The reason this works IMHO is that IGNITE_LIBS is how the classpath is set in $IGNITE_HOME/bin/ignite.sh, in the line
CP="${IGNITE_LIBS}"
($CP is later used as the class path in a Java -cp $CP call).
And since the classpath wildcards are not recursive (see e.g. Set folder for classpath), there is basically a bug in the distribution because a classpath of $IGNITE_HOME/libs/* will never find $IGNITE_HOME/libs/ignite-spring/ignite-spring-2.6.0.jar which is the jar you need, I believe.
来源:https://stackoverflow.com/questions/43207186/classnotfoundexception-org-apache-ignite-internal-util-spring-ignitespringhelpe