gpt4 book ai didi

java - 配置 Jolokia 服务器和代理时出现问题

转载 作者:太空宇宙 更新时间:2023-11-04 09:31:02 25 4
gpt4 key购买 nike

我有一个 Spring Boot Java 应用程序,除其他外,它使用 Apache Camel 进行一些路由拦截和数据修改。我们有一个单独的“ Camel 路线”文件(camelRoutes.xml),它定义了将使用的 Camel 路线。据我所知,该文件中还有一些配置,用于配置 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'.

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

最佳答案

就我而言,原因是我使用了 Maven assemble 插件,该插件没有合并 spring.schemas 文件。我switched to the shader plugin并且架构验证有效。

关于java - 配置 Jolokia 服务器和代理时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57094855/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com