Exceptions while integrating DWR3 and Spring3.X annotation based MVC:
Following are the solutions for the Exception commonly occur while integration:
- “org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionParser for element [annotation-scan]“.
Solution:
- Don’t use DWR with version number DWR 3.0M1(available in Maven Repository)
- Use DWR 3.0-RC1-116 or later version. You can down load the latest version from
Solution: keep separate dwr.xml and don’t import into spring-config.xml file instead configure in web.xml as shown below
<servlet> <servlet-name>SampleDWR</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath: dwr.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> 3. No adapter for handler [org.directwebremoting.spring.DwrController@1b3f577]: Does your handler implement a supported interface like Controller?Solution: keep the following line of code in dwr.xml file
<bean class=”org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter” />
This is because mvc: annotation-driven element doesn’t declare a SimpleControllerHandlerAdapter
4 .If you are using Tomcat7 and DWR.3.0-RC1-116.jar file then you will get “CSRF Security Error”: java.lang.SecurityException: CSRF Security Error
Solution:
- One fix is to make the default Tomcat 7 tomcat/conf/context.xml (or your application’s context XML) put the useHTTPOnly on the Context element, like so: <Context useHttpOnly=”false”>
- You can also fix this issue by using the latest DWR build
https://oss.sonatype.org/content/groups/public/org/directwebremoting/dwr/3.0.0-rc3-SNAPSHOT/
great artical u saved lots of time.
Can’t download DWR 3.0.0-rc3-SNAPSHOT from sonatype.
Error:
Missing artifact org.directwebremoting:dwr:jar:3.0.0-rc3-SNAPSHOT:compile
This is the error your getting right,

then,Your not using the repository. Please keep the below code in your pom file
If still having the problems post your pom file content.
Hi Mohan,
Sorry I forgot to thank you on your post. And thanks for the reply.
I’ve put both, the dependency and the repositories tags but I’m still getting the missing artifact error. I can’t get you the pom right now since it is holiday in our country and weekend is coming after. I’ll post the pom when I get back to office.
But as a workaround, I downloaded the jar and put it in my .m2 directory. When I verified that my error was gone for annotation-scan, I contacted our admin to put the jar in our sonatype.
Thanks,
Ryan
Good job indeed