Post a Job  |   Ask a Question?   |   Already registered? login or register
krishna kumar
15/03/2016 10:49 AM

Dobut in Jersey


1 get Resource method is working fine but when create a resource with 2 Get methods, it will not execute... WHY? url : GET 1: http://localhost:1234/JerseyCouriesWeb/rest/courier?source=hyd&dest=bang&weight=65 GET 2:http://localhost:1234/JerseyCouriesWeb/rest/courier?agent=A1234&tokenNo=1234567
while load on startup its get error : SEVERE: StandardWrapper.Throwable org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization. [[FATAL] A resource model has ambiguous (sub-)resource method for HTTP method GET and input mime-types as defined by @Consumes and @Produces annotations at Java methods public java.lang.String com.jc.resources.CourierResource.getName(java.lang.String,int) and public float com.jc.resources.CourierResource.getrateOfUsshipping(java.lang.String,java.lang.String,float) at matching regular expression /courier. These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source='org.glassfish.jersey.server.model.RuntimeResource@11ca2e4'] ================================================================================== SEVERE: Allocate exception for servlet jersey org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization. [[FATAL] A resource model has ambiguous (sub-)resource method for HTTP method GET and input mime-types as defined by @Consumes and @Produces annotations at Java methods public java.lang.String com.jc.resources.CourierResource.getName(java.lang.String,int) and public float com.jc.resources.CourierResource.getrateOfUsshipping(java.lang.String,java.lang.String,float) at matching regular expression /courier. These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source='org.glassfish.jersey.server.model.RuntimeResource@16bb9f7']
Spam    4 Comments

HARIOM,PANDEY
15/03/2016 12:03:16
because, Principal of Unique Resource URI resource is uniquely identified by its PATH (and not by its params) Two resources you define have the same PATH...here one URI represents more than one resource that means wrong.

Anonymous,oio
15/03/2016 12:44:08

Anonymous,oio
15/03/2016 12:48:36

HARIOM,PANDEY
15/03/2016 22:59:21
thanks..

Languages :
xml