DWR3- RC2. Method not found. See logs for details.

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

DWR3- RC2. Method not found. See logs for details.

ramzi.abbyad
Hello,

I am upgrading from dwr2 to dwr3 rc2.  I am receiving the following
error message: "No methods called x in y are applicable for the passed
parameters."  And then an IllegalArgumentException("method not found.
See logs for details")


In particular, the dwr code fails at line 186, in the Call.java class.
When it does the following check  

if (inputArgCount <= i && methodParamType.isPrimitive())
                {
                    it.remove();
                    continue allMethodsLoop;
                }


The method signature of the function being called in java which is
being remoted is as follows:

public IGrid orderSummarySearch(HttpSession session, WebForm
searchParams, int start, int count) throws Exception {
...

}

The problem is that the inputArgCount  = 3

whereas i ranges from 0 to 3 (over the 4 parameters in the java method
signature).  When "i" has the value 3, inputArgCount <= i, and since
the 4th parameter is an int, it satisfies methodParamType.isPrimitive()
as well.  


If inputArgCount were equal to 4, there would be no problem and the
method would work fine.  But since it doesn't count the HttpSesssion
variable, it sets inputArgCount = 3.  Any ideas on what I might be
doing wrong here?

Thanks,

Ramzi
Reply | Threaded
Open this post in threaded view
|

Re: DWR3- RC2. Method not found. See logs for details.

Mike Wilson
Administrator
DWR3 enhances varargs support and therefore some changes have been made to
argument handling. There were some bugfixes made in this algorithm in 3.0
RC3 so please re-test with this latest version and report back.

If you still experience problems with 3.0 RC3 let us know what arguments you
are passing from the client-side for the failing call.

Best regards
Mike Wilson

r.abbyad wrote:

> Hello,
>
> I am upgrading from dwr2 to dwr3 rc2.  I am receiving the following
> error message: "No methods called x in y are applicable for the passed
> parameters."  And then an IllegalArgumentException("method not found.
> See logs for details")
>
>
> In particular, the dwr code fails at line 186, in the
> Call.java class.
> When it does the following check  
>
> if (inputArgCount <= i && methodParamType.isPrimitive())
> {
>    it.remove();
>    continue allMethodsLoop;
> }
>
>
> The method signature of the function being called in java which is
> being remoted is as follows:
>
> public IGrid orderSummarySearch(HttpSession session, WebForm
> searchParams, int start, int count) throws Exception {
> ...
>
> }
>
> The problem is that the inputArgCount  = 3
>
> whereas i ranges from 0 to 3 (over the 4 parameters in the java method
> signature).  When "i" has the value 3, inputArgCount <= i, and since
> the 4th parameter is an int, it satisfies
> methodParamType.isPrimitive()
> as well.  
>
>
> If inputArgCount were equal to 4, there would be no problem and the
> method would work fine.  But since it doesn't count the HttpSesssion
> variable, it sets inputArgCount = 3.  Any ideas on what I might be
> doing wrong here?
>
> Thanks,
>
> Ramzi

Reply | Threaded
Open this post in threaded view
|

Re: DWR3- RC2. Method not found. See logs for details.

ramzi.abbyad
My mistake, I meant to say RC3.  We are currently using rc3.  The call from the client side is:

var webForm = {
            orderDateFrom:[today],
            orderDateTo:[today],
            version: [0],
            instanceId: [0],
            marketType: ["B"]
        };

OrderBlotterDA.orderSummarySearch(webForm, 0, 1, {
    callback: this.__reloadStore.createDelegate(this),
    errorHandler: function(errorString, exception){
    Ext.Msg.show({
    title:      'Order Summary Error',
    msg:        errorString,
    buttons:    Ext.Msg.OK,
    icon:       Ext.MessageBox.ERROR
    });
       }
    })  
Again the signature for the function on the client side contains an HttpServlet context veriable.  It is

public IGrid orderSummarySearch(HttpSession session, WebForm  searchParams, int start, int count) throws Exception


Note, the method works fine if I change the function signature to
public IGrid orderSummarySearch(WebForm  searchParams, int start, int count, HttpSession session)

(I put the HttpSession variable at the end of the list).  This is, again, due to the lines of code in the Call.java class that I posted in my previous email.

This leads me to believe that there may be a bug in your code.  If, for some reason the error is in our converter for the WebForm, I include the WebFormConverter code below:

package com.muni.web2.dwr;

import java.lang.reflect.Modifier;

public class WebFormConverter implements Converter
{
    /* (non-Javadoc)
     * @see org.directwebremoting.Converter#setConverterManager(org.directwebremoting.ConverterManager)
     */
    public void setConverterManager(ConverterManager newConfig)
    {
        this.config = newConfig;
    }

    /* (non-Javadoc)
     * @see org.directwebremoting.Converter#convertInbound(java.lang.Class, org.directwebremoting.InboundVariable, org.directwebremoting.InboundContext)
     */
   
    @edu.umd.cs.findbugs.annotations.SuppressWarnings(value={"UCPM_USE_CHARACTER_PARAMETERIZED_METHOD","CLI_CONSTANT_LIST_INDEX"})
    public Object convertInbound(Class<?> paramType, InboundVariable iv) throws ConversionException
    {
   
        String value = iv.getValue();

        // If the text is null then the whole bean is null
        if (value.trim().equals(ProtocolConstants.INBOUND_NULL))
        {
            return null;
        }

        if (!value.startsWith(ProtocolConstants.INBOUND_MAP_START))
        {
            throw new IllegalArgumentException("Messages.getString(\"MapConverter.FormatError\", ProtocolConstants.INBOUND_MAP_START)");
        }

        if (!value.endsWith(ProtocolConstants.INBOUND_MAP_END))
        {
            throw new IllegalArgumentException("Messages.getString(\"MapConverter.FormatError\", ProtocolConstants.INBOUND_MAP_END)");
        }

        value = value.substring(1, value.length() - 1);

        try
        {
            // Maybe we ought to check that the paramType isn't expecting a more
            // distinct type of Map and attempt to create that?
            Map map;

            // If paramType is concrete then just use whatever we've got.
            if (!paramType.isInterface() && !Modifier.isAbstract(paramType.getModifiers()))
            {
                // If there is a problem creating the type then we have no way
                // of completing this - they asked for a specific type and we
                // can't create that type. I don't know of a way of finding
                // subclasses that might be instaniable so we accept failure.
                map = (Map) paramType.newInstance();
            }
            else
            {
                map = new HashMap();
            }
           
            Property parent = iv.getContext().getCurrentProperty();
           
            Property keyProp = parent.createChild(0);
            keyProp = this.config.checkOverride(keyProp);
            Class<?> keyType = keyProp.getPropertyType();
           
            Property valProp = parent.createChild(1);
            Class<?> valType = String[].class;
            valProp = this.config.checkOverride(valProp);
             
            iv.getContext().addConverted(iv, paramType, map);
            InboundContext incx = iv.getContext();
            // Get the extra type info


            // Loop through the property declarations
            StringTokenizer st = new StringTokenizer(value, ",");
            int size = st.countTokens();
            for (int i = 0; i < size; i++)
            {
                String token = st.nextToken();
                if (token.trim().length() == 0)
                {
                    continue;
                }

                int colonpos = token.indexOf(ProtocolConstants.INBOUND_MAP_ENTRY);
                if (colonpos == -1)
                {
                    throw new MarshallException(paramType, "Missing : in object description: {1}" + token);
                }

                // Convert the value part of the token by splitting it into the
                // type and value (as passed in by Javascript)
                String valStr = token.substring(colonpos + 1).trim();
                String[] splitIv = ConvertUtil.splitInbound(valStr);
                String splitIvValue = splitIv[ConvertUtil.INBOUND_INDEX_VALUE];
                String splitIvType = splitIv[ConvertUtil.INBOUND_INDEX_TYPE];
                //InboundVariable valIv = incx.
                //InboundVariable valIv = new InboundVariable(incx, null, splitIvType, splitIvValue);
                InboundVariable valIv = incx.createInboundVariable(callNum, key, type, splitIvValue);
                valIv.dereference();
                Object val = config.convertInbound(valType, valIv, valProp);

                // Keys (unlike values) do not have type info passed with them
                // Could we have recurrsive key? - I don't think so because keys
                // must be strings in Javascript
                String keyStr = token.substring(0, colonpos).trim();
                //String[] keySplit = LocalUtil.splitInbound(keyStr);
                //InboundVariable keyIv = new InboundVariable(incx, splitIv[LocalUtil.INBOUND_INDEX_TYPE], splitIv[LocalUtil.INBOUND_INDEX_VALUE]);
                InboundVariable keyIv = new InboundVariable(incx, null, ProtocolConstants.TYPE_STRING, keyStr);
                keyIv.dereference();
               
                Object key = this.config.convertInbound(keyType, keyIv, keyProp);

                map.put(key, val);
            }

            return map;
        }
        catch (ConversionException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new ConversionException(paramType, ex);
        }
    }


