Dropwizard/Groovy - ERROR io.dropwizard.jersey.errors.LoggingExceptionMapper: ! groovy.lang.MissingMethodException -


i'm trying create restful web api dropwizard. believe have database connected , running properly. whenever try perform request specific item run error message:

error [2015-07-08 21:55:23,867] io.dropwizard.jersey.errors.loggingexceptionmapper: error handling  request: 084335cfa9b38151 ! groovy.lang.missingmethodexception: no signature of method: static edu.oregonstate.mist.catalogapitest.db.coursedao.findbycrn()  applicable argument types: (java.lang.integer) values: [12345] 

not sure, think may jetty issue rather dropwizard problem.

below have included code believe problem may be.

coursedao.groovy

package edu.oregonstate.mist.catalogapitest.db  import edu.oregonstate.mist.catalogapitest.core.course import edu.oregonstate.mist.catalogapitest.mapper.coursemapper  import org.skife.jdbi.v2.sqlobject.sqlupdate import org.skife.jdbi.v2.sqlobject.sqlquery import org.skife.jdbi.v2.sqlobject.bind import org.skife.jdbi.v2.sqlobject.customizers.registermapper   @registermapper(coursemapper) public interface coursedao extends closeable {     @sqlquery("""             select *             courses             crn = :crn             """)     list<course> findbycrn(@bind("crn") integer crn)      @sqlquery("""             select *             courses             coursename = :coursename             """)     list<course> findbycoursename(@bind("coursename") string coursename)      void close() } 

courseresource.groovy

package edu.oregonstate.mist.catalogapitest.resources  import edu.oregonstate.mist.catalogapitest.core.course import edu.oregonstate.mist.catalogapitest.db.coursedao  import io.dropwizard.jersey.params.intparam  import com.google.common.base.optional import javassist.notfoundexception import org.eclipse.jetty.server.response  import javax.validation.constraints.notnull import javax.ws.rs.consumes import javax.ws.rs.get import javax.ws.rs.post import javax.ws.rs.path import javax.ws.rs.pathparam import javax.ws.rs.produces import javax.ws.rs.queryparam import javax.ws.rs.webapplicationexception import javax.ws.rs.core.mediatype  @path("/course") @produces(mediatype.application_json) class courseresource {      private final coursedao coursedao      public courseresource(coursedao coursedao) {         this.coursedao = coursedao     }      @get     @path('{crn}')     public list<course> getbycrn(@pathparam('crn') intparam crn) {         println(crn.get())          final list<course> courses = coursedao.findbycrn(crn.get())          if (courses.isempty()) {             throw new webapplicationexception(404)         }          return courses     }      @get     @path('/name/{coursename}')     public list<course> getbycoursename(@pathparam('coursename') string coursename) {         println(coursename)          final list<course> courses = coursedao.findbycoursename(coursename)          if (courses.isempty()) {             throw new webapplicationexception(404)         }          return courses     } } 

and finally, here link repo full reference: https://github.com/osu-mist/catalog-api-test

thanks!

in resource, you're trying call static methods

in place of

final list<course> courses = coursedao.findbycrn(crn.get()) 

you need

final list<course> courses = coursedao.findbycrn(crn.get()) 

(with small c in coursedao)


Comments

Popular posts from this blog

php - Using str_replace to translate a MySQL Table in html -

asp.net mvc - Cannot display error message on Editor or EditorFor -

SQL Server - MyCTE query based on 24 hour period (next day) -