|
|
-
Using hftp inside a servelet containermadhu phatak 2012-03-21, 06:49
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 |