    /* (non-Javadoc)
     * @see org.directwebremoting.Converter#convertOutbound(java.lang.Object, org.directwebremoting.OutboundContext)
     */
    @Override
    public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException
    {
        // First we just collect our converted children
        Map ovs = (Map) LocalUtil.classNewInstance("OrderedConvertOutbound", "java.util.LinkedHashMap", Map.class);
        if (ovs == null)
        {
            ovs = new HashMap();
        }

        ObjectOutboundVariable ov = new ObjectOutboundVariable(outctx);
        outctx.put(data, ov);

        // Loop through the map outputting any init code and collecting
        // converted outbound variables into the ovs map
        Map map = (Map) data;
        for (Iterator it = map.entrySet().iterator(); it.hasNext();)
        {
            Map.Entry entry = (Map.Entry) it.next();
            Object key = entry.getKey();
            Object value = entry.getValue();

            // It would be nice to check for Enums here
            if (!(key instanceof String) && !sentNonStringWarning)
            {
                log.warn("--Javascript does not support non string keys. Converting '" + key.getClass().getName() + "' using toString()");
                sentNonStringWarning = true;
            }

            String outkey = JavascriptUtil.escapeJavaScript(key.toString());

            // OutboundVariable ovkey = config.convertOutbound(key, outctx);
            // buffer.append(ovkey.getInitCode());
            // outkey = ovkey.getAssignCode();

            OutboundVariable nested = config.convertOutbound(value, outctx);

            ovs.put(outkey, nested);
        }

        ov.setChildren(ovs);
       

        return ov;
    }

    /**
     * We don't want to give the non-string warning too many times.
     */
    private static boolean sentNonStringWarning = false;

    /**
     * To forward marshalling requests
     */
    private ConverterManager config = null;

    /**
     * The log stream
     */
    private static final Logger log = Logger.getLogger(WebFormConverter.class);


}

Thanks again,

Ramzi


-----Original Message-----
From: Mike Wilson [mailto:[hidden email]]
Sent: Monday, April 06, 2015 9:40 AM
To: [hidden email]
Subject: [dwr-users] Re: DWR3- RC2. Method not found. See logs for details.

DWR3 enhances varargs support and therefore some changes have been made to argument handling. There were some bugfixes made in this algorithm in 3.0
RC3 so please re-test with this latest version and report back.

If you still experience problems with 3.0 RC3 let us know what arguments you are passing from the client-side for the failing call.

Best regards
Mike Wilson

r.abbyad wrote:

> Hello,
>
> I am upgrading from dwr2 to dwr3 rc2.  I am receiving the following
> error message: "No methods called x in y are applicable for the passed
> parameters."  And then an IllegalArgumentException("method not found.
> See logs for details")
>
>
> In particular, the dwr code fails at line 186, in the Call.java class.
> When it does the following check  
>
> if (inputArgCount <= i && methodParamType.isPrimitive())
> {
>    it.remove();
>    continue allMethodsLoop;
> }
>
>
> The method signature of the function being called in java which is
> being remoted is as follows:
>
> public IGrid orderSummarySearch(HttpSession session, WebForm
> searchParams, int start, int count) throws Exception { ...
>
> }
>
> The problem is that the inputArgCount  = 3
>
> whereas i ranges from 0 to 3 (over the 4 parameters in the java method
> signature).  When "i" has the value 3, inputArgCount <= i, and since
> the 4th parameter is an int, it satisfies
> methodParamType.isPrimitive()
> as well.  
>
>
> If inputArgCount were equal to 4, there would be no problem and the
> method would work fine.  But since it doesn't count the HttpSesssion
> variable, it sets inputArgCount = 3.  Any ideas on what I might be
> doing wrong here?
>
> Thanks,
>
> Ramzi

Reply | Threaded
Open this post in threaded view
|

Re: DWR3- RC2. Method not found. See logs for details.

ramzi.abbyad
I think that if inputArgCount is updated to include any HttpServlet context variable which is automagically being passed in, then the code should work fine.  Then again, I'm not entirely sure what this block of code is meant to  do:

 if (inputArgCount <= i && methodParamType.isPrimitive())
                {
                    it.remove();
                    continue allMethodsLoop;
                }

-----Original Message-----
From: Ramzi Abbyad [mailto:[hidden email]]
Sent: Monday, April 06, 2015 10:13 AM
To: [hidden email]
Subject: [dwr-users] Re: DWR3- RC2. Method not found. See logs for details.

My mistake, I meant to say RC3.  We are currently using rc3.  The call from the client side is:

var webForm = {
            orderDateFrom:[today],
            orderDateTo:[today],
            version: [0],
            instanceId: [0],
            marketType: ["B"]
        };

OrderBlotterDA.orderSummarySearch(webForm, 0, 1, {
    callback: this.__reloadStore.createDelegate(this),
    errorHandler: function(errorString, exception){
    Ext.Msg.show({
    title:      'Order Summary Error',
    msg:        errorString,
    buttons:    Ext.Msg.OK,
    icon:       Ext.MessageBox.ERROR
    });
       }
    })
Again the signature for the function on the client side contains an HttpServlet context veriable.  It is

public IGrid orderSummarySearch(HttpSession session, WebForm  searchParams, int start, int count) throws Exception


Note, the method works fine if I change the function signature to public IGrid orderSummarySearch(WebForm  searchParams, int start, int count, HttpSession session)

(I put the HttpSession variable at the end of the list).  This is, again, due to the lines of code in the Call.java class that I posted in my previous email.

This leads me to believe that there may be a bug in your code.  If, for some reason the error is in our converter for the WebForm, I include the WebFormConverter code below:

package com.muni.web2.dwr;

import java.lang.reflect.Modifier;

public class WebFormConverter implements Converter {
    /* (non-Javadoc)
     * @see org.directwebremoting.Converter#setConverterManager(org.directwebremoting.ConverterManager)
     */
    public void setConverterManager(ConverterManager newConfig)
    {
        this.config = newConfig;
    }

    /* (non-Javadoc)
     * @see org.directwebremoting.Converter#convertInbound(java.lang.Class, org.directwebremoting.InboundVariable, org.directwebremoting.InboundContext)
     */
   
    @edu.umd.cs.findbugs.annotations.SuppressWarnings(value={"UCPM_USE_CHARACTER_PARAMETERIZED_METHOD","CLI_CONSTANT_LIST_INDEX"})
    public Object convertInbound(Class<?> paramType, InboundVariable iv) throws ConversionException
    {
   
        String value = iv.getValue();

        // If the text is null then the whole bean is null
        if (value.trim().equals(ProtocolConstants.INBOUND_NULL))
        {
            return null;
        }

        if (!value.startsWith(ProtocolConstants.INBOUND_MAP_START))
        {
            throw new IllegalArgumentException("Messages.getString(\"MapConverter.FormatError\", ProtocolConstants.INBOUND_MAP_START)");
        }

        if (!value.endsWith(ProtocolConstants.INBOUND_MAP_END))
        {
            throw new IllegalArgumentException("Messages.getString(\"MapConverter.FormatError\", ProtocolConstants.INBOUND_MAP_END)");
        }

        value = value.substring(1, value.length() - 1);

        try
        {
            // Maybe we ought to check that the paramType isn't expecting a more
            // distinct type of Map and attempt to create that?
            Map map;

            // If paramType is concrete then just use whatever we've got.
            if (!paramType.isInterface() && !Modifier.isAbstract(paramType.getModifiers()))
            {
                // If there is a problem creating the type then we have no way
                // of completing this - they asked for a specific type and we
                // can't create that type. I don't know of a way of finding
                // subclasses that might be instaniable so we accept failure.
                map = (Map) paramType.newInstance();
            }
            else
            {
                map = new HashMap();
            }
           
            Property parent = iv.getContext().getCurrentProperty();
           
            Property keyProp = parent.createChild(0);
            keyProp = this.config.checkOverride(keyProp);
            Class<?> keyType = keyProp.getPropertyType();
           
            Property valProp = parent.createChild(1);
            Class<?> valType = String[].class;
            valProp = this.config.checkOverride(valProp);
             
            iv.getContext().addConverted(iv, paramType, map);
            InboundContext incx = iv.getContext();
            // Get the extra type info


            // Loop through the property declarations
            StringTokenizer st = new StringTokenizer(value, ",");
            int size = st.countTokens();
            for (int i = 0; i < size; i++)
            {
                String token = st.nextToken();
                if (token.trim().length() == 0)
                {
                    continue;
                }

                int colonpos = token.indexOf(ProtocolConstants.INBOUND_MAP_ENTRY);
                if (colonpos == -1)
                {
                    throw new MarshallException(paramType, "Missing : in object description: {1}" + token);
                }

                // Convert the value part of the token by splitting it into the
                // type and value (as passed in by Javascript)
                String valStr = token.substring(colonpos + 1).trim();
                String[] splitIv = ConvertUtil.splitInbound(valStr);
                String splitIvValue = splitIv[ConvertUtil.INBOUND_INDEX_VALUE];
                String splitIvType = splitIv[ConvertUtil.INBOUND_INDEX_TYPE];
                //InboundVariable valIv = incx.
                //InboundVariable valIv = new InboundVariable(incx, null, splitIvType, splitIvValue);
                InboundVariable valIv = incx.createInboundVariable(callNum, key, type, splitIvValue);
                valIv.dereference();
                Object val = config.convertInbound(valType, valIv, valProp);

                // Keys (unlike values) do not have type info passed with them
                // Could we have recurrsive key? - I don't think so because keys
                // must be strings in Javascript
                String keyStr = token.substring(0, colonpos).trim();
                //String[] keySplit = LocalUtil.splitInbound(keyStr);
                //InboundVariable keyIv = new InboundVariable(incx, splitIv[LocalUtil.INBOUND_INDEX_TYPE], splitIv[LocalUtil.INBOUND_INDEX_VALUE]);
                InboundVariable keyIv = new InboundVariable(incx, null, ProtocolConstants.TYPE_STRING, keyStr);
                keyIv.dereference();
               
                Object key = this.config.convertInbound(keyType, keyIv, keyProp);

                map.put(key, val);
            }

            return map;
        }
        catch (ConversionException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new ConversionException(paramType, ex);
        }
    }


