[ http://issues.apache.org/jira/browse/NUTCH-46?page=comments#action_63942 
]
     
zhangjin commented on NUTCH-46:
-------------------------------

Firstly thanks,I have modify them according to your thought.The code is shown.
But when  the offerDataNode1 is executed,the message is like
"050428 091753 Opened server at 7000

050428 091859 Lost connection to namenode [/127.0.0.1:8000].  Retrying...

050428 091921 Lost connection to namenode [/127.0.0.1:8000].  Retrying...
"
why?But i use the version which package is net.nutch.The datanode can connect 
the namenode.


  //new add
    public static void main(String[] args) {
      
try {
  offerNameNode();
  offerDataNode1();
  //offerDataNode2();
}
catch (Exception ex) {
  
}
    }
    public static void   offerNameNode()
    {
      try {
          //namedate service
          NameNode namenode = new NameNode(new File("c:/nutch_data/data"),8000);
          namenode.start();
          namenode.join();
         
        }
        catch (Exception ex) {
  
        }
  

    }
    public static void offerDataNode1()
    {
      try {
          String localMachine = "127.0.0.1";
           String nameNodeStr ="127.0.0.1:8000";
           int colon = nameNodeStr.indexOf(":");
           if (colon < 0) {
               System.out.println("Incorrect <nameserver:port> param");
               System.exit(-1);
           }
           String nameNodeName = nameNodeStr.substring(0, colon);
           int nameNodePort = Integer.parseInt(nameNodeStr.substring(colon + 
1));
           InetSocketAddress nameNodeAddr = new InetSocketAddress(nameNodeName, 
nameNodePort);
         /*  DataNode DataNode=new DataNode("127.0.0.1:7000",new 
File("c:/nutch_data/1"),nameNodeAddr);
           DataNode.offerService();*/
           DataNode datanode = new DataNode(localMachine, new 
File("c:/nutch_data/1"), nameNodeAddr);
           while (true) {
               try {
                   datanode.offerService();
               } catch (Exception ex) {
                   LOG.info("Lost connection to namenode [" + nameNodeAddr + 
"].  Retrying...");
                   try {
                       Thread.sleep(5000);
                   } catch (InterruptedException ie) {
                     ex.printStackTrace();
                   }
               }
           }
       

         }
      catch (Exception ex) {
        ex.printStackTrace();
      }
       
    }

> the NDFS problem(Could not obtain new output block for file)
> ------------------------------------------------------------
>
>          Key: NUTCH-46
>          URL: http://issues.apache.org/jira/browse/NUTCH-46
>      Project: Nutch
>         Type: Bug
>   Components: fetcher
>  Environment: jdk1.4.1,nutch0.6,lucene1.4.3,windows2000
>     Reporter: zhangjin
>     Priority: Critical
>  Attachments: ndfspatch
>
> Ndfs is very important to  distributed handling.But I never get good result 
> by NDfS, The error is Like "
> Hit uncaught exception java.io.IOException java.io.IOException: Could not 
> obtain new output block for file  1.txt"
> Please tell me
> Thanks thanks very much!
> msn:[EMAIL PROTECTED]
> mail:[EMAIL PROTECTED]
> blog0:http://blog.csdn.net/prettyheart
> blog1:http://soacn.blogchina.com

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to