Dear Ben,

thanks for your reply.
I built the uber-jar (lol..) with the eclipse-integrated function to export 
jar. I chose the options "Runnable Jar File" and "Extract required libraries 
into generated JAR".
These options work perfectly well for some projects the JAR is used in, but not 
in every.
The FileDataStoreFactorySpi is definitely there in the required folder, but it 
only contains the line "org.geotools.data.shapefile.ShapefileDataStoreFactory", 
is that correct?
Nevertheless, this class exists.
The (now extracted) classes of the gt-shapefile are there as well 
(org.geotools.data.shapefile.*, org.geotools.data.shapefile.dbf.*, 
org.geotools.data.shapefile.indexed.*, 
org.geotools.data.shapefile.indexed.attribute.*, 
org.geotools.data.shapefile.prj.*, org.geotools.data.shapefile.shp.*, 
org.geotools.data.shapefile.shp.xml.*). 
Just how Maven built these; in the pom.xml the gt-shapefile entry exists.

This seems to be weird...
Like I said, it works fine in "my" project, but not in the "big one" we need it 
for.
Nevertheless, thank you for your help.

Kind regards,
Philipp


-----Ursprüngliche Nachricht-----
Von: Ben Caradoc-Davies [mailto:[email protected]] 
Gesendet: Montag, 17. Februar 2014 02:29
An: Oehler, Philipp; [email protected]
Cc: Pfluger, Benjamin
Betreff: Re: [Geotools-gt2-users] "Can't load a service for category 
"FileDataStoreFactorySpi"

Philip,

Do you have the gt-shapefile jar on your classpath?

How did you build your uber-jar? Did you concatenate all the /META-INF/services 
files? This is a Java SPI error that should never occur if you have the 
gt-shapefile jar on the classpath. It looks like something is trying to 
discover a provider for FileDataStoreFactorySpi; I think gt-shapefile provides 
the only (supported) implementation. 
Either you lack gt-shapefile or its
/META-INF/services/org.geotools.data.FileDataStoreFactorySpi has been 
damaged/removed.

If a JAR file contains files in /META-INF/services named for the long class 
name of an interface, they list list implementations of that interface that can 
be discovered dynamically at runtime. This is the Service Provider Interface 
(SPI):
http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#Service_Provider

You can have multiple service providers on the classpath. They are searched in 
the order found.

Kind regards,
Ben.

On 14/02/14 17:51, Oehler, Philipp wrote:
> Dear Geotoolers,
>
> I’m using geotools in a big project. Since we can’t use maven in this 
> big project, I split the parts using geotools apart in a second 
> project with maven, and export it as a .JAR with libraries into the big 
> project.
>
> This worked fine.
>
> But now, out of nowhere, I’m getting an error
>
> “Can't load a service for category "FileDataStoreFactorySpi"”
>
> when running the big project with the second project as .jar in the 
> build path.
>
> Running the second project standalone works fine, so it’s not really 
> an issue of my code.
>
> Maven cleanups don’t fix it, but they change the JRE/JDK. (?!?)
>
> I had this error months before when I was using geotools without maven.
> But since I’m using it with maven now, I’m pretty astounded that this 
> error occurs again :/
>
> Any ideas? I’m pretty perplexed…
>
> Can this be an issue of conflicting JRE’s/JDK’s?!
>
> Thank you very much in advance…
> Philipp
>
>
>
> ----------------------------------------------------------------------
> --------
> Android apps run on BlackBerry 10
> Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
> Now with support for Jelly Bean, Bluetooth, Mapview and more.
> Get your Android app in front of a whole new audience.  Start now.
> http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.
> clktrk
>
>
>
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>

--
Ben Caradoc-Davies <[email protected]> Software Engineer CSIRO Earth 
Science and Resource Engineering Australian Resources Research Centre
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to