在点燃默认配置文件中添加log4j属性后,服务无法启动 [英] After adding log4j property in ignite default config file, service not able to start

查看:62
本文介绍了在点燃默认配置文件中添加log4j属性后,服务无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to enable Log4j logger by using the gridLogger property in the config file like below:

<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>

但是当启动ignite.sh时,由于无法读取属性参数,它给出了以下错误.

But when starting the ignite.sh it is giving below error as it is not able to read the property parameter.

[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 

推荐答案

错误指出您具有无效的元素属性:

The error states that you have an invalid element property:

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

在第一行,您偶尔会有一个封闭的 bean id ="grid.cfg" 标记,但没有值.

At the very first line, you occasionally have a closed bean id="grid.cfg" tag without a value.

应该是:

<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>

此外,不要忘记将ignite-log4j.jar包含为项目依赖项.对于Maven:

Also, do not forget to include the ignite-log4j.jar as a project dependency. For maven:

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

这篇关于在点燃默认配置文件中添加log4j属性后,服务无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