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

Switch to Threaded View
Hadoop >> mail # user >> Creating URL using "hdfs://" fails with unknown protocol exception.


Copy link to this message
-
Re: Creating URL using "hdfs://" fails with unknown protocol exception.
Take a look at test/org/apache/hadoop/fs/TestUrlStreamHandler.java where you
can find how to use FsUrlStreamHandlerFactory.

On Fri, Jun 11, 2010 at 9:59 AM, Bryan Moore <[EMAIL PROTECTED]> wrote:

>
> I've tried to use this simple line of code to create a URL using hdfs...
>
> URL aurl = new URL("hdfs://myserver:9000/ds");
>
> Executing this line produces this exception.
> java.net.MalformedURLException: unknown protocol: hdfs
>
> Trying to solve this problem I've determined that I need a class that
> subclasses URLStreamHandler.  Figuring that one had already been written for
> hdfs I went looking.
>
> Came across (HADOOP-3074) URLStreamHandler for the DFS.  Where it says to
> do this:
>
> java -Djava.protocol.handler.pkgs=org.apache.hadoop.util.protocols
> <MainClass>}}.
>
> This did not work, and in fact org.apache.hadoop.util.protocols is not even
> found in hadoop-0.20.1-core.jar, nor do I find it anywhere else.
>
>
>
> Any help here please,
>  Thanks
>
>