java - ExceptionMapper in Jersey throws mapMappableContainerException -


i have created 1 rest services , wanted implement exception handling throws mapmappablecontainerexception while try run services. can find code here.

myservice :

@get @produces({mediatype.application_json}) @path("add") public response addjobseeker() throws mycustomexception{      throw new mycustomexception("my exception");      } 

my exception class.

@provider public class myexceptionmapper extends exception implements exceptionmapper<mycustomexception>{     /**      *       */     private static final long serialversionuid = 1l;     public myexceptionmapper(string str){         super(str);     }     @override     public response toresponse(mycustomexception exception) {         system.out.println("in exception mapper -- "+exception.getmessage());         success sc = new success(404, "hello", "i mukesh");         return response.status(404).entity(sc).type(mediatype.application_json).build();             }  } 

mycustomclass

public class mycustomexception extends exception {      /**      *       */     private static final long serialversionuid = 1l;     public mycustomexception(string str){         super(str);     } 


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -