Nutch1.0在eclipse中运行问题之解决

今天按照前面几篇文章所述之操作解决了程序中的报错,但是在调试运行过程中会出现如果错误.本问题主要针对windows操作系统.
问题一:
现贴出:
2010-03-25 21:42:33,937 WARN  fs.FileSystem (FileSystem.java:<init>(1440)) - uri=file:///
javax.security.auth.login.LoginException: Login failed: Cannot run program "whoami": CreateProcess error=2, ?????????
at org.apache.hadoop.security.UnixUserGroupInformation.login(UnixUserGroupInformation.java:250)
at org.apache.hadoop.security.UnixUserGroupInformation.login(UnixUserGroupInformation.java:275)
at org.apache.hadoop.security.UnixUserGroupInformation.login(UnixUserGroupInformation.java:257)
at org.apache.hadoop.security.UserGroupInformation.login(UserGroupInformation.java:67)
at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:1438)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1376)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:215)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:120)
at org.apache.nutch.crawl.Crawl.main(Crawl.java:84)
2010-03-25 21:42:34,593 INFO  crawl.Crawl (Crawl.java:main(87)) - crawl started in: crawl
2010-03-25 21:42:34,593 INFO  crawl.Crawl (Crawl.java:main(88)) - rootUrlDir = urls
2010-03-25 21:42:34,593 INFO  crawl.Crawl (Crawl.java:main(89)) - threads = 10
2010-03-25 21:42:34,593 INFO  crawl.Crawl (Crawl.java:main(90)) - depth = 3
2010-03-25 21:42:34,593 INFO  crawl.Crawl (Crawl.java:main(92)) - topN = 50
2010-03-25 21:42:34,609 WARN  fs.FileSystem (FileSystem.java:<init>(1440)) - uri=file:///
javax.security.auth.login.LoginException: Login failed: Cannot run program "whoami": CreateProcess error=2, ?????????
at org.apache.hadoop.security.UnixUserGroupInformation.login(UnixUserGroupInformation.java:250)
at org.apache.hadoop.security.UnixUserGroupInformation.login(UnixUserGroupInformation.java:275)
at org.apache.hadoop.security.UnixUserGroupInformation.login(UnixUserGroupInformation.java:257)
at org.apache.hadoop.security.UserGroupInformation.login(UserGroupInformation.java:67)
at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:1438)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1376)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:215)
at org.apache.hadoop.fs.FileSystem.getLocal(FileSystem.java:191)
at org.apache.hadoop.conf.Configuration.getLocalPath(Configuration.java:787)
at org.apache.hadoop.mapred.JobConf.getLocalPath(JobConf.java:232)
at org.apache.nutch.crawl.Crawl.main(Crawl.java:101)
2010-03-25 21:42:34,984 WARN  fs.FileSystem (FileSystem.java:<init>(1440)) - uri=file:///

.................

问题分析及解决:
因为Nutch设计是在linux等系统下运行的,Windows系统是没有"whoami"这个命令的。解决办法是:在windows的系统环境变量Path中加入Cygwin的路径(如D:\Cygwin\bin)。

问题二:
Exception in thread "main" java.lang.IllegalArgumentException: Fetcher: No agents listed in 'http.agent.name' property.
at org.apache.nutch.fetcher.Fetcher.checkConfiguration(Fetcher.java:1019)
at org.apache.nutch.fetcher.Fetcher.fetch(Fetcher.java:942)
at org.apache.nutch.crawl.Crawl.main(Crawl.java:122)
2010-03-26 11:41:55,796 INFO  crawl.Generator (Generator.java:generate(562)) - Generator: done.
2010-03-26 11:41:55,796 FATAL fetcher.Fetcher (Fetcher.java:checkConfiguration(1017)) - Fetcher: No agents listed in 'http.agent.name' property.


此问题是由于在nutch-site.xml文件中没有给<name>http.agent.name</name>设值,因此可按如下方式设值:
<property>
    <name>http.agent.name</name>
    <value>HD nutch agent</value>
</property>
<property>
    <name>http.agent.version</name>
    <value>1.0</value>
</property>

问题三:
在cygwin中运行nutch1.0时可能会提示缺少JAVA_HOME,此问题只需要将conf/hadoop-env.sh文件中# export JAVA_HOME=/usr/bin/java   改为   export JAVA_HOME="您的java目录"


至此,在Windows平台上使用Eclipse运行和调试Nutch应该可以顺利进行了

你可能感兴趣的:(java,apache,eclipse,hadoop,Security)