| Issue 217: | Interceptorがかかっているコンポーネントに対してDIが適切に動作しない. | |
| 1 person starred this issue and may be notified of changes. | Back to list |
ProxyクラスによるAOPを使っている際に、@InjectによるDIが適切に動作しない. MedhodDescは、実体のクラスからとったメタ情報によって、 Method#invokeしようとするが、第一引数となるオブジェクトがProxyクラスである 為、型に互換性が無く、実行時エラーとなる. 致命的: サーブレット default のServlet.service()が例外を投げました java.lang.IllegalArgumentException: object is not an instance of declaring class at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.t2framework.commons.util.Reflections$MethodUtil.invoke(Reflections.java:508) at org.t2framework.commons.meta.impl.MethodDescImpl.invoke(MethodDescImpl.java:102) at org.t2framework.commons.meta.impl.PropertyDescImpl.setValue(PropertyDescImpl.java:180) at org.t2framework.lucy.inject.PropertyInjector.injectPropertyDesc(PropertyInjector.java:68) at org.t2framework.lucy.inject.PropertyInjector.inject(PropertyInjector.java:61) at org.t2framework.lucy.behavior.InjectBehavior.execute(InjectBehavior.java:122) at org.t2framework.lucy.ComponentBuilderFactory$DefaultComponentBuilderImpl.processBehavior(ComponentBuilderFactory.java:85) at org.t2framework.lucy.ComponentBuilderFactory$DefaultComponentBuilderImpl.processMethodAndProperties(ComponentBuilderFactory.java:103) at org.t2framework.lucy.ComponentBuilderFactory$DefaultComponentBuilderImpl.build(ComponentBuilderFactory.java:67) at org.t2framework.lucy.impl.LucyImpl.buildComponent(LucyImpl.java:186) at org.t2framework.lucy.impl.LucyImpl.get(LucyImpl.java:145) at org.t2framework.lucy.inject.PropertyInjector.prepareComponent(PropertyInjector.java:106) at org.t2framework.lucy.inject.PropertyInjector.prepareArg(PropertyInjector.java:80) at org.t2framework.lucy.inject.PropertyInjector.inject(PropertyInjector.java:60) at org.t2framework.lucy.behavior.InjectBehavior.execute(InjectBehavior.java:122) at org.t2framework.lucy.ComponentBuilderFactory$DefaultComponentBuilderImpl.processBehavior(ComponentBuilderFactory.java:85) at org.t2framework.lucy.ComponentBuilderFactory$DefaultComponentBuilderImpl.processMethodAndProperties(ComponentBuilderFactory.java:103) at org.t2framework.lucy.ComponentBuilderFactory$DefaultComponentBuilderImpl.build(ComponentBuilderFactory.java:67) at org.t2framework.lucy.impl.LucyImpl.buildComponent(LucyImpl.java:186) at org.t2framework.lucy.impl.LucyImpl.getBeanDesc(LucyImpl.java:139) at org.t2framework.t2.adapter.LucyContainerAdapter.getBeanDesc(LucyContainerAdapter.java:93) at org.t2framework.t2.contexts.impl.WebApplicationImpl.loadPageDescMap(WebApplicationImpl.java:309) at org.t2framework.t2.contexts.impl.WebApplicationImpl.createPageDescMap(WebApplicationImpl.java:298) at org.t2framework.t2.filter.T2Filter.initActionInvokerList(T2Filter.java:199) at org.t2framework.t2.filter.T2Filter.getActionInvokerList(T2Filter.java:187)
Jun 4, 2009
Proxyベースだと受け手がインタフェースしかダメとかそういうの関係あるかな?
Jun 10, 2009
修正しました。
Labels:
milestone-lucy-0.6
Jun 10, 2009
(No comment was entered for this change.)
Status:
Fixed
|
分かり易いのはこのへん. targetがProxyクラス。 writeMethodDescが抱えているのは、AOP対象となるクラスからとったMethodオブジェクト. PropertyDescImpl public void setValue(T target, Object value) { assertWriteMethodDesc(); try { writeMethodDesc.invoke(target, convertArgs(value)); } catch (Throwable t) { throw new IllegalPropertyRuntimeException(t, targetClass, propertyName); } }