qianjava / ehcache-spring-annotations

Automatically exported from code.google.com/p/ehcache-spring-annotations
0 stars 0 forks source link

Not deployable to OSGi environment #45

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Create an osgi project using the maven bundle plugin
2.Attempt to deploy the project to servicemix 4.3
3.when starting the bundle get a NoClassDefFoundError

What is the expected output? What do you see instead?
I expect the bundle to start. Instead initially you get an Unresolved 
constraint error saying it depends on net.sf.ehcache version 2.0.0 to 3.0.0. if 
I wrap the ehcache-core dependency as an OSGi bundle using the pax wrap 
protocol and give the packages a version of 2.1 that error is removed. When 
trying to start the project when we have an OSGi wrapped ehcache-core I get 
this error:

org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'com.googlecode.ehcache.annotations.key.CachingReflectionHelper': 
Initialization of bean failed; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 
'com.googlecode.ehcache.annotations.config.internalEhCacheCachingAdvisor': 
Cannot resolve reference to bean 
'com.googlecode.ehcache.annotations.impl.CacheStaticMethodMatcherPointcut#0' 
while setting bean property 'pointcut'; nested exception is 
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': 
Initialization of bean failed; nested exception is 
java.lang.NoClassDefFoundError: Lnet/sf/ehcache/CacheManager; 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[62:org.springframework.context:3.0.3.RELEASE] 
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[73:org.springframework.osgi.core:1.2.0] 
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[73:org.springframework.osgi.core:1.2.0] 
        at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[73:org.springframework.osgi.core:1.2.0] 
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[73:org.springframework.osgi.core:1.2.0] 
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)[74:org.springframework.osgi.extender:1.2.0] 
        at java.lang.Thread.run(Thread.java:619)[:1.6.0_21] 
Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 
'com.googlecode.ehcache.annotations.config.internalEhCacheCachingAdvisor': 
Cannot resolve reference to bean 
'com.googlecode.ehcache.annotations.impl.CacheStaticMethodMatcherPointcut#0' 
while setting bean property 'pointcut'; nested exception is 
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': 
Initialization of bean failed; nested exception is 
java.lang.NoClassDefFoundError: Lnet/sf/ehcache/CacheManager; 
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1317)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:86)[58:org.springframework.aop:3.0.3.RELEASE] 
        at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:100)[58:org.springframework.aop:3.0.3.RELEASE] 
        at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:86)[58:org.springframework.aop:3.0.3.RELEASE] 
        at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)[58:org.springframework.aop:3.0.3.RELEASE] 
        at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)[58:org.springframework.aop:3.0.3.RELEASE] 
        at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)[58:org.springframework.aop:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1418)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)[61:org.springframework.beans:3.0.3.RELEASE] 
        ... 13 more 
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': 
Initialization of bean failed; nested exception is 
java.lang.NoClassDefFoundError: Lnet/sf/ehcache/CacheManager; 
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1317)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)[61:org.springframework.beans:3.0.3.RELEASE] 
        ... 31 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 
'com.googlecode.ehcache.annotations.impl.CacheAttributeSourceImpl#0': 
Initialization of bean failed; nested exception is 
java.lang.NoClassDefFoundError: Lnet/sf/ehcache/CacheManager; 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)[61:org.springframework.beans:3.0.3.RELEASE] 
        ... 41 more 
Caused by: java.lang.NoClassDefFoundError: Lnet/sf/ehcache/CacheManager; 
        at java.lang.Class.getDeclaredFields0(Native Method)[:1.6.0_21] 
        at java.lang.Class.privateGetDeclaredFields(Class.java:2291)[:1.6.0_21] 
        at java.lang.Class.getDeclaredFields(Class.java:1743)[:1.6.0_21] 
        at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:372) 
        at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:320) 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:798)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:493)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) 
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1317)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)[61:org.springframework.beans:3.0.3.RELEASE] 
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)[61:org.springframework.beans:3.0.3.RELEASE] 
        ... 47 more 
Caused by: java.lang.ClassNotFoundException: net.sf.ehcache.CacheManager 
        at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)[org.apache.felix.framework-3.0.1.jar:] 
        at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)[org.apache.felix.framework-3.0.1.jar:] 
        at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1685)[org.apache.felix.framework-3.0.1.jar:] 
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_21] 
        ... 64 more

What version of the product are you using? On what operating system?

ehcache-spring-annotations 1.1.2, Ubuntu 10.04 and Windows XP

Please provide any additional information below.
Let me know is anythign needs clarifying

Original issue reported on code.google.com by benjamin...@gmail.com on 14 Sep 2010 at 11:12

