Micheal_Male
asked on
question on using dwr with spring
This is my first time using dwr. I am using dwr 1.0 library and trying to integrate it with spring. I have a service class and a main AJAXUser class in which i am getting the bean name for my service layer through WebApplicationContextUtils and in the same AJAXUser class i am calling the service layer to get some values from the DB. Below you can see my configuration for dwr.xml.
EVerytime i run my JSP page and tries to click on a button which will call an Ajax function to output the values i get a javascript error 'name cannot be null' and i get an exception in my console. I am sure that my service layer is defined properly in applicationContext.xml. It looks like the dwr.xml cannot instantiate my AJAXUser class.
EVerytime i run my JSP page and tries to click on a button which will call an Ajax function to output the values i get a javascript error 'name cannot be null' and i get an exception in my console. I am sure that my service layer is defined properly in applicationContext.xml. It looks like the dwr.xml cannot instantiate my AJAXUser class.
<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
"http://www.getahead.ltd.uk/dwr/dwr10.dtd">
<dwr>
<allow>
<create creator="spring" javascript="AJAX">
<param name="class" value="user.AJAXUser"></param>
</create>
</allow>
</dwr>
Error :-
WARNING: Method execution failed:
java.lang.IllegalArgumentException: 'name' must not be null
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.beans.factory.BeanFactoryUtils.transformedBeanName(BeanFactoryUtils.java:71)
at org.springframework.beans.factory.support.AbstractBeanFactory.transformedBeanName(AbstractBeanFactory.java:799)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:733)
at uk.ltd.getahead.dwr.create.SpringCreator.getInstance(SpringCreator.java:143)
at uk.ltd.getahead.dwr.impl.ExecuteQuery.execute(ExecuteQuery.java:181)
at uk.ltd.getahead.dwr.impl.DefaultExecProcessor.handle(DefaultExecProcessor.java:48)
at uk.ltd.getahead.dwr.impl.DefaultProcessor.handle(DefaultProcessor.java:81)
at uk.ltd.getahead.dwr.AbstractDWRServlet.doPost(AbstractDWRServlet.java:162)
ASKER
Thank you mahome. I created a beanName by the name ajaxUser in my applicationContext and had the property set to my userService and now my class is getting compiled. I actually thought the beanname was the ACTUAL beanname of my controller class.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect explanation. Thanks
So it have to be something like this:
Also have a look here: http://directwebremoting.org/dwr/server/integration/spring.html
Open in new window