Hi,

java.lang.NoSuchMethodError is an error from the JVM. In Java it is thrown if the class you compiled against has changed and the old target of the method call no longer exists.

Groovy does not know about any @Beta annotation by default. Did the error happen with static compilation? Because with dynamic Groovy it is almost impossible to have this error... unless of course, the error is a faulty internal non-dynamic code.

A trace to see what code actually made the method call should shed light on the issue. I still thin the classpath was the problem. You changing the source surely made you do a classpath change as well. It is very possible, that you "shadowed" the offending poi jar with that.

bye blackdrag


On 06.11.2015 15:31, Ralph Johnson wrote:
Thanks for the advice on reading error messages.

I am using the trunk of Poi, so it is the latest.   I rechecked the
classpath and that wasn't the problem.   The problem turned out to be
that the methods were annotated with @Beta, and that must have confused
Groovy in some way.  Perhaps the annotation changes the method name so
that Groovy's method lookup can't find it.   In any case, since I had
source, I got rid of the annotation and then my program could find the
method.

The Beta annotation was developed by Google, but it appears that other
projects are using it, so it would be unfortunate if Groovy had trouble
with Java code that used the Beta annotation.

-Ralph Johnson

On Fri, Nov 6, 2015 at 7:01 AM, Winnebeck, Jason
<jason.winneb...@windstream.com <mailto:jason.winneb...@windstream.com>>
wrote:

    It’s in there. For the primitive types, there’s no semi-colon at the
    end. For example void f(int, int, int) has signature f(III)V. With
    the L (object) type, it’s L<class>; with semi-colon at end. You can
    see L*;IL*; in there. That I before the second L is the int argument
    you are looking for.____

    __ __

    As for why you get no such method error, I don’t know. I use POI in
    my project and the version of POI that I have does not have this
    method at all. On the website
    
https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFSheet.html#copyRows%28java.util.List,%20int,%20org.apache.poi.ss.usermodel.CellCopyPolicy%29,
    it does has a signature you are trying to call.____

    __ __

    If you think your POI is new enough to have that method, a common
    issue I’ve seen in cases like this is that accidentially multiple
    versions of a library (POI in this case) are on the classpath at the
    same time and you’re really loading an older version than you think.____

    __ __

    Jason____

    __ __

    *From:*rjohnson.u...@gmail.com <mailto:rjohnson.u...@gmail.com>
    [mailto:rjohnson.u...@gmail.com <mailto:rjohnson.u...@gmail.com>]
    *On Behalf Of *Ralph Johnson
    *Sent:* Friday, November 06, 2015 5:29 AM
    *To:* users@groovy.incubator.apache.org
    <mailto:users@groovy.incubator.apache.org>
    *Subject:* wrong error message?____

    __ __

    I'm calling a Java library (Poi) from Groovy.  I get a "no such
    method" error that says to me that I am passing two arguments, but I
    am really passing three.   My code is____

    __ __

    int i -> sheet.copyRows([sourceRow], i, new CellCopyPolicy())____

    and the error message is____

    __ __

    java.lang.NoSuchMethodError:
    
org.apache.poi.xssf.usermodel.XSSFSheet.copyRows(Ljava/util/List;ILorg/apache/poi/ss/usermodel/CellCopyPolicy;)V____

    __ __

    The way I read it, I am giving copyRows two arguments, a List and a
    CellCopyPolicy.   It didn't seem to see the integer that was the
    second argument.____

    __ __

    Can anyone see what I am doing wrong?   I can give more context, but
    it is just as likely to confuse as to illuminate.____

    __ __

    -Ralph Johnson____

    ------------------------------------------------------------------------
    This email message and any attachments are for the sole use of the
    intended recipient(s). Any unauthorized review, use, disclosure or
    distribution is prohibited. If you are not the intended recipient,
    please contact the sender by reply email and destroy all copies of
    the original message and any attachments.



Reply via email to