Mule Динамический исходящий HTTP-адрес

Я пытаюсь динамически установить исходящий адрес HTTP, используя следующий код:

<flow name="dynamic-http-address" doc:name="dynamic-http-address" processingStrategy="synchronous">
    <http:inbound-endpoint exchange-pattern="request-response"
        host="localhost" port="8081" doc:name="HTTP" />
    <logger level="INFO" doc:name="Logger" />
    <set-variable variableName="address" value="http://www.google.com/"
        doc:name="Variable" />
    <http:outbound-endpoint address="#[address]"
        method="GET" doc:name="HTTP" />
</flow>

Однако, когда я запускаю приложение, оно не запускается и выдает следующее исключение:

PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property 'protocol' threw exception; nested exception is java.lang.IllegalArgumentException: Address '#[address]' for protocol 'http' should start with http://
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1145)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:902)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1424)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:271)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:126)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:271)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:126)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:154)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89)
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:119)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101)
    at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:84)
    at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:207)
    at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64)
    at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:47)
    at org.mule.tooling.server.application.ApplicationDeployer.run(ApplicationDeployer.java:58)
    at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:91)
Caused by: java.lang.IllegalArgumentException: Address '#[address]' for protocol 'http' should start with http://
    at org.mule.endpoint.URIBuilder.assertProtocolConsistent(URIBuilder.java:388)
    at org.mule.endpoint.URIBuilder.assertAddressConsistent(URIBuilder.java:380)
    at org.mule.endpoint.URIBuilder.setProtocol(URIBuilder.java:180)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1132)
    ... 44 more
INFO  2014-03-27 23:06:46,958 [main] org.mule.module.launcher.application.DefaultMuleApplication: App 'test' never started, nothing to dispose of
Exception in thread "main" org.mule.module.launcher.DeploymentInitException: PropertyBatchUpdateException: Failed properties: Property 'protocol' threw exception; nested exception is java.lang.IllegalArgumentException: Address '#[address]' for protocol 'http' should start with http://
    at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:219)
    at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64)
    at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:47)
    at org.mule.tooling.server.application.ApplicationDeployer.run(ApplicationDeployer.java:58)
    at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:91)
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name 'dynamic-http-address': Cannot create inner bean '(inner bean)' of type [org.mule.config.spring.factories.OutboundEndpointFactoryBean] while setting bean property 'messageProcessors' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot create inner bean '(inner bean)' of type [org.mule.endpoint.URIBuilder] while setting bean property 'URIBuilder'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'protocol' threw exception; nested exception is java.lang.IllegalArgumentException: Address '#[address]' for protocol 'http' should start with http:// (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:84)
    at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:207)
    ... 4 more
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name 'dynamic-http-address': Cannot create inner bean '(inner bean)' of type [org.mule.config.spring.factories.OutboundEndpointFactoryBean] while setting bean property 'messageProcessors' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot create inner bean '(inner bean)' of type [org.mule.endpoint.URIBuilder] while setting bean property 'URIBuilder'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'protocol' threw exception; nested exception is java.lang.IllegalArgumentException: Address '#[address]' for protocol 'http' should start with http:// (org.mule.api.lifecycle.InitialisationException)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101)
    at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
    ... 7 more
Caused by: org.mule.api.lifecycle.InitialisationException: Error creating bean with name 'dynamic-http-address': Cannot create inner bean '(inner bean)' of type [org.mule.config.spring.factories.OutboundEndpointFactoryBean] while setting bean property 'messageProcessors' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot create inner bean '(inner bean)' of type [org.mule.endpoint.URIBuilder] while setting bean property 'URIBuilder'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'protocol' threw exception; nested exception is java.lang.IllegalArgumentException: Address '#[address]' for protocol 'http' should start with http://
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:117)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:119)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)

Есть идеи, почему Mule хочет, чтобы динамический адрес начинался с http://?


person user1493140    schedule 28.03.2014    source источник


Ответы (1)


Поскольку URIBuilder в Mule утверждает, что адреса конечных точек всегда согласуются с протоколом конечной точки. Это имеет смысл, так как смешанные протоколы в любом случае не будут работать. Используйте 1_.

person Anton Kupias    schedule 28.03.2014
comment
Спасибо! Он работает с address=http://#[address]... Однако я не уверен, будет ли адрес HTTP или HTTPS. Итак, я создал отдельные подпотоки для HTTP и HTTPS и создал выбор маршрутизатора для маршрутизации к соответствующему подпотоку... теперь возникла новая проблема, для которой я создал отдельный вопрос stackoverflow.com/questions /22702325/ - person user1493140; 28.03.2014