October 21, 2010
We have been seeing this issue in DWR/Spring integrations. It looks like the Spring guys changed (changed since Spring 3.x?) their schema and now require an id attribute on top-level annotation-config elements. DWR uses a Spring class to parse the XML and it throws the following error:
“Configuration problem: Id is required for element ‘annotation-config’ when used as a top-level tag”
It appears for now adding an id attribute resolves the issue. I will continue to look into this.
This post applies to DWR 3.x and Spring 3.x. Configuring DWR to work with annotations and Spring isn’t difficult, but there are a lot of moving parts and many users struggle with it. There are a few elements that DWR has available and understanding them is key (these elements can be viewed in the DWR Spring schema – http://directwebremoting.org/schema/spring-dwr-3.0.xsd):
annotation-scan – This element enables DWR to scan the classpath, detect beans annotated with @RemoteProxy, @RemoteMethod, @DataTransferObject and register the beans (@DataTransferObject) and Creator proxies (@RemoteProxy & @RemoteMethod) for them.
annotation-config – This element enables DWR to scan the Spring context, detect beans annotated with @RemoteProxy and @RemoteMethod and registers Creator proxies for them. Note this element will only search the Spring context and will only create the Creator proxies. You will need to manually register converters for the types the proxy methods will return or accepts as parameters.
For now I have completed two sample applications that you can use to get started. I don’t have time to discuss the code right now but it is pretty straightforward.