GoogleCodeExporter commented 8 years ago
Do you have any version Ehcache on you classpath?

Original comment by eric.dalquist on 14 Sep 2010 at 12:22

GoogleCodeExporter commented 8 years ago
Haven't heard back from reporter. I'm going to assume this is a deployment 
configuration issue.

Original comment by eric.dalquist on 15 Sep 2010 at 7:24

GoogleCodeExporter commented 8 years ago
Sorry, I didn't get chance to look at the issue today as I was trying to figure 
out what was wrong and find a caching solution. 

Your library doesn't just want a version of ehcache on the class path, it's 
manifest specifies imports of 2 ehcache packages in it's manifest. When 
specifying the packages it specifies the version as between 2.0.0 and 3.0.0. 
The only OSGi compatible version of ehcache is 1.6.2 and is the spring wrapped 
bundle. Ehcache-spring-annotations specifies an unsatisfiable depenedcy. It 
also doesn't seem possible to use pax to wrap the maven dependencyof 
ehcache-core 2.1

Original comment by benjamin...@gmail.com on 15 Sep 2010 at 8:12

GoogleCodeExporter commented 8 years ago
I also wasn't notified by email of your comments, just of you setting the bug 
as invalid. You should probably leave a bit more time for people to respond. 

Original comment by benjamin...@gmail.com on 15 Sep 2010 at 8:15

GoogleCodeExporter commented 8 years ago
Sorry about the quick close.

You can take a look at 
http://code.google.com/p/ehcache-spring-annotations/issues/detail?id=31 for the 
reasoning behind the current OSGI configuration.

Note that neither myself or the other developer on this project use OSGI and 
the current manifest configuration is completely based on what was provided in 
Issue 31. 

If you have a patch that would address your issue please provide it.

Original comment by eric.dalquist on 15 Sep 2010 at 8:57

GoogleCodeExporter commented 8 years ago
I'll see what Ican do. After debugging the problem I have a good knowledge of 
the problem area, here's hoping for a quick fix. 

Original comment by benjamin...@gmail.com on 15 Sep 2010 at 9:08

GoogleCodeExporter commented 8 years ago
Any more updates on this issue? We'd love to have better OSGI support if 
someone with OSGI experience can give us a hand.

Original comment by eric.dalquist on 25 Oct 2010 at 4:27

GoogleCodeExporter commented 8 years ago
We are having the same problem with Spring DM Server.  Any update on this?

Original comment by pdur...@gmail.com on 26 Oct 2010 at 7:56

GoogleCodeExporter commented 8 years ago
Like I said earlier in this issue, Nick and I do not use OSGi and are not 
familiar with the technology. If someone out there is an OSGi expert and can 
provide us a patch to address these issues we'll be happy to apply it.

Original comment by eric.dalquist on 26 Oct 2010 at 11:25

GoogleCodeExporter commented 8 years ago
Hi, 

Sorry I have made no progress on this issue at the moment. I am in the middle 
of a busy and time pressured project, but I do hope to get to the bottom of 
this at some point. I will do my best to get an update as soon as possible. 

Ben. 

Original comment by benjamin...@gmail.com on 27 Oct 2010 at 8:08

GoogleCodeExporter commented 8 years ago
According to some of the other posts, ehcache 1.6.0+ will work for this 
project.  If this is true, there is an existing OSGI net.sourceforge.ehcache 
bundle for version 1.6.2.  I believe that changing this project's manifest file 
import statement to contain something like this:

Import-Bundle: com.springsource.net.sf.ehcache;version="[1.6.2,1.6.2]"

should do the trick.

Original comment by pdur...@gmail.com on 9 Nov 2010 at 2:57

GoogleCodeExporter commented 8 years ago
I've got a similar problem. In a non-osgi environment, websphere application 
server still uses the manifest file to load dependend jars. 
The solution I have created, is to fix the manifest.mf file of the 
spring-context-support.2.5.6.SEC02.jar. 
In that file there is a reference to net.sf.ehcache to version [1.0.0,2.0.0). 
But ehcache-core-2.1.0.jar does not have a version in his manifest file, and it 
is greater then the maximum version. For websphere, my quickfix was to create 
an almost empty manifest file for spring-context-support.2.5.6.SEC02.jar. For 
an osgi environment, it would be nice to create a correct manifest file for 
ehcache-core.jar. And to fix the dependency in 
spring-context-support.2.5.6.SEC02.jar

Original comment by robrecht...@gmail.com on 19 Jan 2011 at 4:00

Attachments:

GoogleCodeExporter commented 8 years ago
Any update on this issue.

Original comment by maniksan...@gmail.com on 3 May 2012 at 10:55