No adapter for handler [GWTRPCServiceExporter]: Does your handler implement a supported interface like Controller?

1,481 views
Skip to first unread message

oakridge

unread,
May 24, 2010, 5:55:57 PM5/24/10
to gwt-sl
Hi all,

So I tried using the new annotation based approach
(GWTRequestMapping), but I receive the error:

No adapter for handler [GWTRPCServiceExporter]: Does your handler
implement a supported interface like Controller?

My spring config looks like this:

<!-- End MVC Annotation Driven Handler Mappings -->
<bean class="org.gwtwidgets.server.spring.GWTHandler"/>

<!-- Declare service -->
<bean id="testService"
class="com.mycompany.server.TestServiceImpl" />

My Java Interface:

@GWTRequestMapping("/testService")
public interface TestService extends RemoteService{
public int add(int a, int b);
}

And my implementation:

public class TestServiceImpl implements TestService{
public int add(int a, int b) {
return a + b;
}
}


According to the docs, this is valid. Is there something I am
missing? Do I need to configure any other components?

Thanks,
Julian

--
You received this message because you are subscribed to the Google Groups "gwt-sl" group.
To post to this group, send an email to gwt...@googlegroups.com.
To unsubscribe from this group, send email to gwt-sl+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gwt-sl?hl=en-GB.

Julian Klein

unread,
May 24, 2010, 9:06:20 PM5/24/10
to gwt-sl
Let me add that this is the case only when I try to use the GWTHandler and the FlowHandler at the same time.  I am using Richfaces JSF.  Here is the JSF/Webflow config:


    <!-- Begin Webflow Configurations -->
    <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
        <property name="flowRegistry" ref="flowRegistry"/>
        <property name="order" value="0"/><!-- I've tried 1 here as well --->
    </bean>

    <!-- Maps logical view names to Facelet templates in /WEB-INF (e.g. 'search' to '/WEB-INF/search.xhtml' -->
    <bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
        <property name="prefix" value="/WEB-INF/"/>
        <property name="suffix" value=".xhtml"/>
    </bean>

    <!-- Configures the Spring Web Flow JSF integration -->
    <!--<faces:flow-builder-services id="facesFlowBuilderServices"/>-->
    <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
        <property name="flowExecutor" ref="flowExecutor"/>
        <property name="ajaxHandler">
        <bean class="org.springframework.faces.richfaces.RichFacesAjaxHandler"/>
        </property>

    </bean>


    <!-- Executes flows: the central entry point into the Spring Web Flow system -->
    <flow:flow-executor id="flowExecutor">
        <flow:flow-execution-listeners>
            <flow:listener ref="jpaFlowExecutionListener"/>
        </flow:flow-execution-listeners>
    </flow:flow-executor>

    <!-- The registry of executable flow definitions -->
    <flow:flow-registry id="flowRegistry" flow-builder-services="facesFlowBuilderServices" base-path="/WEB-INF/flows/">
        <flow:flow-location-pattern value="/**/*-flow.xml"/>
    </flow:flow-registry>

    <flow:flow-builder-services id="facesFlowBuilderServices" development="true" view-factory-creator="viewFactoryCreator"/>

    <bean id="viewFactoryCreator" class="org.springframework.faces.webflow.JsfViewFactoryCreator"/>


Here is the stack trace:

javax.servlet.ServletException: No adapter for handler [GWTRPCServiceExporter]: Does your handler implement a supported interface like Controller?
	org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:982)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:770)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
	org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
	org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
	org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
	org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
	org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
	org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
	org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
	org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
	org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
	org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
	org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
	org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
	org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
	org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
	org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109)
	org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
	org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
	org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
	org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

Thanks,
Julian

George Georgovassilis

unread,
May 25, 2010, 6:01:44 AM5/25/10
to gwt...@googlegroups.com
Hello Julian,

It's just astounding what you guys come up with all the time :-)
Ok, to start with: does the FlowHandler use any of your RPC services?
Because I don't quite see how Flow and GWT can work together. I suspect
that you are using a webflow application with some embedded GWT modules
that require some RPC, right?

If that is the case, your easiest way out is to declare the RPC services
in a different -servlet.xml file, which would bind the flow modules to a
different URL that then RPC modules.
If for some reason you cannot do that, please try to hack the SL code
and let me know if it worked:

1. Please find the RPCServiceExporter interface and replace
HttpRequestHandler with Controller.
2. Find the GWTRPCServiceExporter class and change the return type of
the handleRequest method from void to ModelAndView (you can safely
return a null there).
3. Do the same for DummyGWTRpcServiceExporter
4. rebuild the project and extract a JAR

Hope this helps,
G.

oakridge

unread,
May 25, 2010, 8:45:09 AM5/25/10
to gwt-sl
George,

Thanks for the input. I'll take a look a little later, but to clarify
I am not using Webflow with GWT. I have two separate UI technologies
that I am using. GWT should be entirely independent.

oakridge

unread,
May 25, 2010, 8:57:45 AM5/25/10
to gwt-sl
Ok, let me also add that I was hoping to use an annotation based
approach only. I'll keep digging around, but I am not sure the above
solution works for the case where I am not using WebFlow to drive RPC.

Thanks again.

oakridge

unread,
May 25, 2010, 9:15:49 PM5/25/10
to gwt-sl
George,

Alright, so I made the changes as you suggested. Thanks for the help,
it worked! I also had to add the following bean to finalize the
solution:

<bean
class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" /
>

Thanks again,
Julian

George Georgovassilis

unread,
May 26, 2010, 3:04:36 AM5/26/10
to gwt...@googlegroups.com
Glad to hear that Julian. I'd like to understand the problem somewhat better and could use some more details about your setup. As far as I understand, you don't have any -servlet.xml files since you wire your controllers via annotations. How do you achieve the sepperation of instantiated beans into different bean contexts? The FlowHandler cannot coexist with the GWTHandler in the same bean context, because they would be exporting the same beans twice. By implementing the workaround I proposed you have effectively instructed the FlowHandler to export RPC services to the web. A real fix would probably involve telling the FlowHandler to omitt the RPC services...

oakridge

unread,
May 26, 2010, 11:57:06 AM5/26/10
to gwt-sl
This is the configuration I have:


<!-- Begin GWT Configuration -->

<!-- Scan all busadmin packages for Spring annotations -->
<context:component-scan base-package="com.mycompany.application"/>

<!-- Required to enable invocation of
org.springframework.web.servlet.Controllers -->
<bean
class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" /
>

<!-- Automatically maps all GWT annotated classes
(GWTRequestMapping) as Controllers for RPC-->
<bean class="org.gwtwidgets.server.spring.GWTHandler">
<property name="order" value="1"/>
</bean>
<!-- End GWT Configuration -->

This is the Spring config that I added to my previously mentioned
config. I haven't verified that the bean is exported twice (I don't
recall a simple way to achieve that offhand). I only annotated the
service interface with the GWTRequestMapping and
RemoteServiceRelativePath annotations. Then I annotated the impl with
a @Service annotation. Let me know if this helps.

Thanks,
Julian

Reply all
Reply to author
Forward
0 new messages