Alternative to Apache Wink JSONObject/JSONException

1k views Asked by At

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!

1

There are 1 answers

1
Prerak Tiwari On

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.