[Json-rpc-java] mixing org.json library with json-rpc-java library

Arthur Blake arthur.blake at gmail.com
Sat Jun 17 06:30:27 SGT 2006


I think that's the best approach.  I couldn't get it working quickly though
and I haven't had
time to really figure out why.  So for now, I've refactored the JSONObject
class and JSONArray
classes and put them in the com.metaparadigm.jsonrpc package, so I can use
the two
libraries side by side.  It's really ugly though because in some cases I use
both versions of
these classes in the same module, and I'd like to be able to just use the
latest from org.json.

AIso, it looks like the org.json stuff doesn't have any formal versioning or
anything
(it appears that they just publish whatever latest code they come up with at
the time it's
available) so this could be a big problem going forward too as that library
evolves.

Let me know if you make any headway on this.
Thanks.

On 6/14/06, Michael Clark <michael at metaparadigm.com> wrote:
>
> Arthur Blake wrote:
> > It appears that the json-rpc-java library is using an older version of
> > the org.json library.
> >
> > I am trying to use the newer library because it has some features that
> > are not in the version used in json-rpc-java (such as XML conversion
> > to and from json, and better json pretty printing.)
> >
> > Unfortunately the newer version and the version used in json-rpc-java
> > don't seem to be compatible right off the bat either, because the
> > various method in the JSONObject class can throw a JSONException which
> > the json-rpc-java library does not expect.  I made a quick and dirty
> > attempt to integrate the newer one just by catching the JSONException
> > when it occurs and rethrowing a MarshallException or
> > UnmarshallException throughout the code but it didn't work.
> >
> > Are there plans to integrate the newer library?  Until then, I'll have
> > to refactor the package names in one of the libraries so that I can
> > use both libraries without having a naming collision.
> One option as you suggest may be to repackage the version included with
> json-rpc-java. Probably the easiest. I'll look at that.
>
> Michael.
>


More information about the Json-rpc-java mailing list