Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hadoop >> mail # user >> Using hftp inside a servelet container

Copy link to this message
Using hftp inside a servelet container
 I am trying to access files hdfs through hftp.  When i run following code
from eclipse it works fine.
FsUrlStreamHandlerFactory factory                 new org.apache.hadoop.fs.FsUrlStreamHandlerFactory();

        URL hdfs = new URL("hdfs://<ip>/user/hadoop/<file>");
        BufferedReader in = new BufferedReader(
                new InputStreamReader(hdfs.openStream()));

        String inputLine;
        while ((inputLine = in.readLine()) != null)

But when i run the same code from a JSP page(tomcat) I get following error

*java.lang.Error: factory already defined
        at java.net.URL.setURLStreamHandlerFactory(URL.java:1074)

*Is anyone tried to run hftp from tomcat?? Any ideas on how to resolve
this issue?