Results 1 to 3 of 3

Thread: DWR Spring setup?

  1. #1
    Join Date
    Dec 2006
    Posts
    20

    Default DWR Spring setup?

    So, with the help of this link:
    http://bram.jteam.nl/index.php/2007/...jax-made-easy/
    I kind of got DWR list page to show up. However, anytime I try to execute any of the functions shown on the page, it throws an error.

    This is what I first put in
    [code]
    <bean id="myManager" class="llr.service.impl.MyManagerImpl">
    <dwr:remote javascript="MyAjaxManagerService">
    <dwr:include method="loadById"/>
    <dwr:include method="loadByUserId"/>
    </dwr:remote>
    <property name="myDao" ref="myDao"/>
    </bean>
    [code]
    The logs show
    Code:
    007-04-04 01:32:53,437 WARN [org.directwebremoting.impl.DefaultRemoter] - Method execution failed:
    java.lang.IllegalArgumentException: object is not an instance of declaring class
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34)
    I looked a little further and found a <dwr:configuration> tag which I thought would be the correct way to do it.

    So, here's what I have now
    Code:
    <bean id="myManager" class="com.service.impl.MyManagerImpl">
        <dwr:remote javascript="MyAjaxManagerService">
        <dwr:include method="loadById"/>
        <dwr:include method="loadByUserId"/>
        </dwr:remote>	   
        <property name="myDao" ref="myDao"/>
        </bean>   
    
    <dwr:configuration>
    		<dwr:create type="new"
    			class="com.service.impl.MyManagerImpl""
    			javascript="MyAjaxService"/>
    		<dwr:convert type="bean" class="com.model.TestObject" />
    	</dwr:configuration>

    This now gives me Null Pointer exceptions on Loading (in the tomcat logs)
    http://getahead.org/blog/joe/2006/06...s_and_dwr.html
    is the link I was trying to base my code off.
    Please help!

  2. #2
    Join Date
    Dec 2006
    Posts
    20

    Default Fix!

    In case anybody else needs it, it turned out, I was doing it wrong!!! It is actually very simple

    Here's how to do it with DWR & Spring using the spring config file instead of the dwr.xml file

    Code:
    <bean id="myManagerBean" class="myManager.class">
    <dwr:remote javascript="myAjaxManager">
    <dwr:include method="loadById"/>
    </dwr:remote>
    <property name="myDao" ref="myDao"/>
    </bean>
    <dwr:configuration>
    <dwr:convert type="bean" class="com.example.model.*"/>
    </dwr:configuration>
    You can obviously substitute the model.* with just one bean if you wish to convert only a particular one.

    This will solve the "object is not an instance of the calling class" problem.

    Obviously, you still have to map the /dwr/* to your controller
    as well as in your web.xml (servlet name and mapping)

  3. #3

    Default The List object not refreshing

    Hi ,
    I am new to dwr
    I am using with spring and hibernate.
    Well everything was ok just that the list i retrieve by my dwr remote method got the data in the form of list first time and if i refresh or call the JavaScript function of fillTable again it displays the same data even i manually edit the data in mysql db .
    i am using dwr-sping i.e not using dwr.xml
    I am using both dwr controller and spring MVC controller
    i have debugged that the data at DAO layer (i.e hibernate) is retrieving the correctly but the list object which i get via dwr remote method is getting the same data which it received first time , is this object scoping problem , just guessing .

    My main intention is to auto refresh the page using dwr as the data contains more then 15000 plus rows and not to delete and populate as it will give same conventional refresh page effect , i want to first load and then replace / edit the existing data in html table so that if use scroll down after refesh he is not again at first record and also show that data change effect (like changing border color of cell )


    I hope i am able to explain the problem

    Thanks in advance for your valuable suggestion

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •