I am attempting to access a method within a remote interface using HttpInvoker. However, I get an java.lang.reflect.InvocationTargetException exception.
Here is the relevant portions of the stacktrace:
Question regarding the highlighted elements above; why does the UndeclaredThrowableException occur on $Proxy6 while the other refers to $Proxy21?Code:java.lang.reflect.InvocationTargetException . . . Caused by: java.lang.reflect.UndeclaredThrowableException at $Proxy21.setFilterState(Unknown Source) at com.xrite.ind.core.GroupTreeView.StandardNode.updateSampleCount(StandardNode.java:88) at com.xrite.ind.core.GroupTreeView.StandardNode.<init>(StandardNode.java:64) ... 53 more Caused by: java.lang.NoSuchMethodException: $Proxy6.setFilterState(com.xrite.ind.backcheck.filter.IFilterState) at java.lang.Class.getMethod(Class.java:1605) at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:203) at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:38) at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:76) at org.springframework.remoting.support.RemoteInvocationBasedExporter.invokeAndCreateResult(RemoteInvocationBasedExporter.java:112) at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:117) at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:47) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:820) . . .
Does this have something to do with the method signature being called including an argument? Does this argument need to be set up within the HttpInvokerProxyFactoryBean client side and HttpInvokerServiceExporter server side bean declarations?
Here is the client side Spring context declaration file bean def:
Here is the factory class code which grabs the bean from the client Spring context:Code:<bean id="colorCriteraDao" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> <property name="serviceUrl" value="http://localhost:8080/remoting/httpColorCriteraDao"/> <property name="serviceInterface" value="com.xrite.ind.backcheck.filter.IColorCriteraCreator"/> <property name="httpInvokerRequestExecutor"> <bean class="org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor"/> </property>
Here is the client side code which obtains the bean via the proxy and calls the method:Code:public static IColorCriteraCreator getColorCriteraCreator() { return (IColorCriteraCreator) beanFactory.getBean("colorCriteraDao"); }
Here is the server side proxy exporter declaration in remoting-servlet.xml:Code:IColorCriteraCreator crit = ClientFactoryImpl.getColorCriteraCreator(); IFilterState fs = MainWindow.getInstance().getApp().getFilter(); crit.setFilterState(fs);
Here is the applicationContext.xml server side settings which define the DAO beans referenced by remoting-servlet.xmlCode:<bean name="/httpColorCriteraDao" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter"> <property name="service"> <ref bean="colorCritera"/> </property> <property name="serviceInterface" value="com.xrite.ind.backcheck.filter.IColorCriteraCreator"/> </bean>
And here are the DAO Interface and Impl classes:Code:<bean id="colorCritera" class="com.xrite.ind.backcheck.filter.ColorCriteraCreator" > <property name="sessionFactory" ref="backcheckSessionFactory" /> </bean>
Code:public interface IColorCriteraCreator { void setFilterState(IFilterState filterState); }Code:public class ColorCriteraCreator implements IColorCriteraCreator { public void setFilterState(IFilterState filterState) { this.filterState = filterState; } }


Reply With Quote