    /* (non-Javadoc)
     * @see org.directwebremoting.Converter#convertOutbound(java.lang.Object, org.directwebremoting.OutboundContext)
     */
    @Override
    public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException
    {
        // First we just collect our converted children
        Map ovs = (Map) LocalUtil.classNewInstance("OrderedConvertOutbound", "java.util.LinkedHashMap", Map.class);
        if (ovs == null)
        {
            ovs = new HashMap();
        }

        ObjectOutboundVariable ov = new ObjectOutboundVariable(outctx);
        outctx.put(data, ov);

        // Loop through the map outputting any init code and collecting
        // converted outbound variables into the ovs map
        Map map = (Map) data;
        for (Iterator it = map.entrySet().iterator(); it.hasNext();)
        {
            Map.Entry entry = (Map.Entry) it.next();
            Object key = entry.getKey();
            Object value = entry.getValue();

            // It would be nice to check for Enums here
            if (!(key instanceof String) && !sentNonStringWarning)
            {
                log.warn("--Javascript does not support non string keys. Converting '" + key.getClass().getName() + "' using toString()");
                sentNonStringWarning = true;
            }

            String outkey = JavascriptUtil.escapeJavaScript(key.toString());

            // OutboundVariable ovkey = config.convertOutbound(key, outctx);
            // buffer.append(ovkey.getInitCode());
            // outkey = ovkey.getAssignCode();

            OutboundVariable nested = config.convertOutbound(value, outctx);

            ovs.put(outkey, nested);
        }

        ov.setChildren(ovs);
       

        return ov;
    }

    /**
     * We don't want to give the non-string warning too many times.
     */
    private static boolean sentNonStringWarning = false;

    /**
     * To forward marshalling requests
     */
    private ConverterManager config = null;

    /**
     * The log stream
     */
    private static final Logger log = Logger.getLogger(WebFormConverter.class);


}

Thanks again,

Ramzi


-----Original Message-----
From: Mike Wilson [mailto:[hidden email]]
Sent: Monday, April 06, 2015 9:40 AM
To: [hidden email]
Subject: [dwr-users] Re: DWR3- RC2. Method not found. See logs for details.

DWR3 enhances varargs support and therefore some changes have been made to argument handling. There were some bugfixes made in this algorithm in 3.0
RC3 so please re-test with this latest version and report back.

If you still experience problems with 3.0 RC3 let us know what arguments you are passing from the client-side for the failing call.

Best regards
Mike Wilson

r.abbyad wrote:

> Hello,
>
> I am upgrading from dwr2 to dwr3 rc2.  I am receiving the following
> error message: "No methods called x in y are applicable for the passed
> parameters."  And then an IllegalArgumentException("method not found.
> See logs for details")
>
>
> In particular, the dwr code fails at line 186, in the Call.java class.
> When it does the following check  
>
> if (inputArgCount <= i && methodParamType.isPrimitive())
> {
>    it.remove();
>    continue allMethodsLoop;
> }
>
>
> The method signature of the function being called in java which is
> being remoted is as follows:
>
> public IGrid orderSummarySearch(HttpSession session, WebForm
> searchParams, int start, int count) throws Exception { ...
>
> }
>
> The problem is that the inputArgCount  = 3
>
> whereas i ranges from 0 to 3 (over the 4 parameters in the java method
> signature).  When "i" has the value 3, inputArgCount <= i, and since
> the 4th parameter is an int, it satisfies
> methodParamType.isPrimitive()
> as well.  
>
>
> If inputArgCount were equal to 4, there would be no problem and the
> method would work fine.  But since it doesn't count the HttpSesssion
> variable, it sets inputArgCount = 3.  Any ideas on what I might be
> doing wrong here?
>
> Thanks,
>
> Ramzi

Reply | Threaded
Open this post in threaded view
|

Re: DWR3- RC2. Method not found. See logs for details.

Mike Wilson
Administrator
I've looked into your scenario and found a bug where auto-filled parameters
were not being accounted for. I've created this bug ticket:
https://directwebremoting.atlassian.net/browse/DWR-634
and checked in a fix.

Please try out this development build to see if it solves your problem:
http://ci.directwebremoting.org/bamboo/browse/DWRTRUNK-ALL-582/artifact/JOB1
/dwr.jar/dwr.jar

Best regards
Mike

Ramzi Abbyad wrote:

