3 Replies Latest reply on Oct 10, 2007 3:11 AM by Gilles Dubuc

    How to make ClassLoader find CharsetProvider

    Sverker Abrahamsson Novice

      In JDK 1.4 there is support for adding a charset by creating a class that extends java.nio.charset.spi.CharsetProvider and one that extends java.nio.charset.Charset.

      The CharsetProvider is identified by placing a file called java.nio.charset.spi.CharsetProvider in META-INF/services of a jar-file in the classpath and should then be loaded.

      This works fine when I run standalone but when I put the jar file in server/default/lib, it does not work. The classloader can't find my provider and it is never instansiated. I've checked which charsets are availible according to the classloader at that time and my charset is not included eventhough I have no problem to instanciate classes from that jar.

      So I suspect that my jar file is loaded by some custom classloader which doesn't support the charsetprovider. Where should I look?