PDA

View Full Version : DWR with proxied beans


erwin.wernsen
May 23rd, 2007, 11:49 AM
Hi,

I had DWR working for on one of my beans. Next I added the BeanNameAutoProxyCreator on that bean and then it broke. When I invoke a method I get an exception:
java.lang.IllegalArgumentException: object is not an instance of declaring class.

In the debugger I noticed that instead of the service-impl class I now have a proxy, the proxy however is proxied against the service interface while DefaultRemoter class from DWR expects it to be the service-impl class.

For example in my spring.xml:
<bean id="myService" class="MyServiceImpl">
<dwr:remote javascript="AjaxMyService">
<dwr:include method="doit"/>
</dwr:remote>
</bean>

<bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNa meAutoProxyCreator">
<property name="interceptorNames">
<value>transactionInterceptor</value>
</property>
<property name="beanNames">
<list>
<idref local="myService"/>
</list>
</property>
</bean>

Does anyone have any ideas how I can get DWR to work with proxied beans?

Regards,

Erwin

xmaniac
May 23rd, 2007, 02:48 PM
I blogged once about Spring, DWR and scopes. You can read it here (http://internna.blogspot.com/2007/05/integrating-dwr-spring.html)

erwin.wernsen
May 25th, 2007, 02:08 AM
scoping my bean did the trick, thanks.

Erwin