Sunday, October 20, 2013

GWTP Spring dispatch and GWTTestCase - No bean named 'HttpRequestHandlerServlet'

Hi folks,

I am having trouble with testing access to gwtp dispatcher configured in Spring environment.
but it seems that no one has encountered this problem so far.

Here's the details:

I am trying to create a simple integration test using GWTTestCase. I am aware of other strategies for doing that (Selenium, etc.). However, I have reasons to run GWTTestCase tests as well so this is still important to me ;)

Main application works fine in both web and dev mode. However when I run my GWTTestCase I get this:

2013-09-20 11:28:28,044 DEBUG [org.apache.http.impl.conn.DefaultClientConnection] thread:[JS executor for com.gargoylesoftware.htmlunit.WebClient@af69121] Sending request: POST /com.media.frontend.MediaFrontendJUnit.JUnit/dispatch/GetClip HTTP/1.1

...

[WARN] /com.media.frontend.MediaFrontendJUnit.JUnit/dispatch/GetClip org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.web.context.support.HttpRequestHandlerServlet-1696289432' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:549) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1096) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:278) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1121) at org.springframework.web.context.support.HttpRequestHandlerServlet.init(HttpRequestHandlerServlet.java:57) at javax.servlet.GenericServlet.init(GenericServlet.java:212) ...

These are excerpts from my configs/Java:

src/main/webapp/WEB-INF/web.xml

!-- Creates the Spring Container shared by all Servlets and Filters -->  <listener>      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  </listener>    <!-- Java-based annotation-driven Spring container definition -->  <context-param>      <param-name>contextClass</param-name>      <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>  </context-param>    <servlet>      <servlet-name>dispatch</servlet-name>      <servlet-class>org.springframework.web.context.support.HttpRequestHandlerServlet</servlet-class>  </servlet>    <servlet-mapping>      <servlet-name>dispatch</servlet-name>      <url-pattern>/dispatch/*</url-pattern>  </servlet-mapping>

No servlet entries are present in MediaFrontend.gwt.xml - Main application gwt module configuration

MediaFrontendJUnit.gwt.xml:

<module>  <!-- Inherit our applications main module.                      -->      <inherits name='com.media.frontend.MediaFrontend'/>        <source path="client" />      <source path="gwt" />        <servlet path="/dispatch/*" class="org.springframework.web.context.support.HttpRequestHandlerServlet"/>    </module>

I was able to find a solution by myself which is absolutely not acceptable because it puts Test-related configuration in my production environment: it works fine when I add this mapping to my src/main/webapp/WEB-INF/web.xml:

<servlet-mapping>      <servlet-name>dispatch</servlet-name>      <url-pattern>/com.media.frontend.MediaFrontendJUnit.JUnit/dispatch/*</url-pattern>  </servlet-mapping>

I've been really struggling with this for a long time and still have no idea why it happens. I'm really looking to any suggestions and help from you. Thanks!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate