Closed GoogleCodeExporter closed 9 years ago
The workaround here is to use only the springDataSourceBeanPostProcessor part
of monitoring-spring.xml.
Maybe it would be OK to provide not only the one-stop config in
monitoring-spring.xml but also separate files for its separate parts (or
documentation for people needing only some of these parts and having problems
with others).
Original comment by m...@meep.pl
on 9 Jan 2012 at 4:57
Instead of using only the springDataSourceBeanPostProcessor part of
monitoring-spring.xml, is this issue fixed by just using
monitoring-spring-aspectj.xml, which is also included in javamelody jar file?
In other words, is it fixed by adding
classpath:net/bull/javamelody/monitoring-spring-aspectj.xml to web.xml (and not
monitoring-spring.xml) ?
Original comment by evernat@free.fr
on 11 Jan 2012 at 9:09
To myself: if yes, I may add a note at the end of the JDBC chapter of the user
guide for this.
Original comment by evernat@free.fr
on 11 Jan 2012 at 9:17
Unfortunately monitoring-spring-aspectj.xml brings another problem here
(because of <aop:config proxy-target-class="true"> is my first guess):
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name '<X>' defined in class path resource [<Y>]:
Initialization of bean failed; nested exception is
org.springframework.aop.framework.AopConfigException: Could not generate CGLIB
subclass of class [<Z>]: Common causes of this problem include using a final
class or a non-visible class; nested exception is
java.lang.IllegalArgumentException: Superclass has no null constructors but no
arguments were given
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
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.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474)
... 44 more
Caused by: org.springframework.aop.framework.AopConfigException: Could not
generate CGLIB subclass of class [<Z>]: Common causes of this problem include
using a final class or a non-visible class; nested exception is
java.lang.IllegalArgumentException: Superclass has no null constructors but no
arguments were given
at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:212)
at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:112)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:476)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:362)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1426)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
... 53 more
Caused by: java.lang.IllegalArgumentException: Superclass has no null
constructors but no arguments were given
at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:721)
at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:499)
at net.sf.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:33)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:200)
... 60 more
Original comment by m...@meep.pl
on 16 Jan 2012 at 11:38
So I have added the monitoring-spring-datasource.xml file (revision 2617) as an
alternative to the all-in-one monitoring-spring.xml file.
Doc to be added in the user guide:
If ever, there is a conflict in your application between the all-in-one monitoring-spring.xml and AOP or @Autowired,
then you can use the monitoring-spring-datasource.xml file, instead of monitoring-spring.xml.
This file contains only the datasource post-processor and an example of SpringDataSourceFactoryBean.
Thanks
Original comment by evernat@free.fr
on 11 Mar 2012 at 6:09
Isn't this not really a "fix", but a workaround? I would like to still be able
to use the @MonitoredWithSpring annotation, but am unable to use it because of
this issue with Autowiring. While it is nice to have the datasource monitoring
now, it seems to me that the underlying issue still remains.
Original comment by kevhen...@gmail.com
on 21 Mar 2012 at 2:49
@kevhender
Certainly.
Do you have a patch in mind? an alternative monitoring-spring-x.xml file?
Original comment by evernat@free.fr
on 21 Mar 2012 at 5:13
I had not really thought about how to patch... I certainly didn't intend to
sound rude, so I hope that it didn't come across that way. My only intention
was to try to ensure that this issue doesn't get lost since it is marked as
"Fixed," but technically isn't fixed yet. Thanks.
Original comment by kevhen...@gmail.com
on 22 Mar 2012 at 1:17
Original issue reported on code.google.com by
m...@meep.pl
on 9 Jan 2012 at 4:54