You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Ted Yu <yu...@gmail.com> on 2010/06/12 14:02:22 UTC

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 <br...@bryanmoore.com> 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
>
>