Json问题,小弟很是伤心!!

我把Json及它的支持包放进项目lib目录下后,只要new了Json对象就报这个鬼错误:
Method public java.lang.String org.apache.commons.lang.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on net.sf.json.JSONException: java.lang.reflect.InvocationTargetException
freemarker.template.TemplateModelException: Method public java.lang.String org.apache.commons.lang.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on net.sf.json.JSONException: java.lang.reflect.InvocationTargetException
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)
at freemarker.ext.beans.SimpleMethodModel.get(SimpleMethodModel.java:138)
..................
Caused by: java.lang.NullPointerException
at freemarker.ext.beans.SimpleMemberModel.unwrapArguments(SimpleMemberModel.java:85)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)
... 71 more
真不知道该如何解决,, :cry:
(全部家当放上去了,25分..)

关联的Jar包没放全

Caused by: java.lang.NullPointerException
空指针找找错误

[quote]JSONException: java.lang.reflect.InvocationTargetException [/quote]

空指针!检查下关联的jar 包 和 jar 包的版本号!

json包有两个版本 一个是apache的 一共需要六个jar包

commons-lang-1.0.4.jar
commons-collections-2.1.jar
commons-beanutils-1.8.0.jar
json-lib-2.4.jar
ezmorph-1.0.6.jar
commons-logging-1.1.jar

还有一种json包 是就一个jar包 使用和功能上讲 都不如apache的

NestableRuntimeException.getMessage(int) threw an exception when invoked on net.sf.json.JSONException: java.lang.reflect.InvocationTargetException

转成Integer类型试试

我有个小例子你要我发给你

建议LZ换个包把,JSON包我当初做的时候也出这个问题,后来就放弃了这个包,去google下面下载一个gson.jar,可以实现一样的效果,自己做ajax我都用这个的。

用jackson吧,一个包搞掂

[color=red][b]json包有两个版本 一个是apache的 一共需要六个jar包

commons-lang-1.0.4.jar
commons-collections-2.1.jar
commons-beanutils-1.8.0.jar
json-lib-2.4.jar
ezmorph-1.0.6.jar
commons-logging-1.1.jar

还有一种json包 是就一个jar包 使用和功能上讲 都不如apache的
[/b]这哥们是对的。[/color]

听说jackson效率较高

我的报错 是和你一样的 用的都是 net.sf.json 我出现的问题是 model 的关系很复杂 其中有些关系 弄错了 就报了一个和你一样的错误