damiencarol/jsr203-hadoop

how to use the lib in tomcat ?

Closed this issue · 3 comments

we want to use the jsr203 lib in tomcat, but found it unuseable , the classes of the lib can not be loaded by the jvm classloader. while we use the schema like hdfs://somefile, it was be handled by the default FileSystem class. how to fix the problem?

What is the pb? Could you provide a stack trace? How did you package it?
You need to have some Hadoop jar in the path (Hadoop jars are not included)

I want to make sure if it is a valid usage of using the lib in tomcat .
it makes no error and has no effect
I found the source in jdk, it looks like that the fileSystemProvider can be loaded only once, so it can not be configed dynamicly. is it right?
so while the tomcat has be started, the jsr203 loaded by tomcat class loader . but can not be found by jvm. is it right?

jdk1.8 FileSystemProvider.java line:153
`
// loads all installed providers
private static List loadInstalledProviders() {
List list = new ArrayList();

    ServiceLoader<FileSystemProvider> sl = ServiceLoader
        .load(FileSystemProvider.class, ClassLoader.getSystemClassLoader());

    // ServiceConfigurationError may be throw here
    for (FileSystemProvider provider: sl) {
        String scheme = provider.getScheme();

        // add to list if the provider is not "file" and isn't a duplicate
        if (!scheme.equalsIgnoreCase("file")) {
            boolean found = false;
            for (FileSystemProvider p: list) {
                if (p.getScheme().equalsIgnoreCase(scheme)) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                list.add(provider);
            }
        }
    }
    return list;
}

`