我正在进行从 2.25.4 到 3.0.24 的骆驼迁移。这样做时,我必须在 camel 配置 xml 文件中做一些更改,其中 httpConnectionManager 已更新为 clientConnectionManager 用于 bean 类 org.apache.camel.component.http.HttpComponent.
在下面我提到了我的骆驼配置 xml 文件的一部分:
<bean id="http" class="org.apache.camel.component.http.HttpComponent">
<property name="camelContext" ref="camel"/>
<property name="clientConnectionManager" ref="myHttpConnectionManager"/>
</bean>
<bean id="https" class="org.apache.camel.component.http.HttpComponent">
<property name="camelContext" ref="camel"/>
<property name="clientConnectionManager" ref="myHttpConnectionManager"/>
</bean>
<bean id="myHttpConnectionManager" class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager">
<property name="params" ref="myHttpConnectionManagerParams"/>
</bean>
<bean id="myHttpConnectionManagerParams" class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">
<property name="defaultMaxConnectionsPerHost" value="20"/>
</bean>
有了这个改变,当我启动 tomcat 时,它给我以下错误:
11-May-2023 11:07:16.052 SEVERE [main]
org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'http'
defined in ServletContext resource [/WEB-INF/camel-config.xml]: Initialization of bean failed;
nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert
property value of type 'org.apache.commons.httpclient.MultiThreadedHttpConnectionManager' to
required type 'org.apache.http.conn.HttpClientConnectionManager' for property
'clientConnectionManager'; nested exception is java.lang.IllegalStateException: Cannot convert
value of type 'org.apache.commons.httpclient.MultiThreadedHttpConnectionManager' to required type
'org.apache.http.conn.HttpClientConnectionManager' for property 'clientConnectionManager': no
matching editors or conversion strategy found
camel 3.20.4 是否有特定版本的 apache commons-httpclient 要求?或者我必须使用其他类而不是 MultiThreadedHttpConnectionManager?