[ https://issues.apache.org/jira/browse/WICKET-5910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14551253#comment-14551253 ]
ASF GitHub Bot commented on WICKET-5910: ---------------------------------------- GitHub user gsmet opened a pull request: https://github.com/apache/wicket/pull/119 WICKET-5910 Do not intercept the protected methods with CGLib. You can merge this pull request into a Git repository by running: $ git pull https://github.com/openwide-java/wicket WICKET-5910-cglib-and-protected-methods Alternatively you can review and apply these changes as the patch at: https://github.com/apache/wicket/pull/119.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #119 ---- commit b48d6cca6669c076b8283854ea677822a98c4a70 Author: Guillaume Smet <guillaume.s...@gmail.com> Date: 2015-05-19T21:15:02Z 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)