Sunday, 15 September 2013

java - Getting NoSuchMethodException when running class despite method being in .class file -



java - Getting NoSuchMethodException when running class despite method being in .class file -

i writing backend project @ university , nail error not comprehend.

i working intellij, gradle , utilize spock testing environment. 1 if goals of project utilize amazons nosql database solution dynamodb. test methods of backend amazondb local used.

currently writing tests various methods of backend... or @ to the lowest degree tried. when run first test nosuchmethodexception "getbookwithtitle" method reached. (funny fact: method "addbook" seems working fine).

this code of test:

def "test adding book database"(){ when: "adding book" methods.addbook("testbook", "sebastian müller", 1990, "gregors", "funkytestcover", mapper); then: "the book should added" methods.getbookwithtitle("testbook", mapper) != null; }

this source of "getbookwithtitle" method:

public book getbookwithtitle(string title, dynamodbmapper mapper){ book result = mapper.load(book.class, title); homecoming result; }

what tried: - cleaning project corresponding gradle task - deleting "build" folder of project hand - decompiling .class file create sure "getbookwithtitle" present

so question is: has out there clue error originates?

if info provided not sufficient give more :)

ok found answer. else , related dynamodb , feature map database items java classes. mapper class needs standard constructor book class had not.

for interested:

the dynamodbmapper.load method calls internally class.newinstance(). method can utilize standard constructor/ constructor without arguments. there no such constructor in class threw nosuchmethodexception.

java intellij-idea gradle amazon-dynamodb

No comments:

Post a Comment