> I think that if inputArgCount is updated to include any
> HttpServlet context variable which is automagically being
> passed in, then the code should work fine.  Then again, I'm
> not entirely sure what this block of code is meant to  do:
>
>  if (inputArgCount <= i && methodParamType.isPrimitive())
> {
>    it.remove();
>    continue allMethodsLoop;
> }
>
> -----Original Message-----
> From: Ramzi Abbyad [mailto:[hidden email]]
> Sent: Monday, April 06, 2015 10:13 AM
> To: [hidden email]
> Subject: [dwr-users] Re: DWR3- RC2. Method not found. See
> logs for details.
>
> My mistake, I meant to say RC3.  We are currently using rc3.  
> The call from the client side is:
>
> var webForm = {
>             orderDateFrom:[today],
>             orderDateTo:[today],
>             version: [0],
>             instanceId: [0],
>             marketType: ["B"]
>         };
>
> OrderBlotterDA.orderSummarySearch(webForm, 0, 1, {
>     callback: this.__reloadStore.createDelegate(this),
>     errorHandler: function(errorString, exception){
>     Ext.Msg.show({
>     title:      'Order Summary Error',
>     msg:        errorString,
>     buttons:    Ext.Msg.OK,
>     icon:       Ext.MessageBox.ERROR
>     });
>        }
>     })
> Again the signature for the function on the client side
> contains an HttpServlet context veriable.  It is
>
> public IGrid orderSummarySearch(HttpSession session, WebForm  
> searchParams, int start, int count) throws Exception
>
>
> Note, the method works fine if I change the function
> signature to public IGrid orderSummarySearch(WebForm  
> searchParams, int start, int count, HttpSession session)
>
> (I put the HttpSession variable at the end of the list).  
> This is, again, due to the lines of code in the Call.java
> class that I posted in my previous email.
>
> This leads me to believe that there may be a bug in your
> code.  If, for some reason the error is in our converter for
> the WebForm, I include the WebFormConverter code below:
>
> package com.muni.web2.dwr;
>
> import java.lang.reflect.Modifier;
>
> public class WebFormConverter implements Converter {
>     /* (non-Javadoc)
>      * @see
> org.directwebremoting.Converter#setConverterManager(org.direct
> webremoting.ConverterManager)
>      */
>     public void setConverterManager(ConverterManager newConfig)
>     {
>         this.config = newConfig;
>     }
>
>     /* (non-Javadoc)
>      * @see
> org.directwebremoting.Converter#convertInbound(java.lang.Class
> , org.directwebremoting.InboundVariable,
> org.directwebremoting.InboundContext)
>      */
>    
>    
> @edu.umd.cs.findbugs.annotations.SuppressWarnings(value={"UCPM
> _USE_CHARACTER_PARAMETERIZED_METHOD","CLI_CONSTANT_LIST_INDEX"})
>     public Object convertInbound(Class<?> paramType,
> InboundVariable iv) throws ConversionException
>     {
>    
>         String value = iv.getValue();
>
>         // If the text is null then the whole bean is null
>         if (value.trim().equals(ProtocolConstants.INBOUND_NULL))
>         {
>             return null;
>         }
>
>         if (!value.startsWith(ProtocolConstants.INBOUND_MAP_START))
>         {
>             throw new
> IllegalArgumentException("Messages.getString(\"MapConverter.Fo
> rmatError\", ProtocolConstants.INBOUND_MAP_START)");
>         }
>
>         if (!value.endsWith(ProtocolConstants.INBOUND_MAP_END))
>         {
>             throw new
> IllegalArgumentException("Messages.getString(\"MapConverter.Fo
> rmatError\", ProtocolConstants.INBOUND_MAP_END)");
>         }
>
>         value = value.substring(1, value.length() - 1);
>
>         try
>         {
>             // Maybe we ought to check that the paramType
> isn't expecting a more
>             // distinct type of Map and attempt to create that?
>             Map map;
>
>             // If paramType is concrete then just use
> whatever we've got.
>             if (!paramType.isInterface() &&
> !Modifier.isAbstract(paramType.getModifiers()))
>             {
>                 // If there is a problem creating the type
> then we have no way
>                 // of completing this - they asked for a
> specific type and we
>                 // can't create that type. I don't know of a
> way of finding
>                 // subclasses that might be instaniable so we
> accept failure.
>                 map = (Map) paramType.newInstance();
>             }
>             else
>             {
>                 map = new HashMap();
>             }
>            
>             Property parent = iv.getContext().getCurrentProperty();
>            
>             Property keyProp = parent.createChild(0);
>             keyProp = this.config.checkOverride(keyProp);
>             Class<?> keyType = keyProp.getPropertyType();
>            
>             Property valProp = parent.createChild(1);
>             Class<?> valType = String[].class;
>             valProp = this.config.checkOverride(valProp);
>              
>             iv.getContext().addConverted(iv, paramType, map);
>             InboundContext incx = iv.getContext();
>             // Get the extra type info
>
>
>             // Loop through the property declarations
>             StringTokenizer st = new StringTokenizer(value, ",");
>             int size = st.countTokens();
>             for (int i = 0; i < size; i++)
>             {
>                 String token = st.nextToken();
>                 if (token.trim().length() == 0)
>                 {
>                     continue;
>                 }
>
>                 int colonpos =
> token.indexOf(ProtocolConstants.INBOUND_MAP_ENTRY);
>                 if (colonpos == -1)
>                 {
>                     throw new MarshallException(paramType,
> "Missing : in object description: {1}" + token);
>                 }
>
>                 // Convert the value part of the token by
> splitting it into the
>                 // type and value (as passed in by Javascript)
>                 String valStr = token.substring(colonpos + 1).trim();
>                 String[] splitIv = ConvertUtil.splitInbound(valStr);
>                 String splitIvValue =
> splitIv[ConvertUtil.INBOUND_INDEX_VALUE];
>                 String splitIvType =
> splitIv[ConvertUtil.INBOUND_INDEX_TYPE];
>                 //InboundVariable valIv = incx.
>                 //InboundVariable valIv = new
> InboundVariable(incx, null, splitIvType, splitIvValue);
>                 InboundVariable valIv =
> incx.createInboundVariable(callNum, key, type, splitIvValue);
>                 valIv.dereference();
>                 Object val = config.convertInbound(valType,
> valIv, valProp);
>
>                 // Keys (unlike values) do not have type info
> passed with them
>                 // Could we have recurrsive key? - I don't
> think so because keys
>                 // must be strings in Javascript
>                 String keyStr = token.substring(0, colonpos).trim();
>                 //String[] keySplit = LocalUtil.splitInbound(keyStr);
>                 //InboundVariable keyIv = new
> InboundVariable(incx, splitIv[LocalUtil.INBOUND_INDEX_TYPE],
> splitIv[LocalUtil.INBOUND_INDEX_VALUE]);
>                 InboundVariable keyIv = new
> InboundVariable(incx, null, ProtocolConstants.TYPE_STRING, keyStr);
>                 keyIv.dereference();
>                
>                 Object key =
> this.config.convertInbound(keyType, keyIv, keyProp);
>
>                 map.put(key, val);
>             }
>
>             return map;
>         }
>         catch (ConversionException ex)
>         {
>             throw ex;
>         }
>         catch (Exception ex)
>         {
>             throw new ConversionException(paramType, ex);
>         }
>     }
>
>
>     /* (non-Javadoc)
>      * @see
> org.directwebremoting.Converter#convertOutbound(java.lang.Obje
> ct, org.directwebremoting.OutboundContext)
>      */
>     @Override
>     public OutboundVariable convertOutbound(Object data,
> OutboundContext outctx) throws ConversionException
>     {
>         // First we just collect our converted children
>         Map ovs = (Map)
> LocalUtil.classNewInstance("OrderedConvertOutbound",
> "java.util.LinkedHashMap", Map.class);
>         if (ovs == null)
>         {
>             ovs = new HashMap();
>         }
>
>         ObjectOutboundVariable ov = new
> ObjectOutboundVariable(outctx);
>         outctx.put(data, ov);
>
>         // Loop through the map outputting any init code and
> collecting
>         // converted outbound variables into the ovs map
>         Map map = (Map) data;
>         for (Iterator it = map.entrySet().iterator(); it.hasNext();)
>         {
>             Map.Entry entry = (Map.Entry) it.next();
>             Object key = entry.getKey();
>             Object value = entry.getValue();
>
>             // It would be nice to check for Enums here
>             if (!(key instanceof String) && !sentNonStringWarning)
>             {
>                 log.warn("--Javascript does not support non
> string keys. Converting '" + key.getClass().getName() + "'
> using toString()");
>                 sentNonStringWarning = true;
>             }
>
>             String outkey =
> JavascriptUtil.escapeJavaScript(key.toString());
>
>             // OutboundVariable ovkey =
> config.convertOutbound(key, outctx);
>             // buffer.append(ovkey.getInitCode());
>             // outkey = ovkey.getAssignCode();
>
>             OutboundVariable nested =
> config.convertOutbound(value, outctx);
>
>             ovs.put(outkey, nested);
>         }
>
>         ov.setChildren(ovs);
>        
>
>         return ov;
>     }
>
>     /**
>      * We don't want to give the non-string warning too many times.
>      */
>     private static boolean sentNonStringWarning = false;
>
>     /**
>      * To forward marshalling requests
>      */
>     private ConverterManager config = null;
>
>     /**
>      * The log stream
>      */
>     private static final Logger log =
> Logger.getLogger(WebFormConverter.class);
>
>
> }
>
> Thanks again,
>
> Ramzi
>
>
> -----Original Message-----
> From: Mike Wilson [mailto:[hidden email]]
> Sent: Monday, April 06, 2015 9:40 AM
> To: [hidden email]
> Subject: [dwr-users] Re: DWR3- RC2. Method not found. See
> logs for details.
>
> DWR3 enhances varargs support and therefore some changes have
> been made to argument handling. There were some bugfixes made
> in this algorithm in 3.0
> RC3 so please re-test with this latest version and report back.
>
> If you still experience problems with 3.0 RC3 let us know
> what arguments you are passing from the client-side for the
> failing call.
>
> Best regards
> Mike Wilson
>
> r.abbyad wrote:
> > Hello,
> >
> > I am upgrading from dwr2 to dwr3 rc2.  I am receiving the following
> > error message: "No methods called x in y are applicable for
> the passed
> > parameters."  And then an IllegalArgumentException("method
> not found.
> > See logs for details")
> >
> >
> > In particular, the dwr code fails at line 186, in the
> Call.java class.
> > When it does the following check  
> >
> > if (inputArgCount <= i && methodParamType.isPrimitive())
> > {
> >    it.remove();
> >    continue allMethodsLoop;
> > }
> >
> >
> > The method signature of the function being called in java which is
> > being remoted is as follows:
> >
> > public IGrid orderSummarySearch(HttpSession session, WebForm
> > searchParams, int start, int count) throws Exception { ...
> >
> > }
> >
> > The problem is that the inputArgCount  = 3
> >
> > whereas i ranges from 0 to 3 (over the 4 parameters in the
> java method
> > signature).  When "i" has the value 3, inputArgCount <= i,
> and since
> > the 4th parameter is an int, it satisfies
> > methodParamType.isPrimitive()
> > as well.  
> >
> >
> > If inputArgCount were equal to 4, there would be no problem and the
> > method would work fine.  But since it doesn't count the
> HttpSesssion
> > variable, it sets inputArgCount = 3.  Any ideas on what I might be
> > doing wrong here?
> >
> > Thanks,
> >
> > Ramzi

Reply | Threaded
Open this post in threaded view
|

Re: DWR3- RC2. Method not found. See logs for details.

david@butterdev.com
Thanks Mike!

On 04/07/2015 05:31 PM, Mike Wilson wrote:

> I've looked into your scenario and found a bug where auto-filled parameters
> were not being accounted for. I've created this bug ticket:
> https://directwebremoting.atlassian.net/browse/DWR-634
> and checked in a fix.
>
> Please try out this development build to see if it solves your problem:
> http://ci.directwebremoting.org/bamboo/browse/DWRTRUNK-ALL-582/artifact/JOB1
> /dwr.jar/dwr.jar
>
> Best regards
> Mike
>
> Ramzi Abbyad wrote:
>> I think that if inputArgCount is updated to include any
>> HttpServlet context variable which is automagically being
>> passed in, then the code should work fine.  Then again, I'm
>> not entirely sure what this block of code is meant to  do:
>>
>>   if (inputArgCount <= i && methodParamType.isPrimitive())
>> {
>>    it.remove();
>>    continue allMethodsLoop;
>> }
>>
>> -----Original Message-----
>> From: Ramzi Abbyad [mailto:[hidden email]]
>> Sent: Monday, April 06, 2015 10:13 AM
>> To: [hidden email]
>> Subject: [dwr-users] Re: DWR3- RC2. Method not found. See
>> logs for details.
>>
>> My mistake, I meant to say RC3.  We are currently using rc3.
>> The call from the client side is:
>>
>> var webForm = {
>>              orderDateFrom:[today],
>>              orderDateTo:[today],
>>              version: [0],
>>              instanceId: [0],
>>              marketType: ["B"]
>>          };
>>
>> OrderBlotterDA.orderSummarySearch(webForm, 0, 1, {
>>       callback: this.__reloadStore.createDelegate(this),
>>       errorHandler: function(errorString, exception){
>>       Ext.Msg.show({
>>       title:      'Order Summary Error',
>>       msg:        errorString,
>>       buttons:    Ext.Msg.OK,
>>       icon:       Ext.MessageBox.ERROR
>>       });
>>          }
>>       })
>> Again the signature for the function on the client side
>> contains an HttpServlet context veriable.  It is
>>
>> public IGrid orderSummarySearch(HttpSession session, WebForm
>> searchParams, int start, int count) throws Exception
>>
>>
>> Note, the method works fine if I change the function
>> signature to public IGrid orderSummarySearch(WebForm
>> searchParams, int start, int count, HttpSession session)
>>
>> (I put the HttpSession variable at the end of the list).
>> This is, again, due to the lines of code in the Call.java
>> class that I posted in my previous email.
>>
>> This leads me to believe that there may be a bug in your
>> code.  If, for some reason the error is in our converter for
>> the WebForm, I include the WebFormConverter code below:
>>
>> package com.muni.web2.dwr;
>>
>> import java.lang.reflect.Modifier;
>>
>> public class WebFormConverter implements Converter {
>>      /* (non-Javadoc)
>>       * @see
>> org.directwebremoting.Converter#setConverterManager(org.direct
>> webremoting.ConverterManager)
>>       */
>>      public void setConverterManager(ConverterManager newConfig)
>>      {
>>          this.config = newConfig;
>>      }
>>
>>      /* (non-Javadoc)
>>       * @see
>> org.directwebremoting.Converter#convertInbound(java.lang.Class
>> , org.directwebremoting.InboundVariable,
>> org.directwebremoting.InboundContext)
>>       */
>>      
>>      
>> @edu.umd.cs.findbugs.annotations.SuppressWarnings(value={"UCPM
>> _USE_CHARACTER_PARAMETERIZED_METHOD","CLI_CONSTANT_LIST_INDEX"})
>>      public Object convertInbound(Class<?> paramType,
>> InboundVariable iv) throws ConversionException
>>      {
>>      
>>          String value = iv.getValue();
>>
>>          // If the text is null then the whole bean is null
>>          if (value.trim().equals(ProtocolConstants.INBOUND_NULL))
>>          {
>>              return null;
>>          }
>>
>>          if (!value.startsWith(ProtocolConstants.INBOUND_MAP_START))
>>          {
>>              throw new
>> IllegalArgumentException("Messages.getString(\"MapConverter.Fo
>> rmatError\", ProtocolConstants.INBOUND_MAP_START)");
>>          }
>>
>>          if (!value.endsWith(ProtocolConstants.INBOUND_MAP_END))
>>          {
>>              throw new
>> IllegalArgumentException("Messages.getString(\"MapConverter.Fo
>> rmatError\", ProtocolConstants.INBOUND_MAP_END)");
>>          }
>>
>>          value = value.substring(1, value.length() - 1);
>>
>>          try
>>          {
>>              // Maybe we ought to check that the paramType
>> isn't expecting a more
>>              // distinct type of Map and attempt to create that?
>>              Map map;
>>
>>              // If paramType is concrete then just use
>> whatever we've got.
>>              if (!paramType.isInterface() &&
>> !Modifier.isAbstract(paramType.getModifiers()))
>>              {
>>                  // If there is a problem creating the type
>> then we have no way
>>                  // of completing this - they asked for a
>> specific type and we
>>                  // can't create that type. I don't know of a
>> way of finding
>>                  // subclasses that might be instaniable so we
>> accept failure.
>>                  map = (Map) paramType.newInstance();
>>              }
>>              else
>>              {
>>                  map = new HashMap();
>>              }
>>              
>>              Property parent = iv.getContext().getCurrentProperty();
>>              
>>              Property keyProp = parent.createChild(0);
>>              keyProp = this.config.checkOverride(keyProp);
>>              Class<?> keyType = keyProp.getPropertyType();
>>              
>>              Property valProp = parent.createChild(1);
>>              Class<?> valType = String[].class;
>>              valProp = this.config.checkOverride(valProp);
>>              
>>              iv.getContext().addConverted(iv, paramType, map);
>>              InboundContext incx = iv.getContext();
>>              // Get the extra type info
>>
>>
>>              // Loop through the property declarations
>>              StringTokenizer st = new StringTokenizer(value, ",");
>>              int size = st.countTokens();
>>              for (int i = 0; i < size; i++)
>>              {
>>                  String token = st.nextToken();
>>                  if (token.trim().length() == 0)
>>                  {
>>                      continue;
>>                  }
>>
>>                  int colonpos =
>> token.indexOf(ProtocolConstants.INBOUND_MAP_ENTRY);
>>                  if (colonpos == -1)
>>                  {
>>                      throw new MarshallException(paramType,
>> "Missing : in object description: {1}" + token);
>>                  }
>>
>>                  // Convert the value part of the token by
>> splitting it into the
>>                  // type and value (as passed in by Javascript)
>>                  String valStr = token.substring(colonpos + 1).trim();
>>                  String[] splitIv = ConvertUtil.splitInbound(valStr);
>>                  String splitIvValue =
>> splitIv[ConvertUtil.INBOUND_INDEX_VALUE];
>>                  String splitIvType =
>> splitIv[ConvertUtil.INBOUND_INDEX_TYPE];
>>                  //InboundVariable valIv = incx.
>>                  //InboundVariable valIv = new
>> InboundVariable(incx, null, splitIvType, splitIvValue);
>>                  InboundVariable valIv =
>> incx.createInboundVariable(callNum, key, type, splitIvValue);
>>                  valIv.dereference();
>>                  Object val = config.convertInbound(valType,
>> valIv, valProp);
>>
>>                  // Keys (unlike values) do not have type info
>> passed with them
>>                  // Could we have recurrsive key? - I don't
>> think so because keys
>>                  // must be strings in Javascript
>>                  String keyStr = token.substring(0, colonpos).trim();
>>                  //String[] keySplit = LocalUtil.splitInbound(keyStr);
>>                  //InboundVariable keyIv = new
>> InboundVariable(incx, splitIv[LocalUtil.INBOUND_INDEX_TYPE],
>> splitIv[LocalUtil.INBOUND_INDEX_VALUE]);
>>                  InboundVariable keyIv = new
>> InboundVariable(incx, null, ProtocolConstants.TYPE_STRING, keyStr);
>>                  keyIv.dereference();
>>                  
>>                  Object key =
>> this.config.convertInbound(keyType, keyIv, keyProp);
>>
>>                  map.put(key, val);
>>              }
>>
>>              return map;
>>          }
>>          catch (ConversionException ex)
>>          {
>>              throw ex;
>>          }
>>          catch (Exception ex)
>>          {
>>              throw new ConversionException(paramType, ex);
>>          }
>>      }
>>
>>
>>      /* (non-Javadoc)
>>       * @see
>> org.directwebremoting.Converter#convertOutbound(java.lang.Obje
>> ct, org.directwebremoting.OutboundContext)
>>       */
>>      @Override
>>      public OutboundVariable convertOutbound(Object data,
>> OutboundContext outctx) throws ConversionException
>>      {
>>          // First we just collect our converted children
>>          Map ovs = (Map)
>> LocalUtil.classNewInstance("OrderedConvertOutbound",
>> "java.util.LinkedHashMap", Map.class);
>>          if (ovs == null)
>>          {
>>              ovs = new HashMap();
>>          }
>>
>>          ObjectOutboundVariable ov = new
>> ObjectOutboundVariable(outctx);
>>          outctx.put(data, ov);
>>
>>          // Loop through the map outputting any init code and
>> collecting
>>          // converted outbound variables into the ovs map
>>          Map map = (Map) data;
>>          for (Iterator it = map.entrySet().iterator(); it.hasNext();)
>>          {
>>              Map.Entry entry = (Map.Entry) it.next();
>>              Object key = entry.getKey();
>>              Object value = entry.getValue();
>>
>>              // It would be nice to check for Enums here
>>              if (!(key instanceof String) && !sentNonStringWarning)
>>              {
>>                  log.warn("--Javascript does not support non
>> string keys. Converting '" + key.getClass().getName() + "'
>> using toString()");
>>                  sentNonStringWarning = true;
>>              }
>>
>>              String outkey =
>> JavascriptUtil.escapeJavaScript(key.toString());
>>
>>              // OutboundVariable ovkey =
>> config.convertOutbound(key, outctx);
>>              // buffer.append(ovkey.getInitCode());
>>              // outkey = ovkey.getAssignCode();
>>
>>              OutboundVariable nested =
>> config.convertOutbound(value, outctx);
>>
>>              ovs.put(outkey, nested);
>>          }
>>
>>          ov.setChildren(ovs);
>>          
>>
>>          return ov;
>>      }
>>
>>      /**
>>       * We don't want to give the non-string warning too many times.
>>       */
>>      private static boolean sentNonStringWarning = false;
>>
>>      /**
>>       * To forward marshalling requests
>>       */
>>      private ConverterManager config = null;
>>
>>      /**
>>       * The log stream
>>       */
>>      private static final Logger log =
>> Logger.getLogger(WebFormConverter.class);
>>
>>
>> }
>>
>> Thanks again,
>>
>> Ramzi
>>
>>
>> -----Original Message-----
>> From: Mike Wilson [mailto:[hidden email]]
>> Sent: Monday, April 06, 2015 9:40 AM
>> To: [hidden email]
>> Subject: [dwr-users] Re: DWR3- RC2. Method not found. See
>> logs for details.
>>
>> DWR3 enhances varargs support and therefore some changes have
>> been made to argument handling. There were some bugfixes made
>> in this algorithm in 3.0
>> RC3 so please re-test with this latest version and report back.
>>
>> If you still experience problems with 3.0 RC3 let us know
>> what arguments you are passing from the client-side for the
>> failing call.
>>
>> Best regards
>> Mike Wilson
>>
>> r.abbyad wrote:
>>> Hello,
>>>
>>> I am upgrading from dwr2 to dwr3 rc2.  I am receiving the following
>>> error message: "No methods called x in y are applicable for
>> the passed
>>> parameters."  And then an IllegalArgumentException("method
>> not found.
>>> See logs for details")
>>>
>>>
>>> In particular, the dwr code fails at line 186, in the
>> Call.java class.
>>> When it does the following check
>>>
>>> if (inputArgCount <= i && methodParamType.isPrimitive())
>>> {
>>>    it.remove();
>>>    continue allMethodsLoop;
>>> }
>>>
>>>
>>> The method signature of the function being called in java which is
>>> being remoted is as follows:
>>>
>>> public IGrid orderSummarySearch(HttpSession session, WebForm
>>> searchParams, int start, int count) throws Exception { ...
>>>
>>> }
>>>
>>> The problem is that the inputArgCount  = 3
>>>
>>> whereas i ranges from 0 to 3 (over the 4 parameters in the
>> java method
>>> signature).  When "i" has the value 3, inputArgCount <= i,
>> and since
>>> the 4th parameter is an int, it satisfies
>>> methodParamType.isPrimitive()
>>> as well.
>>>
>>>
>>> If inputArgCount were equal to 4, there would be no problem and the
>>> method would work fine.  But since it doesn't count the
>> HttpSesssion
>>> variable, it sets inputArgCount = 3.  Any ideas on what I might be
>>> doing wrong here?
>>>
>>> Thanks,
>>>
>>> Ramzi
>

Reply | Threaded
Open this post in threaded view
|

Re: DWR3- RC2. Method not found. See logs for details.

ramzi.abbyad
In reply to this post by Mike Wilson
Thanks for the fix!  Working great.

Regards,

Ramzi

-----Original Message-----
From: Mike Wilson [mailto:[hidden email]]
Sent: Tuesday, April 07, 2015 7:32 PM
To: [hidden email]
Subject: [dwr-users] Re: DWR3- RC2. Method not found. See logs for details.

I've looked into your scenario and found a bug where auto-filled parameters were not being accounted for. I've created this bug ticket:
https://directwebremoting.atlassian.net/browse/DWR-634
and checked in a fix.

Please try out this development build to see if it solves your problem:
http://ci.directwebremoting.org/bamboo/browse/DWRTRUNK-ALL-582/artifact/JOB1
/dwr.jar/dwr.jar

Best regards
Mike

Ramzi Abbyad wrote:

> I think that if inputArgCount is updated to include any HttpServlet
> context variable which is automagically being passed in, then the code
> should work fine.  Then again, I'm not entirely sure what this block
> of code is meant to  do:
>
>  if (inputArgCount <= i && methodParamType.isPrimitive())
> {
>    it.remove();
>    continue allMethodsLoop;
> }
>
> -----Original Message-----
> From: Ramzi Abbyad [mailto:[hidden email]]
> Sent: Monday, April 06, 2015 10:13 AM
> To: [hidden email]
> Subject: [dwr-users] Re: DWR3- RC2. Method not found. See logs for
> details.
>
> My mistake, I meant to say RC3.  We are currently using rc3.  
> The call from the client side is:
>
> var webForm = {
>             orderDateFrom:[today],
>             orderDateTo:[today],
>             version: [0],
>             instanceId: [0],
>             marketType: ["B"]
>         };
>
> OrderBlotterDA.orderSummarySearch(webForm, 0, 1, {
>     callback: this.__reloadStore.createDelegate(this),
>     errorHandler: function(errorString, exception){
>     Ext.Msg.show({
>     title:      'Order Summary Error',
>     msg:        errorString,
>     buttons:    Ext.Msg.OK,
>     icon:       Ext.MessageBox.ERROR
>     });
>        }
>     })
> Again the signature for the function on the client side contains an
> HttpServlet context veriable.  It is
>
> public IGrid orderSummarySearch(HttpSession session, WebForm
> searchParams, int start, int count) throws Exception
>
>
> Note, the method works fine if I change the function signature to
> public IGrid orderSummarySearch(WebForm searchParams, int start, int
> count, HttpSession session)
>
> (I put the HttpSession variable at the end of the list).  
> This is, again, due to the lines of code in the Call.java class that I
> posted in my previous email.
>
> This leads me to believe that there may be a bug in your code.  If,
> for some reason the error is in our converter for the WebForm, I
> include the WebFormConverter code below:
>
> package com.muni.web2.dwr;
>
> import java.lang.reflect.Modifier;
>
> public class WebFormConverter implements Converter {
>     /* (non-Javadoc)
>      * @see
> org.directwebremoting.Converter#setConverterManager(org.direct
> webremoting.ConverterManager)
>      */
>     public void setConverterManager(ConverterManager newConfig)
>     {
>         this.config = newConfig;
>     }
>
>     /* (non-Javadoc)
>      * @see
> org.directwebremoting.Converter#convertInbound(java.lang.Class
> , org.directwebremoting.InboundVariable,
> org.directwebremoting.InboundContext)
>      */
>    
>    
> @edu.umd.cs.findbugs.annotations.SuppressWarnings(value={"UCPM
> _USE_CHARACTER_PARAMETERIZED_METHOD","CLI_CONSTANT_LIST_INDEX"})
>     public Object convertInbound(Class<?> paramType, InboundVariable
> iv) throws ConversionException
>     {
>    
>         String value = iv.getValue();
>
>         // If the text is null then the whole bean is null
>         if (value.trim().equals(ProtocolConstants.INBOUND_NULL))
>         {
>             return null;
>         }
>
>         if (!value.startsWith(ProtocolConstants.INBOUND_MAP_START))
>         {
>             throw new
> IllegalArgumentException("Messages.getString(\"MapConverter.Fo
> rmatError\", ProtocolConstants.INBOUND_MAP_START)");
>         }
>
>         if (!value.endsWith(ProtocolConstants.INBOUND_MAP_END))
>         {
>             throw new
> IllegalArgumentException("Messages.getString(\"MapConverter.Fo
> rmatError\", ProtocolConstants.INBOUND_MAP_END)");
>         }
>
>         value = value.substring(1, value.length() - 1);
>
>         try
>         {
>             // Maybe we ought to check that the paramType isn't
> expecting a more
>             // distinct type of Map and attempt to create that?
>             Map map;
>
>             // If paramType is concrete then just use whatever we've
> got.
>             if (!paramType.isInterface() &&
> !Modifier.isAbstract(paramType.getModifiers()))
>             {
>                 // If there is a problem creating the type then we
> have no way
>                 // of completing this - they asked for a specific type
> and we
>                 // can't create that type. I don't know of a way of
> finding
>                 // subclasses that might be instaniable so we accept
> failure.
>                 map = (Map) paramType.newInstance();
>             }
>             else
>             {
>                 map = new HashMap();
>             }
>            
>             Property parent = iv.getContext().getCurrentProperty();
>            
>             Property keyProp = parent.createChild(0);
>             keyProp = this.config.checkOverride(keyProp);
>             Class<?> keyType = keyProp.getPropertyType();
>            
>             Property valProp = parent.createChild(1);
>             Class<?> valType = String[].class;
>             valProp = this.config.checkOverride(valProp);
>              
>             iv.getContext().addConverted(iv, paramType, map);
>             InboundContext incx = iv.getContext();
>             // Get the extra type info
>
>
>             // Loop through the property declarations
>             StringTokenizer st = new StringTokenizer(value, ",");
>             int size = st.countTokens();
>             for (int i = 0; i < size; i++)
>             {
>                 String token = st.nextToken();
>                 if (token.trim().length() == 0)
>                 {
>                     continue;
>                 }
>
>                 int colonpos =
> token.indexOf(ProtocolConstants.INBOUND_MAP_ENTRY);
>                 if (colonpos == -1)
>                 {
>                     throw new MarshallException(paramType, "Missing :
> in object description: {1}" + token);
>                 }
>
>                 // Convert the value part of the token by splitting it
> into the
>                 // type and value (as passed in by Javascript)
>                 String valStr = token.substring(colonpos + 1).trim();
>                 String[] splitIv = ConvertUtil.splitInbound(valStr);
>                 String splitIvValue =
> splitIv[ConvertUtil.INBOUND_INDEX_VALUE];
>                 String splitIvType =
> splitIv[ConvertUtil.INBOUND_INDEX_TYPE];
>                 //InboundVariable valIv = incx.
>                 //InboundVariable valIv = new InboundVariable(incx,
> null, splitIvType, splitIvValue);
>                 InboundVariable valIv =
> incx.createInboundVariable(callNum, key, type, splitIvValue);
>                 valIv.dereference();
>                 Object val = config.convertInbound(valType, valIv,
> valProp);
>
>                 // Keys (unlike values) do not have type info passed
> with them
>                 // Could we have recurrsive key? - I don't think so
> because keys
>                 // must be strings in Javascript
>                 String keyStr = token.substring(0, colonpos).trim();
>                 //String[] keySplit = LocalUtil.splitInbound(keyStr);
>                 //InboundVariable keyIv = new InboundVariable(incx,
> splitIv[LocalUtil.INBOUND_INDEX_TYPE],
> splitIv[LocalUtil.INBOUND_INDEX_VALUE]);
>                 InboundVariable keyIv = new InboundVariable(incx,
> null, ProtocolConstants.TYPE_STRING, keyStr);
>                 keyIv.dereference();
>                
>                 Object key =
> this.config.convertInbound(keyType, keyIv, keyProp);
>
>                 map.put(key, val);
>             }
>
>             return map;
>         }
>         catch (ConversionException ex)
>         {
>             throw ex;
>         }
>         catch (Exception ex)
>         {
>             throw new ConversionException(paramType, ex);
>         }
>     }
>
>
>     /* (non-Javadoc)
>      * @see
> org.directwebremoting.Converter#convertOutbound(java.lang.Obje
> ct, org.directwebremoting.OutboundContext)
>      */
>     @Override
>     public OutboundVariable convertOutbound(Object data,
> OutboundContext outctx) throws ConversionException
>     {
>         // First we just collect our converted children
>         Map ovs = (Map)
> LocalUtil.classNewInstance("OrderedConvertOutbound",
> "java.util.LinkedHashMap", Map.class);
>         if (ovs == null)
>         {
>             ovs = new HashMap();
>         }
>
>         ObjectOutboundVariable ov = new
> ObjectOutboundVariable(outctx);
>         outctx.put(data, ov);
>
>         // Loop through the map outputting any init code and
> collecting
>         // converted outbound variables into the ovs map
>         Map map = (Map) data;
>         for (Iterator it = map.entrySet().iterator(); it.hasNext();)
>         {
>             Map.Entry entry = (Map.Entry) it.next();
>             Object key = entry.getKey();
>             Object value = entry.getValue();
>
>             // It would be nice to check for Enums here
>             if (!(key instanceof String) && !sentNonStringWarning)
>             {
>                 log.warn("--Javascript does not support non string
> keys. Converting '" + key.getClass().getName() + "'
> using toString()");
>                 sentNonStringWarning = true;
>             }
>
>             String outkey =
> JavascriptUtil.escapeJavaScript(key.toString());
>
>             // OutboundVariable ovkey = config.convertOutbound(key,
> outctx);
>             // buffer.append(ovkey.getInitCode());
>             // outkey = ovkey.getAssignCode();
>
>             OutboundVariable nested = config.convertOutbound(value,
> outctx);
>
>             ovs.put(outkey, nested);
>         }
>
>         ov.setChildren(ovs);
>        
>
>         return ov;
>     }
>
>     /**
>      * We don't want to give the non-string warning too many times.
>      */
>     private static boolean sentNonStringWarning = false;
>
>     /**
>      * To forward marshalling requests
>      */
>     private ConverterManager config = null;
>
>     /**
>      * The log stream
>      */
>     private static final Logger log =
> Logger.getLogger(WebFormConverter.class);
>
>
> }
>
> Thanks again,
>
> Ramzi
>
>
> -----Original Message-----
> From: Mike Wilson [mailto:[hidden email]]
> Sent: Monday, April 06, 2015 9:40 AM
> To: [hidden email]
> Subject: [dwr-users] Re: DWR3- RC2. Method not found. See logs for
> details.
>
> DWR3 enhances varargs support and therefore some changes have been
> made to argument handling. There were some bugfixes made in this
> algorithm in 3.0
> RC3 so please re-test with this latest version and report back.
>
> If you still experience problems with 3.0 RC3 let us know what
> arguments you are passing from the client-side for the failing call.
>
> Best regards
> Mike Wilson
>
> r.abbyad wrote:
> > Hello,
> >
> > I am upgrading from dwr2 to dwr3 rc2.  I am receiving the following
> > error message: "No methods called x in y are applicable for
> the passed
> > parameters."  And then an IllegalArgumentException("method
> not found.
> > See logs for details")
> >
> >
> > In particular, the dwr code fails at line 186, in the
> Call.java class.
> > When it does the following check  
> >
> > if (inputArgCount <= i && methodParamType.isPrimitive())
> > {
> >    it.remove();
> >    continue allMethodsLoop;
> > }
> >
> >
> > The method signature of the function being called in java which is
> > being remoted is as follows:
> >
> > public IGrid orderSummarySearch(HttpSession session, WebForm
> > searchParams, int start, int count) throws Exception { ...
> >
> > }
> >
> > The problem is that the inputArgCount  = 3
> >
> > whereas i ranges from 0 to 3 (over the 4 parameters in the
> java method
> > signature).  When "i" has the value 3, inputArgCount <= i,
> and since
> > the 4th parameter is an int, it satisfies
> > methodParamType.isPrimitive()
> > as well.  
> >
> >
> > If inputArgCount were equal to 4, there would be no problem and the
> > method would work fine.  But since it doesn't count the
> HttpSesssion
> > variable, it sets inputArgCount = 3.  Any ideas on what I might be
> > doing wrong here?
> >
> > Thanks,
> >
> > Ramzi

Reply | Threaded
Open this post in threaded view
|

Re: DWR3- RC2. Method not found. See logs for details.

Mike Wilson
Administrator
Good to hear. Thanks for reporting!

Best regards
Mike

Ramzi Abbyad wrote:

> Thanks for the fix!  Working great.
>
> Regards,
>
> Ramzi
>
> -----Original Message-----
> From: Mike Wilson [mailto:[hidden email]]
> Sent: Tuesday, April 07, 2015 7:32 PM
> To: [hidden email]
> Subject: [dwr-users] Re: DWR3- RC2. Method not found. See
> logs for details.
>
> I've looked into your scenario and found a bug where
> auto-filled parameters were not being accounted for. I've
> created this bug ticket:
> https://directwebremoting.atlassian.net/browse/DWR-634
> and checked in a fix.
>
> Please try out this development build to see if it solves
> your problem:
> http://ci.directwebremoting.org/bamboo/browse/DWRTRUNK-ALL-582
> /artifact/JOB1
> /dwr.jar/dwr.jar
>
> Best regards
> Mike
>
> Ramzi Abbyad wrote:
> > I think that if inputArgCount is updated to include any HttpServlet
> > context variable which is automagically being passed in,
> then the code
> > should work fine.  Then again, I'm not entirely sure what
> this block
> > of code is meant to  do:
> >
> >  if (inputArgCount <= i && methodParamType.isPrimitive())
> > {
> >    it.remove();
> >    continue allMethodsLoop;
> > }
> >
> > -----Original Message-----
> > From: Ramzi Abbyad [mailto:[hidden email]]
> > Sent: Monday, April 06, 2015 10:13 AM
> > To: [hidden email]
> > Subject: [dwr-users] Re: DWR3- RC2. Method not found. See logs for
> > details.
> >
> > My mistake, I meant to say RC3.  We are currently using rc3.  
> > The call from the client side is:
> >
> > var webForm = {
> >             orderDateFrom:[today],
> >             orderDateTo:[today],
> >             version: [0],
> >             instanceId: [0],
> >             marketType: ["B"]
> >         };
> >
> > OrderBlotterDA.orderSummarySearch(webForm, 0, 1, {
> >     callback:
> this.__reloadStore.createDelegate(this),
> >     errorHandler: function(errorString, exception){
> >     Ext.Msg.show({
> >     title:      'Order
> Summary Error',
> >     msg:        errorString,
> >     buttons:    Ext.Msg.OK,
> >     icon:       Ext.MessageBox.ERROR
> >     });
> >        }
> >     })
> > Again the signature for the function on the client side contains an
> > HttpServlet context veriable.  It is
> >
> > public IGrid orderSummarySearch(HttpSession session, WebForm
> > searchParams, int start, int count) throws Exception
> >
> >
> > Note, the method works fine if I change the function signature to
> > public IGrid orderSummarySearch(WebForm searchParams, int
> start, int
> > count, HttpSession session)
> >
> > (I put the HttpSession variable at the end of the list).  
> > This is, again, due to the lines of code in the Call.java
> class that I
> > posted in my previous email.
> >
> > This leads me to believe that there may be a bug in your code.  If,
> > for some reason the error is in our converter for the WebForm, I
> > include the WebFormConverter code below:
> >
> > package com.muni.web2.dwr;
> >
> > import java.lang.reflect.Modifier;
> >
> > public class WebFormConverter implements Converter {
> >     /* (non-Javadoc)
> >      * @see
> > org.directwebremoting.Converter#setConverterManager(org.direct
> > webremoting.ConverterManager)
> >      */
> >     public void setConverterManager(ConverterManager newConfig)
> >     {
> >         this.config = newConfig;
> >     }
> >
> >     /* (non-Javadoc)
> >      * @see
> > org.directwebremoting.Converter#convertInbound(java.lang.Class
> > , org.directwebremoting.InboundVariable,
> > org.directwebremoting.InboundContext)
> >      */
> >    
> >    
> > @edu.umd.cs.findbugs.annotations.SuppressWarnings(value={"UCPM
> > _USE_CHARACTER_PARAMETERIZED_METHOD","CLI_CONSTANT_LIST_INDEX"})
> >     public Object convertInbound(Class<?> paramType,
> InboundVariable
> > iv) throws ConversionException
> >     {
> >    
> >         String value = iv.getValue();
> >
> >         // If the text is null then the whole bean is null
> >         if (value.trim().equals(ProtocolConstants.INBOUND_NULL))
> >         {
> >             return null;
> >         }
> >
> >         if (!value.startsWith(ProtocolConstants.INBOUND_MAP_START))
> >         {
> >             throw new
> > IllegalArgumentException("Messages.getString(\"MapConverter.Fo
> > rmatError\", ProtocolConstants.INBOUND_MAP_START)");
> >         }
> >
> >         if (!value.endsWith(ProtocolConstants.INBOUND_MAP_END))
> >         {
> >             throw new
> > IllegalArgumentException("Messages.getString(\"MapConverter.Fo
> > rmatError\", ProtocolConstants.INBOUND_MAP_END)");
> >         }
> >
> >         value = value.substring(1, value.length() - 1);
> >
> >         try
> >         {
> >             // Maybe we ought to check that the paramType isn't
> > expecting a more
> >             // distinct type of Map and attempt to create that?
> >             Map map;
> >
> >             // If paramType is concrete then just use
> whatever we've
> > got.
> >             if (!paramType.isInterface() &&
> > !Modifier.isAbstract(paramType.getModifiers()))
> >             {
> >                 // If there is a problem creating the type then we
> > have no way
> >                 // of completing this - they asked for a
> specific type
> > and we
> >                 // can't create that type. I don't know of a way of
> > finding
> >                 // subclasses that might be instaniable so
> we accept
> > failure.
> >                 map = (Map) paramType.newInstance();
> >             }
> >             else
> >             {
> >                 map = new HashMap();
> >             }
> >            
> >             Property parent = iv.getContext().getCurrentProperty();
> >            
> >             Property keyProp = parent.createChild(0);
> >             keyProp = this.config.checkOverride(keyProp);
> >             Class<?> keyType = keyProp.getPropertyType();
> >            
> >             Property valProp = parent.createChild(1);
> >             Class<?> valType = String[].class;
> >             valProp = this.config.checkOverride(valProp);
> >              
> >             iv.getContext().addConverted(iv, paramType, map);
> >             InboundContext incx = iv.getContext();
> >             // Get the extra type info
> >
> >
> >             // Loop through the property declarations
> >             StringTokenizer st = new StringTokenizer(value, ",");
> >             int size = st.countTokens();
> >             for (int i = 0; i < size; i++)
> >             {
> >                 String token = st.nextToken();
> >                 if (token.trim().length() == 0)
> >                 {
> >                     continue;
> >                 }
> >
> >                 int colonpos =
> > token.indexOf(ProtocolConstants.INBOUND_MAP_ENTRY);
> >                 if (colonpos == -1)
> >                 {
> >                     throw new MarshallException(paramType,
> "Missing :
> > in object description: {1}" + token);
> >                 }
> >
> >                 // Convert the value part of the token by
> splitting it
> > into the
> >                 // type and value (as passed in by Javascript)
> >                 String valStr = token.substring(colonpos +
> 1).trim();
> >                 String[] splitIv = ConvertUtil.splitInbound(valStr);
> >                 String splitIvValue =
> > splitIv[ConvertUtil.INBOUND_INDEX_VALUE];
> >                 String splitIvType =
> > splitIv[ConvertUtil.INBOUND_INDEX_TYPE];
> >                 //InboundVariable valIv = incx.
> >                 //InboundVariable valIv = new InboundVariable(incx,
> > null, splitIvType, splitIvValue);
> >                 InboundVariable valIv =
> > incx.createInboundVariable(callNum, key, type, splitIvValue);
> >                 valIv.dereference();
> >                 Object val = config.convertInbound(valType, valIv,
> > valProp);
> >
> >                 // Keys (unlike values) do not have type
> info passed
> > with them
> >                 // Could we have recurrsive key? - I don't think so
> > because keys
> >                 // must be strings in Javascript
> >                 String keyStr = token.substring(0, colonpos).trim();
> >                 //String[] keySplit =
> LocalUtil.splitInbound(keyStr);
> >                 //InboundVariable keyIv = new InboundVariable(incx,
> > splitIv[LocalUtil.INBOUND_INDEX_TYPE],
> > splitIv[LocalUtil.INBOUND_INDEX_VALUE]);
> >                 InboundVariable keyIv = new InboundVariable(incx,
> > null, ProtocolConstants.TYPE_STRING, keyStr);
> >                 keyIv.dereference();
> >                
> >                 Object key =
> > this.config.convertInbound(keyType, keyIv, keyProp);
> >
> >                 map.put(key, val);
> >             }
> >
> >             return map;
> >         }
> >         catch (ConversionException ex)
> >         {
> >             throw ex;
> >         }
> >         catch (Exception ex)
> >         {
> >             throw new ConversionException(paramType, ex);
> >         }
> >     }
> >
> >
> >     /* (non-Javadoc)
> >      * @see
> > org.directwebremoting.Converter#convertOutbound(java.lang.Obje
> > ct, org.directwebremoting.OutboundContext)
> >      */
> >     @Override
> >     public OutboundVariable convertOutbound(Object data,
> > OutboundContext outctx) throws ConversionException
> >     {
> >         // First we just collect our converted children
> >         Map ovs = (Map)
> > LocalUtil.classNewInstance("OrderedConvertOutbound",
> > "java.util.LinkedHashMap", Map.class);
> >         if (ovs == null)
> >         {
> >             ovs = new HashMap();
> >         }
> >
> >         ObjectOutboundVariable ov = new
> > ObjectOutboundVariable(outctx);
> >         outctx.put(data, ov);
> >
> >         // Loop through the map outputting any init code and
> > collecting
> >         // converted outbound variables into the ovs map
> >         Map map = (Map) data;
> >         for (Iterator it = map.entrySet().iterator(); it.hasNext();)
> >         {
> >             Map.Entry entry = (Map.Entry) it.next();
> >             Object key = entry.getKey();
> >             Object value = entry.getValue();
> >
> >             // It would be nice to check for Enums here
> >             if (!(key instanceof String) && !sentNonStringWarning)
> >             {
> >                 log.warn("--Javascript does not support non string
> > keys. Converting '" + key.getClass().getName() + "'
> > using toString()");
> >                 sentNonStringWarning = true;
> >             }
> >
> >             String outkey =
> > JavascriptUtil.escapeJavaScript(key.toString());
> >
> >             // OutboundVariable ovkey = config.convertOutbound(key,
> > outctx);
> >             // buffer.append(ovkey.getInitCode());
> >             // outkey = ovkey.getAssignCode();
> >
> >             OutboundVariable nested = config.convertOutbound(value,
> > outctx);
> >
> >             ovs.put(outkey, nested);
> >         }
> >
> >         ov.setChildren(ovs);
> >        
> >
> >         return ov;
> >     }
> >
> >     /**
> >      * We don't want to give the non-string warning too many times.
> >      */
> >     private static boolean sentNonStringWarning = false;
> >
> >     /**
> >      * To forward marshalling requests
> >      */
> >     private ConverterManager config = null;
> >
> >     /**
> >      * The log stream
> >      */
> >     private static final Logger log =
> > Logger.getLogger(WebFormConverter.class);
> >
> >
> > }
> >
> > Thanks again,
> >
> > Ramzi
> >
> >
> > -----Original Message-----
> > From: Mike Wilson [mailto:[hidden email]]
> > Sent: Monday, April 06, 2015 9:40 AM
> > To: [hidden email]
> > Subject: [dwr-users] Re: DWR3- RC2. Method not found. See logs for
> > details.
> >
> > DWR3 enhances varargs support and therefore some changes have been
> > made to argument handling. There were some bugfixes made in this
> > algorithm in 3.0
> > RC3 so please re-test with this latest version and report back.
> >
> > If you still experience problems with 3.0 RC3 let us know what
> > arguments you are passing from the client-side for the failing call.
> >
> > Best regards
> > Mike Wilson
> >
> > r.abbyad wrote:
> > > Hello,
> > >
> > > I am upgrading from dwr2 to dwr3 rc2.  I am receiving the
> following
> > > error message: "No methods called x in y are applicable for
> > the passed
> > > parameters."  And then an IllegalArgumentException("method
> > not found.
> > > See logs for details")
> > >
> > >
> > > In particular, the dwr code fails at line 186, in the
> > Call.java class.
> > > When it does the following check  
> > >
> > > if (inputArgCount <= i && methodParamType.isPrimitive())
> > > {
> > >    it.remove();
> > >    continue allMethodsLoop;
> > > }
> > >
> > >
> > > The method signature of the function being called in java
> which is
> > > being remoted is as follows:
> > >
> > > public IGrid orderSummarySearch(HttpSession session, WebForm
> > > searchParams, int start, int count) throws Exception { ...
> > >
> > > }
> > >
> > > The problem is that the inputArgCount  = 3
> > >
> > > whereas i ranges from 0 to 3 (over the 4 parameters in the
> > java method
> > > signature).  When "i" has the value 3, inputArgCount <= i,
> > and since
> > > the 4th parameter is an int, it satisfies
> > > methodParamType.isPrimitive()
> > > as well.  
> > >
> > >
> > > If inputArgCount were equal to 4, there would be no
> problem and the
> > > method would work fine.  But since it doesn't count the
> > HttpSesssion
> > > variable, it sets inputArgCount = 3.  Any ideas on what I
> might be
> > > doing wrong here?
> > >
> > > Thanks,
> > >
> > > Ramzi