java.lang.NoSuchMethodError: net.sf.json.JSONObject.fromString(Ljava/lang/String;)Lnet/sf/json/JSONObject;

Spring JIRA | Rinaldo Cavalieri | 9 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    From 2.0 version of json lib the static method public JSONObject getJSONObject(String key) used in private void initEvent(AjaxEvent event, HttpServletRequest request) on the class org.springmodules.xt.ajax.AjaxInterceptor was deprecated and removed in the next version..so, it's impossible to use the latest json-lib version (2.2) with Spring Modules Xt that return java.lang.NoSuchMethodError: net.sf.json.JSONObject.fromString(Ljava/lang/String;)Lnet/sf/json/JSONObject; at org.springmodules.xt.ajax.AjaxInterceptor.initEvent(AjaxInterceptor.java:432) at org.springmodules.xt.ajax.AjaxInterceptor.preHandle(AjaxInterceptor.java:139) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:865) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619)

    Spring JIRA | 9 years ago | Rinaldo Cavalieri
    java.lang.NoSuchMethodError: net.sf.json.JSONObject.fromString(Ljava/lang/String;)Lnet/sf/json/JSONObject;
  2. 0

    From 2.0 version of json lib the static method public JSONObject getJSONObject(String key) used in private void initEvent(AjaxEvent event, HttpServletRequest request) on the class org.springmodules.xt.ajax.AjaxInterceptor was deprecated and removed in the next version..so, it's impossible to use the latest json-lib version (2.2) with Spring Modules Xt that return java.lang.NoSuchMethodError: net.sf.json.JSONObject.fromString(Ljava/lang/String;)Lnet/sf/json/JSONObject; at org.springmodules.xt.ajax.AjaxInterceptor.initEvent(AjaxInterceptor.java:432) at org.springmodules.xt.ajax.AjaxInterceptor.preHandle(AjaxInterceptor.java:139) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:865) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619)

    Spring JIRA | 9 years ago | Rinaldo Cavalieri
    java.lang.NoSuchMethodError: net.sf.json.JSONObject.fromString(Ljava/lang/String;)Lnet/sf/json/JSONObject;
  3. 0

    In the latest Jason-lib-1.0 the constructor private JSONObject( String string) was substituted by the constructor private JSONObject( String string, String[] excludes, boolean ignoreDefaultExcludes ) This constructor is called in the "initEvent" method o f AjaxInterceptor class, so when a jason parameter was passed, the AjaxInterceptor return this error java.lang.NoSuchMethodError: net.sf.json.JSONObject.<init>(Ljava/lang/String;)V at org.springmodules.xt.ajax.AjaxInterceptor.initEvent(AjaxInterceptor.java:395) at org.springmodules.xt.ajax.AjaxInterceptor.preHandle(AjaxInterceptor.java:126) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:810) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:755) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) The old 0.9 version of jeson-lib work fine (so, it can be used while this bug isn't fixed)

    Spring JIRA | 1 decade ago | Rinaldo Cavalieri
    java.lang.NoSuchMethodError: net.sf.json.JSONObject.<init>(Ljava/lang/String;)V
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    In the latest Jason-lib-1.0 the constructor private JSONObject( String string) was substituted by the constructor private JSONObject( String string, String[] excludes, boolean ignoreDefaultExcludes ) This constructor is called in the "initEvent" method o f AjaxInterceptor class, so when a jason parameter was passed, the AjaxInterceptor return this error java.lang.NoSuchMethodError: net.sf.json.JSONObject.<init>(Ljava/lang/String;)V at org.springmodules.xt.ajax.AjaxInterceptor.initEvent(AjaxInterceptor.java:395) at org.springmodules.xt.ajax.AjaxInterceptor.preHandle(AjaxInterceptor.java:126) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:810) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:755) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) The old 0.9 version of jeson-lib work fine (so, it can be used while this bug isn't fixed)

    Spring JIRA | 1 decade ago | Rinaldo Cavalieri
    java.lang.NoSuchMethodError: net.sf.json.JSONObject.<init>(Ljava/lang/String;)V

    Root Cause Analysis

    1. java.lang.NoSuchMethodError

      net.sf.json.JSONObject.fromString(Ljava/lang/String;)Lnet/sf/json/JSONObject;

      at org.springmodules.xt.ajax.AjaxInterceptor.initEvent()
    2. org.springmodules.xt
      AjaxInterceptor.preHandle
      1. org.springmodules.xt.ajax.AjaxInterceptor.initEvent(AjaxInterceptor.java:432)
      2. org.springmodules.xt.ajax.AjaxInterceptor.preHandle(AjaxInterceptor.java:139)
      2 frames
    3. Spring MVC
      FrameworkServlet.doGet
      1. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:865)
      2. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
      3. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
      4. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
      4 frames
    4. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      2. javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      2 frames
    5. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      5. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      6. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      7. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      8. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
      8 frames
    6. Grizzly HTTP
      JIoEndpoint$Worker.run
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      3. org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      3 frames
    7. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:619)
      1 frame