Верблюд DataFormat Джексона, использующий проект XML DSL, генерирует исключение контекста - PullRequest
0 голосов
/ 01 мая 2018

Независимо от того, где я размещаю данные в формате XML DSL, я получаю эту ошибку, только начиная с разных мест. если я удаляю его, он работает, но, конечно, я не могу конвертировать JSON в POJO. ??? любую помощь или скажите мне, что я делаю не так, чего мне не хватает. спасибо!

Error

Unable to start blueprint container for bundle passthrumt1.core/1.0.1.SNAPSHOT
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'endpoint'. One of '{"http://camel.apache.org/schema/blueprint":redeliveryPolicyProfile, "http://camel.apache.org/schema/blueprint":onException, "http://camel.apache.org/schema/blueprint":onCompletion, "http://camel.apache.org/schema/blueprint":intercept, "http://camel.apache.org/schema/blueprint":interceptFrom, "http://camel.apache.org/schema/blueprint":interceptSendToEndpoint, "http://camel.apache.org/schema/blueprint":restConfiguration, "http://camel.apache.org/schema/blueprint":rest, "http://camel.apache.org/schema/blueprint":route}' is expected.

XML DSL

   <camelContext     
      id="com.passthru.coreCamelContext"
      trace="true"
      xmlns="http://camel.apache.org/schema/blueprint"
      allowUseOriginalMessage="false"
      streamCache="true"
      errorHandlerRef="deadLetterErrorHandler" >

    <properties>
        <property key="http.proxyHost" value="PITC-Zscaler-Americas.proxy.corporate.com"/>
        <property key="http.proxyPort" value="80"/>
    </properties>

    <streamCaching  id="CacheConfig" 
                    spoolUsedHeapMemoryThreshold="70" 
                    anySpoolRules="true"/>
<!--  -->
    <dataFormats>
            <json id="Json2Pojo" library="Jackson" unmarshalTypeName="com.passthru.core.entities.TokenEntities">
            </json>
    </dataFormats>

    <endpoint id="predixConsumer" uri="direct:preConsumer" />
    <endpoint id="predixProducer" uri="direct:preProducer" />
    <endpoint id="getToken" uri="direct:getToken" />

      <onException>
        <exception>com.passthru.dataservice.PDXDataServiceInvalidDataException</exception>
        <redeliveryPolicy maximumRedeliveries="3" />
        <handled>
          <constant>true</constant>
        </handled>
        <log
          message="Invalid Data From Data Service"
          loggingLevel="ERROR" />
        <setBody>
          <simple>${body.toString}</simple>
        </setBody>
        <to uri="file:{{errorArchive}}" />
      </onException>

Если я размещаю форматы данных над свойствами, то жалуется, что мне нужно удалить свойства и операторы потокового кэша, чтобы он работал. но мне нужны свойства прокси. какие-либо предложения??? еще раз спасибо

Если

<camelContext     
  id="com.ge.digital.passthru.coreCamelContext"
  trace="true"
  xmlns="http://camel.apache.org/schema/blueprint"
  allowUseOriginalMessage="false"
  streamCache="true"
  errorHandlerRef="deadLetterErrorHandler" >
<dataFormats>
    <json id="Json2Pojo" library="Jackson" unmarshalTypeName="com.passthru.core.entities.TokenEntities"/>
</dataFormats>
<properties>
    <property key="http.proxyHost" value="PITC-Zscaler-Americas-Cincinnati3PR.proxy.corporate.com"/>
    <property key="http.proxyPort" value="80"/>
</properties>

я понял

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'properties'. One of '{"http://camel.apache.org/schema/blueprint":redeliveryPolicyProfile, "http://camel.apache.org/schema/blueprint":onException, "http://camel.apache.org/schema/blueprint":onCompletion, "http://camel.apache.org/schema/blueprint":intercept, "http://camel.apache.org/schema/blueprint":interceptFrom, "http://camel.apache.org/schema/blueprint":interceptSendToEndpoint, "http://camel.apache.org/schema/blueprint":restConfiguration, "http://camel.apache.org/schema/blueprint":rest, "http://camel.apache.org/schema/blueprint":route}' is expected.

что мне не хватает?

1 Ответ

0 голосов
/ 01 мая 2018

Верблюжий проект XML проверяется на соответствие camel-blueprint.xsd . Вас интересует сложный тип с именем camelContextFactoryBean, который содержит последовательность доступных элементов с фиксированным порядком.

Правильный порядок элементов camelContext, определенных в этой последовательности:

  • свойства
  • GlobalOptions
  • propertyPlaceholder
  • пакет
  • packageScan
  • contextScan
  • jmxAgent
  • streamCaching
  • экспорт
  • defaultServiceCallConfiguration
  • serviceCallConfiguration
  • defaultHystrixConfiguration
  • hystrixConfiguration
  • routeBuilder
  • routeContextRef
  • restContextRef
  • threadPoolProfile
  • Threadpool
  • конечная точка
  • DataFormats
  • трансформаторы * * тысяча пятьдесят-одна
  • валидаторы
  • redeliveryPolicyProfile
  • OnException
  • onCompletion
  • перехватывать
  • interceptFrom
  • interceptSendToEndpoint
  • restConfiguration
  • остальное
  • Маршрут

Чтобы решить вашу проблему, переместите все endpoint декларации прямо над dataFormats.

...