Hi,
I have an application using Web-mvc and SI. I am using Spring 2.6 with JDK 1.6. I have used ehcache for caching. Application works perfectly fine. Now I have a requirement to develop a standalone application that does more or less what the different components of my web app does. So, I decided to re-use them. But when I run the application, I create the application context, I get the below error
My application context file looks like thisCode:Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.impl.CacheStaticMethodMatcherPointcut#0': Cannot resolve reference to bean 'com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0' while setting bean property 'cacheAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0': Cannot resolve reference to bean 'ehCacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.cache.ehcache.EhCacheManagerFactoryBean] for bean with name 'ehCacheManager' defined in class path resource [META-INF/spring/monitorApplicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.cache.ehcache.EhCacheManagerFactoryBean at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) ... 47 more
I am reading the application context this wayCode:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:int="http://www.springframework.org/schema/integration" xmlns:task="http://www.springframework.org/schema/task" xmlns:ehcache="http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring http://ehcache-spring-annotations.googlecode.com/svn/schema/ehcache-spring/ehcache-spring-1.1.xsd"> <int:channel id="downloadInputChannel"> <int:dispatcher task-executor="downloadExecutor" /> </int:channel> <task:executor id="downloadExecutor" pool-size="${monitor.downloader.threadpoolsize}" queue-capacity="10000" rejection-policy="CALLER_RUNS" /> <int:channel id="downloadOutputChannel"> <int:queue/> </int:channel> <bean id="downloadService" scope="prototype" class="com.monitor.downloader.downloadServiceImpl"> <constructor-arg name="chunkSize" value="${monitor.downloader.chunkSize}" /> <constructor-arg name="connectionTimeout" value="${monitor.downloader.connectionTimeout}" /> <constructor-arg name="readTimeout" value="${monitor.downloader.readTimeout}" /> </bean> <int:service-activator input-channel="downloadInputChannel" output-channel="downloadOutputChannel" ref="downloadService" method="download"> <!-- <int:poller task-executor="downloadExecutor"> <int:interval-trigger interval="100"/> </int:poller> --> </int:service-activator> <int:gateway id="downloadServiceGateway" service-interface="com.monitor.downloader.DownloadServiceGateway" default-request-channel="downloadInputChannel" default-reply-channel="downloadOutputChannel" /> <ehcache:annotation-driven cache-manager="ehCacheManager" /> <bean id="ehCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> <property name="configLocation"> <value>classpath:META-INF/config/ehcache.xml</value> </property> </bean> </beans>
What is going wrong?Code:ApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/monitorApplicationContext.xml"); DownloadServiceImpl downloadServiceImpl = (DownloadServiceImpl) context.getBean("downloadService");
Thanks,
Jan.


Reply With Quote
