点燃具有绝对路径的配置

时间:2018-07-05 13:16:14

标签: ignite

我下载了Ignite 2.5.0(在Mac上的Java类中,我在Mac上的Eclipse中使用了Maven依赖项),然后尝试使用带有绝对路径的配置文件启动Ignite:

public static void main(String [] args) throws Exception {
    try (Ignite ignite = Ignition.start("/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml")) {}
}

但我有例外:

Exception in thread "main" class org.apache.ignite.IgniteException: Failed to find configuration in: file:/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml
at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:990)
at org.apache.ignite.Ignition.start(Ignition.java:355)
at hu.sztaki.lpds.ml.ignite.WekaIgnite.main(WekaIgnite.java:82)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to find configuration in: file:/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:116)
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:98)
at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:744)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:945)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:854)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:724)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:693)
at org.apache.ignite.Ignition.start(Ignition.java:352)
... 1 more

配置文件在那里:

$ cat /Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml
<?xml version="1.0" encoding="UTF-8"?>...

和:

new File("/Users/ahajnal/Documents/git/ignite/target/classes/default-config.xml").exists() is true

根据文档,此路径可以是绝对路径。 我在做什么错了?

谢谢。

1 个答案:

答案 0 :(得分:2)

我认为,问题在于 default-config.xml 文件仅具有抽象IgniteConfiguration。示例中的默认配置文件就是这种情况。

检查配置Bean的定义是否具有abstract=true参数,如果存在则将其删除。

PS 创建Ignite作为try块的资源不是一个好主意,因为节点将在try块执行完成后立即停止。