Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
[Xt-Ajax] Error using json parameter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Xt-Ajax] Error using json parameter

    When i try to pass a Jason parameter this error is returned:
    Code:
    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)
    This when i include the latest json-lib-1.0-jdk15....but all work fine with the json-lib-0.9 version.
    It seems that from version 0.9 to 1.0 the constructor
    Code:
    private JSONObject( String string)
    called by the xt AjaxInterceptor was substituted by the constructor
    Code:
    private JSONObject( String string, String[] excludes, boolean ignoreDefaultExcludes )
    and this cause this error...it's possible to correct him ??
    Thanks

  • #2
    Originally posted by Stoned View Post
    [CUT]
    This when i include the latest json-lib-1.0-jdk15....but all work fine with the json-lib-0.9 version.
    It seems that from version 0.9 to 1.0 the constructor
    Code:
    private JSONObject( String string)
    called by the xt AjaxInterceptor was substituted by the constructor
    Code:
    private JSONObject( String string, String[] excludes, boolean ignoreDefaultExcludes )
    and this cause this error...it's possible to correct him ?
    Can you open a Jira issue : http://opensource.atlassian.com/proj...ing/browse/MOD ?

    I'll try to fix it ASAP.

    Cheers,

    Sergio B.

    Comment


    • #3
      Explanation

      Hi, the reason for your code not working now is that in version 1.0 all constructors (except the empty one) are now private and some were deleted. This measure was taken to enforce appropriate creation of objects by using the static builders or by adding properties to an empty JSONObject/JSONarray with put/set.

      Comment


      • #4
        Originally posted by aalmiray View Post
        This measure was taken to enforce appropriate creation of objects by using the static builders or by adding properties to an empty JSONObject/JSONarray with put/set.
        Hi Andres,

        is there any counter-indication in using the 0.9 constructors as XT actually does?
        I'd prefer to stay with Json-lib 0.9 for the upcoming SM 0.8 release, and upgrade later.

        Thanks,
        Cheers,

        Sergio B.

        Comment


        • #5
          Hi Sergio,
          You may stay with 0.9 but you may miss some important bugfixes that 1.0 has.
          When working with 1.0, you need to change
          new JSONObject( str ) to
          JSONObject.fromString( str) or JSONObject.fromObject( str )
          or even
          JSONSerializer.toJSON( str ) which will yield either a JSONObject or a JSONArray

          Cheers,
          Andres

          Comment


          • #6
            Originally posted by aalmiray View Post
            You may stay with 0.9 but you may miss some important bugfixes that 1.0 has.
            Thanks for your answer, Andres.

            Everything seems to work well right now, so, given that I don't have enough time to test the upgrade, I'll stay with the 0.9 version.

            However, is there some way for making json-lib 1.x compatible with 0.9?
            Could a deprecated constructor be an option?

            Cheers,

            Sergio B.

            Comment


            • #7
              Sergio,

              I suppose its doable. How fast do you need it?

              Comment


              • #8
                Originally posted by aalmiray View Post
                I suppose its doable. How fast do you need it?
                Thanks for your willing to help.

                SM 0.8 will be released in a few days, so there's not enough time, but if you do a new json-lib minor release, XT Ajax users will be able to use your new 1.x release even with the current XT 0.8 release.

                What do you think?

                Cheers,

                Sergio B.

                Comment


                • #9
                  Sergio,

                  You may find json-lib-1.0.1 with this fix at http://json-lib.sourceforge.net/m2/repo/release/

                  Cheers,
                  Andres

                  Comment


                  • #10
                    XT Ajax Framework 0.8 has been upgraded to Json-lib and EZMorph 1.0.1.

                    Cheers,

                    Sergio B.

                    Comment

                    Working...
                    X