[Geoserver-devel] Multiple json-lib versions

Hi all!

I noticed that GeoServer depends on two different version of the json-lib library (2.1 and 2.2.3).

The 2.1 version comes from GeoWebCache (https://github.com/GeoWebCache/geowebcache/blob/master/geowebcache/pom.xml) while the 2.2.3 version comes from GeoServer itself (https://github.com/geoserver/geoserver/blob/master/src/pom.xml).

I discovered this while working on a pull request to integrate Geoscript Groovy into the community scripting module. Because of Groovy Metaclasses embedded in json-lib 2.1 (groovy.runtime.metaclass.java.lang.StringMetaClass for example), any code compiled by a different versions of the the Groovy compiler will throw an error. Json-lib 2.1 was compiled with Groovy 1.0 (which is ancient). GeoScript Groovy uses 1.8.8. Json-lib 2.2.3 removed these Groovy metaclasses. So, to get GeoScript Groovy working with the community scripting module, we need to do one or two things: upgrade GeoWebCache's json-lib library to 2.2.3 or exclude the gwc json-lib dependency in the following files: src/gwc/pom.xml, the src/web/app/pom.xml, and the src/we/gwc/pom.xml. Either way, I will gladly file a jira issue and create a pull request if it would be helpful.

Thanks,
Jared

Hey Jared,

Yeah, definitely looks like a duplicate. +1 on adding the exclusion, and perhaps later upgrade gwc’s version of json-lib (need to hear from the gwc devs on that). A pull request would be very welcome.

Also, in terms of the exclusion as long as its added in a dependencyManagement section only one should be required. Or at least i think.

Also I am pretty excited that you are merging geoscript-groovy into the groovy scripting module!

-Justin

On Mon, Nov 5, 2012 at 5:56 PM, Jared Erickson <jared.erickson@anonymised.com> wrote:

Hi all!

I noticed that GeoServer depends on two different version of the json-lib library (2.1 and 2.2.3).

The 2.1 version comes from GeoWebCache (https://github.com/GeoWebCache/geowebcache/blob/master/geowebcache/pom.xml) while the 2.2.3 version comes from GeoServer itself (https://github.com/geoserver/geoserver/blob/master/src/pom.xml).

I discovered this while working on a pull request to integrate Geoscript Groovy into the community scripting module. Because of Groovy Metaclasses embedded in json-lib 2.1 (groovy.runtime.metaclass.java.lang.StringMetaClass for example), any code compiled by a different versions of the the Groovy compiler will throw an error. Json-lib 2.1 was compiled with Groovy 1.0 (which is ancient). GeoScript Groovy uses 1.8.8. Json-lib 2.2.3 removed these Groovy metaclasses. So, to get GeoScript Groovy working with the community scripting module, we need to do one or two things: upgrade GeoWebCache’s json-lib library to 2.2.3 or exclude the gwc json-lib dependency in the following files: src/gwc/pom.xml, the src/web/app/pom.xml, and the src/we/gwc/pom.xml. Either way, I will gladly file a jira issue and create a pull request if it would be helpful.

Thanks,
Jared


LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d


Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Just an aside really, but when we went looking for json functionality,
we found json-lib to rather slow. I guess it depends heavily on what you
are actually doing but we settled on jackson though Json-fast and
Json-Smart are also reputedly good.

Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.

Thanks Justin,

Here is the pull request:

https://github.com/geoserver/geoserver/pull/55

Everything builds and all tests pass. And the GeoScript Groovy code runs
without java.lang.VerifyErrors. Just as an aside, the community script
module is really cool. So, kudos to you and Tim.

Thanks again,
Jared

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Multiple-json-lib-versions-tp5014154p5014395.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.

Awesome, thanks Jared. Pull request merged.

On Tue, Nov 6, 2012 at 2:48 PM, jerickson <jared.erickson@anonymised.com> wrote:

Thanks Justin,

Here is the pull request:

https://github.com/geoserver/geoserver/pull/55

Everything builds and all tests pass. And the GeoScript Groovy code runs
without java.lang.VerifyErrors.

Looking forward to the groovy addition. I imagine we will be expecting another pull request shortly? :wink: Once that is in there i can enable groovy in the nightly community builds so people can try it out.

Just as an aside, the community script
module is really cool. So, kudos to you and Tim.

Thanks!

Thanks again,
Jared


View this message in context: http://osgeo-org.1560.n6.nabble.com/Multiple-json-lib-versions-tp5014154p5014395.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.


LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d


Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.