[Dev] Spatial4j/JTS and classloaders

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Dev] Spatial4j/JTS and classloaders

dsmiley
I was thinking today about why it is that the JTS jar file cannot be in Solr's "lib" or similarly dynamic referenced location.  The problem is that JtsSpatialContext exists in the Spatial4j jar file, and thus all the classes it references need to be located by the ClassLoader that loaded it (generally that of the servlet engine) or an ancestor (e.g. boot/System ClassLoader).  Solr adds a child ClassLoader which Spatial4j effectively doesn't see.  Presumably this pattern could exist outside of Solr so this isn't Solr specific.  The only way I see to solve this problem is to separate out the JTS-using parts of Spatial4j into a separate JAR file artifact.  This solution seems a bit heavy-handed for what is IMO a minor problem, so my preference is to let the status-quo be.

~ David

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com
Reply | Threaded
Open this post in threaded view
|

Re: [Dev] Spatial4j/JTS and classloaders

Chris Male
+1 to status quo.

Lets not make Spatial4j more complex due to Apache project rules.


On Fri, Dec 27, 2013 at 9:55 AM, [hidden email] <[hidden email]> wrote:
I was thinking today about why it is that the JTS jar file cannot be in Solr's "lib" or similarly dynamic referenced location.  The problem is that JtsSpatialContext exists in the Spatial4j jar file, and thus all the classes it references need to be located by the ClassLoader that loaded it (generally that of the servlet engine) or an ancestor (e.g. boot/System ClassLoader).  Solr adds a child ClassLoader which Spatial4j effectively doesn't see.  Presumably this pattern could exist outside of Solr so this isn't Solr specific.  The only way I see to solve this problem is to separate out the JTS-using parts of Spatial4j into a separate JAR file artifact.  This solution seems a bit heavy-handed for what is IMO a minor problem, so my preference is to let the status-quo be.

~ David

_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com



_______________________________________________
dev mailing list
[hidden email]
http://lists.spatial4j.com/listinfo.cgi/dev-spatial4j.com