[ 
https://issues.apache.org/jira/browse/WICKET-5910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14552232#comment-14552232
 ] 

ASF subversion and git services commented on WICKET-5910:
---------------------------------------------------------

Commit 077e1c3d54d044ccfe7b56cc4decf4baf2cc6717 in wicket's branch 
refs/heads/master from [~gsmet]
[ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=077e1c3 ]

WICKET-5910 Do not intercept the protected methods with CGLib.


> CGLib proxy should not intercept protected methods
> --------------------------------------------------
>
>                 Key: WICKET-5910
>                 URL: https://issues.apache.org/jira/browse/WICKET-5910
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 7.0.0-M5
>            Reporter: Guillaume Smet
>
> Hi,
> When trying to inject a Jackson 2 ObjectMapper, we end up with the following 
> exception:
> {quote}
> 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)
> {quote}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to