2011-12-17 68 views
0

成功部署web項目後,當我嘗試從瀏覽器訪問Web應用程序時,出現以下錯誤。weblogic springframework TypeMismatchException未能轉換

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等...請指教我是否會有任何可能導致此錯誤的可能性?

回答

2

在這個異常中沒有任何與WebLogic相關的東西。在您的/WEB-INF/action-servlet.xml文件中,您嘗試將類型爲com.bt.custc.faulttracking.dao.FaultTrackingProfileAccountDAOImpl的bean的屬性profileAccountService設置爲com.bt.custc.userdetails.service.UserdetailsServiceImpl的實例。該屬性類型爲com.bt.custc.profileaccountservice.service.ProfileAccountService,而UserdetailsServiceImpl不是ProfileAccountService的實現。

+0

非常感謝JB的回覆,並確認此問題與weblogic無關。 – 2011-12-18 19:51:41

+0

我不知道它是如何指向UserDetailServiceImpl(附帶action-sevlet片段供您參考)。在我的整個action-servlet.xml中,我無法在其他地方找到'UserDetailsS​​erviceImpl'。 – 2011-12-18 19:54:32

+0

什麼是bean profileAccountServiceImplRefBean的定義? – 2011-12-18 20:05:40