java - unable to pass object as method parameter -
i trying pass person object test method below getting error when try run in postman. appreciated
in postman, used following json in body
{ "name" : "aasd", "address" : "asd", "age" : "asdads", "sex" : "asdsad" }
person model
package com.test.model; import javax.xml.bind.annotation.xmlelement; import javax.xml.bind.annotation.xmlrootelement; import java.math.bigdecimal; import java.util.date; @xmlrootelement public class person{ @xmlelement private string name; @xmlelement private string address; public person() { } public void setname(string name) { this.name= name; } @xmlelement public string getname() { return name; } public void setaddress(string address) { this.address= address; } @xmlelement public string getaddress() { return address; } }
controller
package com.test2.controller; import javax.annotation.security.permitall; import javax.ws.rs.consumes; import javax.ws.rs.formparam; import javax.ws.rs.post; import javax.ws.rs.path; import javax.ws.rs.produces; import javax.ws.rs.core.mediatype; import javax.ws.rs.core.response; import com.test.model; @path("person") public class personcontroller { @permitall @post @produces({mediatype.application_json}) @consumes({mediatype.application_json}) @path("test") public person addperson(person person) { return person; } }
error message
exception
javax.servlet.servletexception: org.glassfish.jersey.server.containerexception: java.lang.noclassdeffounderror: not initialize class org.eclipse.persistence.jaxb.beanvalidationhelper root cause
org.glassfish.jersey.server.containerexception: java.lang.noclassdeffounderror: not initialize class org.eclipse.persistence.jaxb.beanvalidationhelper root cause
java.lang.noclassdeffounderror: not initialize class org.eclipse.persistence.jaxb.beanvalidationhelper
Comments
Post a Comment