2014-04-25 3 views
6

मैं स्प्रिंग 4.0.3.RELEASE और EHcache 2.8.1 का उपयोग कर रहा हूं। जेबॉस 7.1.1स्प्रिंग एहैशे एमबीन मॉनीटरिंग

applicationContext.xml में निम्न कॉन्फ़िगरेशन के साथ मेरा कैशिंग अच्छा काम कर रहा है।

<cache:annotation-driven/> 

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"> 
    <property name="cacheManager" ref="ehcache"/> 
</bean> 

<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> 
    <property name="configLocation" value="/WEB-INF/ehcache.xml"/> 
</bean> 

अब मैं एमबीन के साथ निगरानी क्षमताओं को जोड़ना चाहता हूं। मैंने कॉन्फ़िगरेशन को applicationContext.xml में निम्नानुसार बदल दिया - 2 नए बीन्स "प्रबंधन सेवा" और "मैबियनसेवर" जोड़ा, कोई अन्य परिवर्तन नहीं। यह वर्तमान कॉन्फ़िगरेशन है।

<cache:annotation-driven/> 

<bean id="managementService" 
     class="net.sf.ehcache.management.ManagementService" 
     init-method="init" 
     destroy-method="dispose"> 

     <constructor-arg ref="cacheManager"/> 
     <constructor-arg ref="mbeanServer"/> 
     <constructor-arg index="2" value="true"/> 
     <constructor-arg index="3" value="true"/> 
     <constructor-arg index="4" value="true"/> 
     <constructor-arg index="5" value="true"/> 
</bean> 

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"> 
    <property name="cacheManager" ref="ehcache"/> 
</bean> 

<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> 
    <property name="configLocation" value="/WEB-INF/ehcache.xml"/> 
</bean>  

<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"> 
    <property name="locateExistingServerIfPossible" value="true"/> 
</bean> 

इस कॉन्फ़िगरेशन के साथ मुझे एप्लिकेशन सर्वर प्रारंभ होने पर निम्न त्रुटि मिलती है।

14:05:32,208 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-1) Context initialization failed: org.springframework.beans.factory.UnsatisfiedDependencyException: **Error creating bean with name 'managementService'** defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [net.sf.ehcache.CacheManager]: Could not convert constructor argument value of type [org.springframework.cache.ehcache.EhCacheCacheManager] to required type [net.sf.ehcache.CacheManager]: Failed to convert value of type 'org.springframework.cache.ehcache.EhCacheCacheManager' to required type 'net.sf.ehcache.CacheManager'; nested exception is java.lang.IllegalStateException: **Cannot convert value of type [org.springframework.cache.ehcache.EhCacheCacheManager] to required type [net.sf.ehcache.CacheManager]**: no matching editors or conversion strategy found 

Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'managementService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [net.sf.ehcache.CacheManager]: Could not convert constructor argument value of type [org.springframework.cache.ehcache.EhCacheCacheManager] to required type [net.sf.ehcache.CacheManager]: Failed to convert value of type 'org.springframework.cache.ehcache.EhCacheCacheManager' to required type 'net.sf.ehcache.CacheManager'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.cache.ehcache.EhCacheCacheManager] to required type [net.sf.ehcache.CacheManager]: no matching editors or conversion strategy found 
+0

आपको एमबीन सामग्री को हटाने का प्रयास करें, और इसे '' के साथ बदलें – geoand

उत्तर

6

आप managementService सेम नहीं cacheManager के निर्माता को ehcache सेम पास करना चाहिए। यदि आप cacheManager की परिभाषा को देखते हैं तो ehcache बीन cacheManager के रूप में पारित किया गया है। कारखाना बीन net.sf.ehcache.CacheManager का एक उदाहरण प्रदान करेगा।