jmxagent выдает исключение saxparse при добавлении в контексте верблюда - PullRequest
0 голосов
/ 08 мая 2019

Я добавил приведенный ниже фрагмент кода в свой camelcontext.xml

<jmxAgent id="agent" createConnector="true" />

Но добавленный выше код дает мне следующее исключение при его развертывании в экземпляре Jboss:

-----------------

>  nested exception is
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
> Line 64 in XML document from class path resource
> [META-INF/spring/camel-routes/camel-context.xml] is invalid; nested
> exception is org.xml.sax.SAXParseException; lineNumber: 64;
> columnNumber: 49; cvc-complex-type.2.4.a: Invalid content was found
> starting with element 'jmxAgent'. One of
> '{"http://camel.apache.org/schema/spring":threadPoolProfile,
> "http://camel.apache.org/schema/spring":threadPool,
> "http://camel.apache.org/schema/spring":endpoint,
> "http://camel.apache.org/schema/spring":dataFormats,
> "http://camel.apache.org/schema/spring":transformers,
> "http://camel.apache.org/schema/spring":validators,
> "http://camel.apache.org/schema/spring":redeliveryPolicyProfile,
> "http://camel.apache.org/schema/spring":onException,
> "http://camel.apache.org/schema/spring":onCompletion,
> "http://camel.apache.org/schema/spring":intercept,
> "http://camel.apache.org/schema/spring":interceptFrom,
> "http://camel.apache.org/schema/spring":interceptSendToEndpoint,
> "http://camel.apache.org/schema/spring":restConfiguration,
> "http://camel.apache.org/schema/spring":rest,
> "http://camel.apache.org/schema/spring":route}' is expected.
>         at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
> [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
>         at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
> [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
>         at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
> [spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]

Ниже приводится мой полный camelcontext.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:camel="http://camel.apache.org/schema/spring"
          xmlns:context="http://www.springframework.org/schema/context"
            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://camel.apache.org/schema/spring 
                 http://camel.apache.org/schema/spring/camel-spring.xsd   
                http://www.springframework.org/schema/util     
                http://www.springframework.org/schema/util/spring-util-3.0.xsd
               http://www.springframework.org/schema/context  
               http://www.springframework.org/schema/context/spring-context.xsd ">

    <context:annotation-config />
    <import resource="file:${FIS_HOME}/CONFIG/database-context.xml" />
    <import resource="file:${FIS_HOME}/Scheduler/job-scheduer.xml" />
    <import resource="file:${FIS_HOME}/Process/processor-context.xml" />
    <!-- End : Files import to camel context-->
    <camelContext xmlns="http://camel.apache.org/schema/spring" 
 trace="true" streamCache="true" lazyLoadTypeConverters="true" id="main">
        <properties>
<property key="CamelLogEipName" value="com.mycode.route"/>
        </properties>

<propertyPlaceholder id="properties" location="file:${FIS_HOME}/Config/routes.properties"                            xmlns="http://camel.apache.org/schema/spring"/>

 <routeContextRef ref="manager-job-routes" />
<routeContextRef ref="report-routes" />

<threadPoolProfile id="DefaultThreadPoolProfile" defaultProfile="true"
poolSize="70" maxPoolSize="100" maxQueueSize="-1" allowCoreThreadTimeOut="false" rejectedPolicy="CallerRuns"/>

 <jmxAgent id="agent" createConnector="true" statisticsLevel="RoutesOnly"/>

</camelContext>
</beans>`

Версия верблюда, которой я являюсьиспользование 2.23.2.Также у меня есть следующая зависимость для верблюда:

    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jmx</artifactId>
        <version>${camel.version}</version>
    </dependency>`

Я изменил пружину верблюда xsds, но проблема все еще сохраняется

1 Ответ

0 голосов
/ 08 мая 2019

Я думаю, что проблема связана с последовательностью тега jmxAgent. Поместите тег jmxAgent в начале тега camelContext. Проверьте camel-spring.xsd вы найдете

  <xs:extension base="tns:abstractCamelContextFactoryBean">
    <xs:sequence>
      ....
      <xs:element minOccurs="0" ref="tns:packageScan"/>
      <xs:element minOccurs="0" ref="tns:contextScan"/>
      <xs:element minOccurs="0" ref="tns:streamCaching"/>
      <xs:element minOccurs="0" ref="tns:jmxAgent"/>
      .....
      <xs:element maxOccurs="unbounded" minOccurs="0" ref="tns:routeContextRef"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" ref="tns:restContextRef"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" ref="tns:threadPoolProfile"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" ref="tns:threadPool"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" ref="tns:endpoint"/>
      .....
   </xs:sequence>
  </xs:extension>
...