IllegalArgumentException: not a proxy instance with @Proxiable @Scope config beans #122
Comments
Reported by andriy.zhdanov |
File: ctm-example.patch |
Was assigned to mk111283 |
File: config-CGLib-Enhancer.patch |
andriy.zhdanov said: |
@jwells131313 said: |
andriy.zhdanov said: |
File: proposed-fix-complete.patch |
@jwells131313 said: That way is to use ProxyCtl#__make. All proxies generated for @Proxiable implement the ProxyCtl interface. A lot of the code you have up there can be simplified (and all of the cglib specific stuff can be removed). All you would need to do is something like: if (service instanceof ProxyCtl) { ProxyCtl pc = (ProxyCtl) service; return pc.__make(); } This will give you back the "unwrapped" service (well, after I make my little change that will have __make return the underlying service anyway... which I will do in about five minutes). I hope this helps! |
@jwells131313 said: |
andriy.zhdanov said:
Committed revision 3927: reveal ConfigBeanProxy from @Proxiable object |
@tlcksnyder said: |
Marked as fixed on Friday, December 6th 2013, 3:58:24 am |
This issue was imported from java.net JIRA HK2-78 |
Problem is that for @Proxiable @scope CGlib is used but hk2.config does not expect this.
Problem is that for @Proxiable @scope CGlib is used but hk2.config does not expect this.
Attached changes for ctm-example to reproduce the problem:
ConfigSupport.apply throws: java.lang.IllegalArgumentException: not a proxy instance
at java.lang.reflect.Proxy.getInvocationHandler(Proxy.java:657)
at org.jvnet.hk2.config.Dom.unwrap(Dom.java:401)
at org.jvnet.hk2.config.ConfigSupport.apply(ConfigSupport.java:133)
at org.jvnet.hk2.config.ConfigSupport.apply(ConfigSupport.java:113)
at org.glassfish.examples.ctm.runme.CTMTest.testProviderEngineUsesCorrectTenant(CTMTest.java:112)
Transactions.enroll() throws: java.lang.IllegalArgumentException: not a proxy instance
at java.lang.reflect.Proxy.getInvocationHandler(Proxy.java:657)
at org.jvnet.hk2.config.Transaction.enroll(Transaction.java:155)
at org.glassfish.examples.ctm.runme.CTMTest.testProviderEngineUsesCorrectTenant(CTMTest.java:124)
Affected Versions
[2.1.*]
The text was updated successfully, but these errors were encountered: