title: JAX-RS: NoSuchMethodFound Exception Jersey-media-moxy JSON
body: <p>I have been struggling with this for hours now. I'm working on JAX-RS with jersey. Everything was going fine until I had to return JSON at one place. I know there must be a jersey-media-moxy library to be there in order to binding your Java objects to JSON format. I downloaded several JSON libraries one after another starting from Jersey-media-moxy to Google's genson library. But no success yet. With Jersey-media-moxy which I downloaded from <a href="http://www.java2s.com/Code/Jar/j/Downloadjerseymediamoxy23jar.htm" rel="nofollow noreferrer">http://www.java2s.com/Code/Jar/j/Downloadjerseymediamoxy23jar.htm</a>, I get the following error while running the webservice.</p>
  
  <pre><code>SEVERE: StandardWrapper.Throwable
  java.lang.NoSuchMethodError: org.glassfish.jersey.internal.util.PropertiesHelper.getValue(Ljava/util/Map;Ljavax/ws/rs/RuntimeType;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
      at org.glassfish.jersey.moxy.json.MoxyJsonFeature.configure(MoxyJsonFeature.java:67)
      at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:714)
      at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:644)
      at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:829)
      at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:453)
      at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:184)
      at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:350)
      at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:347)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
      at org.glassfish.jersey.server.ApplicationHandler.&lt;init&gt;(ApplicationHandler.java:347)
      at org.glassfish.jersey.servlet.WebComponent.&lt;init&gt;(WebComponent.java:390)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:172)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:364)
      at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
  
  Jan 22, 2016 6:44:46 AM org.apache.catalina.core.StandardWrapperValve invoke
  SEVERE: Allocate exception for servlet JAVA WS
  java.lang.NoSuchMethodError: org.glassfish.jersey.internal.util.PropertiesHelper.getValue(Ljava/util/Map;Ljavax/ws/rs/RuntimeType;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
      at org.glassfish.jersey.moxy.json.MoxyJsonFeature.configure(MoxyJsonFeature.java:67)
      at org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:714)
      at org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:644)
      at org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:829)
      at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:453)
      at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:184)
      at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:350)
      at org.glassfish.jersey.server.ApplicationHandler$3.call(ApplicationHandler.java:347)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:255)
      at org.glassfish.jersey.server.ApplicationHandler.&lt;init&gt;(ApplicationHandler.java:347)
      at org.glassfish.jersey.servlet.WebComponent.&lt;init&gt;(WebComponent.java:390)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:172)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:364)
      at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)
      at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>If I change the <em>@Produces()</em> annotation with <code>MediaType.APPLICATION_XML</code>, every thing works fine but as soon as I change it to <code>MediaType.APPLICATION_JSON</code>, I get the error. </p>
  
  <p>It is a non-maven project where I added the jars via Project-> Properties.
  I tried other JSON libraries like <em>Jetty, Jackson</em> but not a single one worked. Libraries other than <em>Jersey-media-moxy</em> thorws the <em>MessageBodyWriter not found</em> exception. What is it I'm doing wrong? Is it something with the dependecies? Here is my project structure:</p>
  
  <p><a href="https://i.stack.imgur.com/Yg44Q.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yg44Q.jpg" alt="Project Structure"></a></p>
  
  <p>Any help in this regard would be highly appreciated.
  Thanks in Advance.</p>