我正在尝试将我的应用程序升级到最新版本的Spring&Camel,但我得到了下面列出的例外情况。 我还列出了spring遇到问题的配置部分。 仅供参考,我的应用程序(包括此配置元素)可以与旧版本的库一起使用。 为什么弹簧4.3.3不能在Spring 3.1.1找到该类时发现它没有任何问题?
这些是我正在更新的库:
春季3.1.1至4.3.3 骆驼2.13.4至2.17.3 cglib 2.2.2至3.2.4 cxf 2.6.1至3.1.7我真的只更改了pom.xml和由于库更新导致的一些小的更改。 任何人都可以指出我正确的方向如何解决这个问题?
Spring在这里有一个问题
<bean id="test.format" class="org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat"> <constructor-arg value="com.application.businessobject.test" /> </bean>例外
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'test.format' defined in class path resource [trs.application.finance.businessactivities.watchers.externaldata.xml]: Unsatisfied dependency expressed through constructor parameter 0: Could not convert argument value of type [java.lang.String] to required type [java.lang.Class]: Failed to convert value of type [java.lang.String] to required type [java.lang.Class]; nested exception is java.lang.IllegalArgumentException: Cannot find class [com.application.businessobject.test]I'm trying to upgrade my application to the latest version of Spring & Camel, but I'm getting the exception listed below. I also listed the config section that spring is having an issue with. FYI, my application, including this config element, is working fine with the older versions of the libraries. Why can't spring 4.3.3 find that class when Spring 3.1.1 finds it without any issues?
These are the libraries I'm updating:
Spring 3.1.1 to 4.3.3 Camel 2.13.4 to 2.17.3 cglib 2.2.2 to 3.2.4 cxf 2.6.1 to 3.1.7I really only changed the pom.xml & a couple minor changes due to the library updates. Can anyone point me in the right direction on how to resolve this?
Spring is having an issue here
<bean id="test.format" class="org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat"> <constructor-arg value="com.application.businessobject.test" /> </bean>Exception
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'test.format' defined in class path resource [trs.application.finance.businessactivities.watchers.externaldata.xml]: Unsatisfied dependency expressed through constructor parameter 0: Could not convert argument value of type [java.lang.String] to required type [java.lang.Class]: Failed to convert value of type [java.lang.String] to required type [java.lang.Class]; nested exception is java.lang.IllegalArgumentException: Cannot find class [com.application.businessobject.test]最满意答案
https://github.com/apache/camel/blob/master/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
显然在早期的CAMEL版本中有一个这个类的构造函数,它期望包作为String ... vararg参数,但是从那时起就被删除了
https://github.com/apache/camel/commit/ce6bf6e6feb5f425cd544c4c1edfa2eb34641907
因此,您的bean声明不再有效,并导致上述异常
Could not convert argument value of type [java.lang.String] to required type [java.lang.Class]:应该声明
<bean id="test.format" class="org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat"> <constructor-arg> <value type="java.lang.Class">com.application.businessobject.Test</value> </constructor-arg> </bean>https://github.com/apache/camel/blob/master/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/fixed/BindyFixedLengthDataFormat.java
Apparently in earlier CAMEL versions there was a constructor of this class that expected packages as a String... vararg parameter, but has been since removed with this commit
https://github.com/apache/camel/commit/ce6bf6e6feb5f425cd544c4c1edfa2eb34641907
So your bean declaration is not valid any more and results in the above exception
Could not convert argument value of type [java.lang.String] to required type [java.lang.Class]:Should be declared instead
<bean id="test.format" class="org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat"> <constructor-arg> <value type="java.lang.Class">com.application.businessobject.Test</value> </constructor-arg> </bean>更多推荐
发布评论