maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahardy42 <>
Subject ServiceLoader not loading FileTypeDetector implementation in jar
Date Thu, 04 Jan 2018 16:12:33 GMT
I created, tested and packaged a java.nio.file.spi.FileTypeDetector
implementation in a utility jar for use by Files.probeContentType(path). 

So it works beautifully in my utility project. 

I'm now trying to use it in another project but despite hours of trying, I
can't work out why the JVM can't find or load my implementation and keeps
defaulting back to the JDK's RegisterFileTypeDetector.

I have double checked that the utility jar is in my classpath with
dependency:tree, contains the
META-INF/services/java.nio.file.spi.FileTypeDetector file naming my
implementation, and also the actual implementation class.

The JDK javadoc documentation claims that it will seek it out anywhere on
the application's classpath:

but I only see it searching on the system classpath during debugging. 

My efforts are hampered by the use of nested arrays of Enumeration<URL> with
sun.misc.CompoundEnumeration. It's really convoluted and I haven't been able
to see where it fails.

What could I be doing wrong? 

Sent from:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message