【问题标题】:Problem configuring Jolokia server and agent配置 Jolokia 服务器和代理的问题
【发布时间】:2019-07-18 12:49:17
【问题描述】:

我有一个 Spring Boot Java 应用程序,它使用 Apache Camel 进行一些路由拦截和数据修改。我们有一个单独的“骆驼路线”文件(camelRoutes.xml),它定义了将要使用的骆驼路线。该文件中还有一些配置,据我所知,配置 Jolokia MBean 服务器和 Jolokia 代理。

系统对 Jolokia 配置 XML 有一些不满意的地方。我已经进行了一些非常快速的谷歌搜索,并且似乎指定正确(请参阅https://jolokia.org/reference/html/jmx.html 中的第 9.3.2 节)。这个问题以各种方式表现出来。当文件在 Eclipse 中的 XML 编辑器中打开时,相应的 XML 会以错误突出显示(尽管它没有提供有关它认为错误的信息)。更重要的是,当我尝试运行应用程序时,它会失败并出现级联异常,基本上是配置文件中的问题。

camelRoutes.xml 节选:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jolokia="http://www.jolokia.org/jolokia-spring/schema/config"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
     http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     http://www.jolokia.org/jolokia-spring/schema/config http://www.jolokia.org/jolokia-spring/schema/config/jolokia-config.xsd
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
...
<context:mbean-export server="jolokiaServer" />
<jolokia:mbean-server id="jolokiaServer" />

<jolokia:agent lookupConfig="false"
    systemPropertiesMode="never">
    <jolokia:config autoStart="true" host="0.0.0.0"
        port="${jolokia.port:8778}"
        agentDescription="${jolokia.agentName:jolokia}" />
</jolokia:agent>

在 Eclipse 中,定义了 jolokia:mbean-serverjolokia:agent 的行会显示错误。

应用程序执行时异常跟踪的一小部分:

Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 85 in XML document from file [C:\Users\JO24447\workspace\RST_Service_Base\rust-service-base-rest\target\classes\rst_camel\camelRoutes.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 85; columnNumber: 45; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'jolokia:mbean-server'.

有什么想法可能是错的吗?

【问题讨论】:

  • 我看到了类似的问题,在我看来,Jolokia 命名空间没有正确加载。

标签: java spring-boot apache-camel jolokia


【解决方案1】:

在我的情况下,原因是我使用了 Maven assembly 插件,它没有合并 spring.schemas 文件。我switched to the shader plugin 和架构验证工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-19
    • 1970-01-01
    • 2011-01-01
    • 2011-02-05
    • 1970-01-01
    • 2012-01-06
    相关资源
    最近更新 更多