简体   繁体   English

替代Apache Wink JSONObject / JSONException

[英]Alternative to Apache Wink JSONObject/JSONException

I've been asked to "upgrade" a codebase from Websphere 7 to Websphere 8.5.5. 我被要求将代码库从Websphere 7“升级”到Websphere 8.5.5。

There's a reference in the codebase to these objects: 在代码库中有对这些对象的引用:

import org.apache.wink.json4j.JSONObject
import org.apache.wink.json4j.JSONException

The codebase is currently using Apache Wink 1.1.3 and can thus resolve that import statement. 该代码库当前使用Apache Wink 1.1.3,因此可以解析该import语句。 However, it appears that IBM's implementation of Wink is based off of 1.1.1 (is that true??) and because of that I can no longer use the JSONObject or JSONException above. 但是,看来Wink的IBM实现基于1.1.1(是真的吗?),因此,我不能再使用上面的JSONObjectJSONException I've essentially been asked to "downgrade" the Apache Wink version so it seems. 从本质上来说,我似乎已经被要求“降级” Apache Wink版本。 (And no, I can't just include the newer Wink jar in my classpath.) (不,我不能只在类路径中包含更新的Wink jar。)

My question is...what was the previous equivalent of the JSONObject/JSONException that are now in Apache Wink 1.1.3? 我的问题是... Apache Wink 1.1.3中的JSONObject / JSONException的先前等效项是什么? I need to find something to use in their place. 我需要找到一些可以代替它们的东西。

Thank you! 谢谢!

Unfortunately, Websphere 8.5.5 supplies Apache Wink 1.1.1 version. 不幸的是,Websphere 8.5.5提供了Apache Wink 1.1.1版本。 I myself had trouble when I switched from WAS 7 to WAS 8.5.X. 当我从WAS 7切换到WAS 8.5.X时,我自己遇到了麻烦。 You have following options with you: 您有以下选择:

  1. If you don't want to change any code then you can add your wink jars as a shared library reference in your deployed application and it should work fine. 如果您不想更改任何代码,则可以在部署的应用程序中将您的眨眼jars添加为共享库引用 ,它应该可以正常工作。
  2. Instead of creating JSON Data using JSONObject, simply put @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) on you method and return the value bean. 无需使用JSONObject创建JSON数据,只需将@Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)放在方法上并返回值bean。 I am assuming your value Bean the the client which is consuming the service uses the same keys. 我假设您的值Bean,使用该服务的客户端使用相同的键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM