hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From madhu phatak <phatak....@gmail.com>
Subject Using hftp inside a servelet container
Date Wed, 21 Mar 2012 06:49:57 GMT
Hi,
 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();
        java.net.URL.setURLStreamHandlerFactory(factory);

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

        String inputLine;
        while ((inputLine = in.readLine()) != null)
            System.out.println(inputLine);
        in.close();

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?


-- 
https://github.com/zinnia-phatak-dev/Nectar

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message