如何从spring配置文件启动Ignite时读取application.properties文件
我试图从spring配置xml文件启动ApacheIgnite。SpringXML具有从application.properties文件读取的键 我使用以下命令启动ApacheIgnite如何从spring配置文件启动Ignite时读取application.properties文件,spring,ignite,Spring,Ignite,我试图从spring配置xml文件启动ApacheIgnite。SpringXML具有从application.properties文件读取的键 我使用以下命令启动ApacheIgnite apache-ignite-fabric-2.6.0-bin\bin\ignite.bat D:\workspace\<application-name>\src\main\resources\ignite.xml apache-ignite-fabric-2.6.0-bin\bin\ignit
apache-ignite-fabric-2.6.0-bin\bin\ignite.bat D:\workspace\<application-name>\src\main\resources\ignite.xml
apache-ignite-fabric-2.6.0-bin\bin\ignite.bat D:\workspace\\src\main\resources\ignite.xml
我尝试设置一个CLASSPATH环境变量,其中保存了所有相关的spring和ignite JAR,还保存了application.properties文件。现在仍然可以读取apploication.properties文件
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'ignite.cfg' defined in URL [file:/D:/workspace/<application-name>/src/main/resources/ignite.xml]: No configuration setting found for key 'zookeeper'; nested exception is com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'zookeeper'
at org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:223)
at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:222)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:283)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:163)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:381)
原因:org.springframework.beans.factory.BeanDefinitionStoreException:URL[file:/D:/workspace//src/main/resources/ignite.xml]中定义了名为“ignite.cfg”的无效bean定义:未找到键“zookeeper”的配置设置;嵌套异常为com.typesafe.config.ConfigException$缺少:找不到键“zookeeper”的配置设置
位于org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:223)
位于org.springframework.beans.factory.config.PropertyPlaceHolderConfigure.processProperties(PropertyPlaceHolderConfigure.java:222)
位于org.springframework.beans.factory.config.PropertyResourceConfiger.postProcessBeanFactory(PropertyResourceConfiger.java:86)
位于org.springframework.context.support.postprocessorregistrationlegate.invokeBeanFactoryPostProcessors(postprocessorregistrationlegate.java:283)
位于org.springframework.context.support.postprocessorregistrationlegate.invokeBeanFactoryPostProcessors(postprocessorregistrationlegate.java:163)
位于org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
位于org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)
位于org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:381)
我已经尝试设置类路径,并尝试将文件/jar保存在IGNITE_主目录的lib目录中
ignite.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!--<property name="gridLogger">
<bean class="org.apache.ignite.logger.slf4j.Slf4jLogger"/>
</property>-->
<!-- Enabling Apache Ignite native persistence. -->
<property name="peerClassLoadingEnabled" value="false"/>
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<property name="walMode" value="NONE"/>
<property name="walArchivePath" value="D:\work\TIWorkspace\ignite\wal\archive"/>
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="persistenceEnabled" value="true"/>
<!-- Increasing the buffer size to 1 GB. -->
<property name="checkpointPageBufferSize"
value="#{1024L * 1024 * 1024}"/>
</bean>
</property>
</bean>
</property>
<property name="binaryConfiguration">
<bean class="org.apache.ignite.configuration.BinaryConfiguration">
<property name="compactFooter" value="false"/>
<property name="idMapper">
<bean class="org.apache.ignite.binary.BinaryBasicIdMapper">
<property name="lowerCase" value="true"/>
</bean>
</property>
<property name="nameMapper">
<bean class="org.apache.ignite.binary.BinaryBasicNameMapper">
<property name="simpleName" value="true"/>
</bean>
</property>
</bean>
</property>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpi">
<property name="zkConnectionString" value="localhost:2181"/>
<!--<property name="zkConnectionString" value="${zookeeper.server}"/>-->
<property name="zkRootPath" value="/dbobjects"/>
</bean>
</property>
</bean>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:application.properties</value>
</property>
</bean>
类路径:application.properties
任何线索都会有帮助
提前感谢。实现这一点最简单的方法是使用基于文件的资源
URL
。这一个对我有用:
文件:${IGNITE_HOME}/libs/application.properties
您也可以共享Ignite配置文件吗?