简体   繁体   中英

Alternative to Apache Wink JSONObject/JSONException

I've been asked to "upgrade" a codebase from Websphere 7 to 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. 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. I've essentially been asked to "downgrade" the Apache Wink version so it seems. (And no, I can't just include the newer Wink jar in my classpath.)

My question is...what was the previous equivalent of the JSONObject/JSONException that are now in Apache Wink 1.1.3? I need to find something to use in their place.

Thank you!

Unfortunately, Websphere 8.5.5 supplies Apache Wink 1.1.1 version. I myself had trouble when I switched from WAS 7 to 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.
  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. I am assuming your value Bean the the client which is consuming the service uses the same keys.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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