在点火默认配置文件中添加log4j属性后,服务无法启动



我正试图通过使用配置文件中的gridLogger属性来启用Log4j记录器,如下所示:

<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"/>
<property name="gridLogger">
<bean class="org.apache.ignite.logger.log4j.Log4JLogger">
<constructor-arg type="java.lang.String" value="config/ignite-log4j.xml"/>
</bean>
</property>

但当启动点火开关时,由于无法读取特性参数,它给出了以下错误。

[root@ignite1 ~]# /usr/apache-ignite-2.7.6-bin/bin/ignite.sh
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ignite.internal.util.GridUnsafe$2 (file:/usr/apache-ignite-2.7.6-bin/libs/ignite-core-2.7.6.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of org.apache.ignite.internal.util.GridUnsafe$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
class org.apache.ignite.IgniteException: Failed to instantiate Spring XML application context [springUrl=file:/usr/apache-ignite-2.7.6-bin/config/default-config.xml, err=Line 29 in XML document from URL [file:/usr/apache-ignite-2.7.6-bin/config/default-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 29; columnNumber: 33; cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.springframework.org/schema/beans":property}'. One of '{"http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, WC[##other:"http://www.springframework.org/schema/beans"], "http://www.springframework.org/schema/beans":beans}' is expected.]
at org.apache.ignite.internal.util.IgniteUtils.convertException(IgniteUtils.java:1029)
at org.apache.ignite.Ignition.start(Ignition.java:351)
at org.apache.ignite.startup.cmdline.CommandLineStartup.main(CommandLineStartup.java:301)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to instantiate Spring XML application context [springUrl=file:/usr/apache-ignite-2.7.6-bin/config/default-config.xml, err=Line 29 in XML document from URL [file:/usr/apache-ignite-2.7.6-bin/config/default-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 29; columnNumber: 33; cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.springframework.org/schema/beans":property}'. One of '{"http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, WC[##other:"http://www.springframework.org/schema/beans"], "http://www.springframework.org/schema/beans":beans}' is expected.]
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.applicationContext(IgniteSpringHelperImpl.java:392)
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:104)
at org.apache.ignite.internal.util.spring.IgniteSpringHelperImpl.loadConfigurations(IgniteSpringHelperImpl.java:98)
at org.apache.ignite.internal.IgnitionEx.loadConfigurations(IgnitionEx.java:751)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:952)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:861)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:731)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:700)
at org.apache.ignite.Ignition.start(Ignition.java:348)
... 1 more
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 29 in XML document from URL [file:/usr/apache-ignite-2.7.6-bin/config/default-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 29; columnNumber: 33; cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.springframework.org/schema/beans":property}'. One of '{"http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, WC[##other:"http://www.springframework.org/schema/beans"], "http://www.springframework.org/schema/beans":beans}' is expected.
at 

错误表明您有一个无效的元素属性:

Invalid content was found starting with element '{"http://www.springframework.org/schema/beans":property}'

在第一行,偶尔会出现一个没有值的闭合bean id="grid.cfg"标记。

应为:

<beans ...
...
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="gridLogger">
<bean class="org.apache.ignite.logger.log4j.Log4JLogger">
<constructor-arg type="java.lang.String" value="config/ignite-log4j.xml"/>
</bean>
</property>
</bean>
</beans>

此外,不要忘记将ignlight-log4j.jar作为项目依赖项包含在内。对于maven:

<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-log4j</artifactId>
<version>${ignite.version}</version>
</dependency>

最新更新