Description
Hi,
When trying to inject a Jackson 2 ObjectMapper, we end up with the following exception:
java.lang.IllegalArgumentException: Protected method: defaultClassIntrospector()Lcom/fasterxml/jackson/databind/introspect/ClassIntrospector;
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:209)
at org.apache.wicket.proxy.LazyInitProxyFactory$CGLibInterceptor.intercept(LazyInitProxyFactory.java:329)
at WICKET_com.fasterxml.jackson.databind.ObjectMapper$$EnhancerByCGLIB$$b8a70988.defaultClassIntrospector(<generated>)
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:465)
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:391)
at WICKET_com.fasterxml.jackson.databind.ObjectMapper$$EnhancerByCGLIB$$b8a70988.<init>(<generated>)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:228)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216)
at net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:643)
at net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:231)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:170)
at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:164)
at org.apache.wicket.injection.Injector.inject(Injector.java:111)
at org.apache.wicket.spring.injection.annot.SpringComponentInjector.inject(SpringComponentInjector.java:124)
at fr.openwide.core.wicket.more.console.maintenance.task.model.BatchReportBeanModel.<init>(BatchReportBeanModel.java:45)
I ended up on this thread which explains the issue and how the people at Spring fixed the issue:
http://comments.gmane.org/gmane.comp.java.cglib.devel/720
There are 2 ways to fix the issue:
- either use invokeSuper() instead of invoke() if the method is protected;
- or do not override at all the calls to protected methods.
Spring did it the second way and that's what I implemented in the PR to come.
Attachments
Issue Links
- breaks
-
WICKET-5978 LazyInitProxyFactory fills permgen space
- Resolved