weblogic springframework TypeMismatchException无法转换

时间:2011-12-17 15:06:13

标签: java spring weblogic bea

成功部署Web项目后,当我尝试从浏览器访问Web应用程序时出现以下错误。

2011-12-17 17:37:52.887  AdminServer <consumerFaultTracking> [-] ERROR Context initialization failed : org.springframework.web.struts.ContextLoaderPlugIn-(228) 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.bt.custc.faulttracking.dao.FaultTrackingProfileAccountDAOImpl#e71be2' defined in ServletContext resource [/WEB-INF/action-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.bt.custc.userdetails.service.UserdetailsServiceImpl] to required type [com.bt.custc.profileaccountservice.service.ProfileAccountService] for property 'profileAccountService']
PropertyAccessExceptionsException (1 errors)
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.bt.custc.userdetails.service.UserdetailsServiceImpl] to required type [com.bt.custc.profileaccountservice.service.ProfileAccountService] for property 'profileAccountService'
    at org.springframework.beans.BeanWrapperImpl.doTypeConversionIfNecessary(BeanWrapperImpl.java:1103)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:848)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:733)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:890)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:917)    

action-servlet.xml内容:

<property name="accountService">
    <bean class="com.bt.custc.faulttracking.service.FaultTrackingProfileAccountServiceImpl">
        <property name="profileAccountDAO">
            <bean class="com.bt.custc.faulttracking.dao.FaultTrackingProfileAccountDAOImpl">
                <property name="profileAccountService">
                    <ref bean="profileAccountServiceImplRefBean" />
                </property>
            </bean>
        </property>
    </bean>
</property>

如果有人早些时候遇到同样的问题,请告诉我解决方案。我不认为我可以更改代码,因为这可能适用于其他团队成员。

从weblogic配置的角度来看,我可能会遗漏任何内容,或者可能是重复的jar等...如果有任何可能导致此错误的可能性,请告诉我吗?

1 个答案:

答案 0 :(得分:2)

此异常中没有与WebLogic相关的内容。在/WEB-INF/action-servlet.xml文件中,您尝试将profileAccountService类型的bean的属性com.bt.custc.faulttracking.dao.FaultTrackingProfileAccountDAOImpl设置为com.bt.custc.userdetails.service.UserdetailsServiceImpl的实例。该属性的类型为com.bt.custc.profileaccountservice.service.ProfileAccountServiceUserdetailsServiceImpl不是ProfileAccountService的实现。