Export to GitHub

jsonplugin - issue #91

doesn't work with struts 2.1.7


Posted on May 4, 2009 by Happy Hippo

JSONUtils.java uses com.opensymphony.xwork2.util.TextUtils which doesn't exist in XWorks 2.1.3 (part of struts 2.1.7)

java.lang.NoClassDefFoundError: com.opensymphony.xwork2.util.TextUtils at com.googlecode.jsonplugin.JSONUtil.writeJSONToResponse(JSONUtil.java:197) at com.googlecode.jsonplugin.JSONResult.writeToResponse(JSONResult.java:192)

Comment #1

Posted on May 19, 2009 by Helpful Horse

Attached is a patch that doesn't use the missing TextUtils.

Attachments

Comment #2

Posted on Jul 25, 2009 by Massive Kangaroo

How should i install the patch ???

Comment #3

Posted on Jul 25, 2009 by Swift Horse

svn checkout http://jsonplugin.googlecode.com/svn/trunk/ jsonplugin-read-only edit the one line in the patch edit the pom.xml '0.33' -> '0.34-SNAPSHOT' mvn install

Comment #4

Posted on Jul 27, 2009 by Massive Kangaroo

I never had done it before so I´m a little confused. I got a SVN plugin to Eclipse and made a checkout. Ok, i got the project. Then i changed the JSONUtil.java and the pom.xml. But i didnt find how to make the mvn install. Could you help me? Thanks!!

Comment #5

Posted on Jul 27, 2009 by Massive Kangaroo

Obs.: I had used the "apply patch" to change JSONUtil.java, and mannually pom.xml.

Comment #6

Posted on Jul 27, 2009 by Swift Horse

Install "maven" if necessary, then run "mvn install" while in the directory "jsonplugin-read-only".

Comment #7

Posted on Jul 28, 2009 by Massive Dog

I will fix this when struts 2.1.8 is released (xwork 2.1.5)

Comment #8

Posted on Aug 6, 2009 by Swift Dog

cant take com.opensymphony.xwork2.util.TextUtils out of the picture yet writeJSONToResponse will produce CNFE errors for TextUtils references specifically

public static void writeJSONToResponse(SerializationParams serializationParams)

throws IOException { StringBuilder stringBuilder = new StringBuilder(); if (TextUtils.stringSet(serializationParams.getSerializedJSON())) stringBuilder.append(serializationParams.getSerializedJSON());

    if (TextUtils.stringSet(serializationParams.getWrapPrefix()))
        stringBuilder.insert(0, serializationParams.getWrapPrefix());
    else if (serializationParams.isWrapWithComments()) {
        stringBuilder.insert(0, "/* ");
        stringBuilder.append(" */");
    } else if (serializationParams.isPrefix())
        stringBuilder.insert(0, "{}&& ");

    if (TextUtils.stringSet(serializationParams.getWrapSuffix()))
        stringBuilder.append(serializationParams.getWrapSuffix());

Comment #9

Posted on Aug 6, 2009 by Swift Dog

F:\struts\jsonplugin\src\main\java\com\googlecode\jsonplugin\JSONUtil.java:[197, 11] cannot find symbol symbol : variable smd location: class com.googlecode.jsonplugin.JSONUtil

F:\struts\jsonplugin\src\main\java\com\googlecode\jsonplugin\JSONUtil.java:[200, 68] cannot find symbol symbol : variable encoding location: class com.googlecode.jsonplugin.JSONUtil

\struts\jsonplugin\src\main\java\com\googlecode\jsonplugin\JSONUtil.java:[204, 18] cannot find symbol symbol : variable contentType location: class com.googlecode.jsonplugin.JSONUtil

rollback to serializationParams.isSmd() instead of smd rollback to serializationParams.getEncoding() instead of encoding rollback to serializationParams.getContentType() instead of contentType

also had to rollback to xwork-2.1.2 to get com.opensymphony.xwork2.util.TextUtils pom.xml contains com.opensymphony.xwork2.util xwork 2.1.2

location for pom.xml,settings.xml and jar: http://m2proxy.atlassian.com/repository/public/com/opensymphony/xwork/2.1.2/

stringSet method from TextUtils is intact

Status: New

Labels:
Type-Defect Priority-Medium