我是ApacheIgnite的新手,需要通过java访问igfs文件。到目前为止,我尝试的是:
import java.io.InputStream;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteFileSystem;
import org.apache.ignite.Ignition;
import org.apache.ignite.igfs.IgfsPath;
public class Ignite_Spark {
public static void main(String[] args) throws Exception {
Ignite ignite = Ignition.start("/usr/local/hadoop/apache-ignite-hadoop-1.6.0-bin/config/default-config.xml");
Ignite ignites = Ignition.ignite();
IgniteFileSystem fs = ignites.fileSystem("igfs");
IgfsPath workDir = new IgfsPath("igfs://localhost:8020/ignite/fs");
fs.mkdirs(workDir);
IgfsPath filePath = new IgfsPath(workDir, "ttypes.csv");
try (InputStream in = fs.open(filePath)) {
in.read();
}
}
}
但当我运行这个程序时,我得到了如下异常:
原因:class org.apache.ignite.ignitecheckedexception:未能示例化SpringXML应用程序上下文(确保spring配置中使用的所有类都存在于类路径中)[springurl=file:/usr/local/hadoop/ignite/config/default config.xml]
2条答案
按热度按时间oipij1gg1#
qncylg1j2#
我相信您可能需要包含IgniteSpringMVN依赖项,以便使用spring.xml文件启动ignite。