Fixed!
Configuration conf = NutchConfiguration.addNutchResources(new
Configuration());
NutchBean bean = new NutchBean(conf);
But I zero results back from a query that returns many results in the web UI
servet by tomcat+nutch. Anyone have any quick ideas there?
P.S.: I discovered my fix (though I don't know it's truly correct because I
get zero results) by running a search through the entire nutch source tree for
'Configuration'. I poked around at the resulting files, including
DistributedSearchTest.java. This made a call:
conf=NutchConfiguration.create(). So I looked at the API doc for
NutchConfiguration then the actual source code for this method:
/** Add the standard Nutch resources to [EMAIL PROTECTED] Configuration}. */
public static Configuration addNutchResources(Configuration conf) {
conf.addDefaultResource("nutch-default.xml");
conf.addFinalResource("nutch-site.xml");
return conf;
}
That looked plausible so I used it and I got my 'SearchApp' program to run with
no exceptions.
----- Original Message ----
From: Kai_testing Middleton <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Tuesday, July 24, 2007 6:12:36 PM
Subject: Re: IllegalArgumentException: plugin.folders is not defined
How to use NutchBean: Is this ok?
Configuraton conf = new Configuration();
NutchBean bean = new NutchBean(conf);
Here's the full error trace:
$ nutch SearchApp some_search_string
Exception in thread "main" java.lang.IllegalArgumentException: plugin.folders
is not defined
at
org.apache.nutch.plugin.PluginManifestParser.parsePluginFolder(PluginManifestParser.java:78)
at org.apache.nutch.plugin.PluginRepository.<init>(PluginRepository.java:71)
at org.apache.nutch.plugin.PluginRepository.get(PluginRepository.java:95)
at org.apache.nutch.searcher.QueryFilters.<init>(QueryFilters.java:57)
at org.apache.nutch.searcher.IndexSearcher.init(IndexSearcher.java:79)
at org.apache.nutch.searcher.IndexSearcher.<init>(IndexSearcher.java:63)
at org.apache.nutch.searcher.NutchBean.init(NutchBean.java:138)
at org.apache.nutch.searcher.NutchBean.<init>(NutchBean.java:104)
at org.apache.nutch.searcher.NutchBean.<init>(NutchBean.java:82)
at SearchApp.main(SearchApp.java:23)
Here is the same stack trace, but with each line of code inserted
Exception in thread "main" java.lang.IllegalArgumentException: plugin.folders
is not defined
throw new IllegalArgumentException("plugin.folders is not defined");
at
org.apache.nutch.plugin.PluginManifestParser.parsePluginFolder(PluginManifestParser.java:78)
Map<String, PluginDescriptor> allPlugins =
manifestParser.parsePluginFolder(pluginFolders);
at org.apache.nutch.plugin.PluginRepository.<init>(PluginRepository.java:71)
result = new PluginRepository(conf);
at org.apache.nutch.plugin.PluginRepository.get(PluginRepository.java:95)
ExtensionPoint point = PluginRepository.get(conf)
at org.apache.nutch.searcher.QueryFilters.<init>(QueryFilters.java:57)
this.queryFilters = new QueryFilters(conf);
at org.apache.nutch.searcher.IndexSearcher.init(IndexSearcher.java:79)
init(new MultiReader(readers), conf);
at org.apache.nutch.searcher.IndexSearcher.<init>(IndexSearcher.java:63)
indexSearcher = new IndexSearcher(directories, this.conf);
at org.apache.nutch.searcher.NutchBean.init(NutchBean.java:138)
init(new Path(dir, "index"), new Path(dir, "indexes"), new Path(dir,
"segments"), new Path(dir, "linkdb"));
at org.apache.nutch.searcher.NutchBean.<init>(NutchBean.java:104)
this(conf, null);
at org.apache.nutch.searcher.NutchBean.<init>(NutchBean.java:82)
NutchBean bean = new NutchBean(conf);
at SearchApp.main(SearchApp.java:23)
I have nutch running on a BSD server on my LAN. I'm on a windows laptop. Can
I use eclipse in this configuration--remotely?
P.S.: I'm following
http://today.java.net/pub/a/today/2006/02/16/introduction-to-nutch-2.html and I
had forgotten one of the setup steps: I had forgotten to create SearchApp.jar
and put it in $NUTCH_HOME/lib, then run
nutch SearchApp some_search_string
rather than
java -cp <many jars>:$NUTCH_HOME/conf:. SearchApp some_search_string
But I'm still getting the same exception:
IllegalArgumentException: plugin.folders is not defined
--Kai M.
----- Original Message ----
From: Kai_testing Middleton <[EMAIL PROTECTED]>
To: nutch user <[EMAIL PROTECTED]>
Sent: Tuesday, July 24, 2007 12:22:58 PM
Subject: IllegalArgumentException: plugin.folders is not defined
I'm getting this error when I try to run a command line nutch-API based search
app:
IllegalArgumentException: plugin.folders is not defined
Any suggestions?
This is the command:
java -cp <many jars>:$NUTCH_HOME/conf:. SearchApp a_search_string
I looked at this post:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg08241.html
and saw advice to put the conf directory in the CLASSPATH, which I did as you
see above, and to also modify nutch-site.xml to contain a line for
plugin.folders, which I also did:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<!-- I'm setting this to an absolute path for the SearchApp sample -->
<property>
<name>plugin.folders</name>
<value>/usr/local/nutch-2007-06-27_06-52-44/plugins</value>
<description>Directories where nutch plugins are located. Each
element may be a relative or absolute path. If absolute, it is used
as is. If relative, it is searched for on the classpath.</description>
</property>
--
Here's SearchApp.java:
import org.apache.hadoop.conf.Configuration;
import java.io.IOException;
import org.apache.nutch.searcher.Hit;
import org.apache.nutch.searcher.HitDetails;
import org.apache.nutch.searcher.Hits;
import org.apache.nutch.searcher.NutchBean;
import org.apache.nutch.searcher.Query;
public class SearchApp {
private static final int NUM_HITS = 10;
public static void main(String[] args)
throws IOException {
if (args.length == 0) {
String usage = "Usage: SearchApp query";
System.err.println(usage);
System.exit(-1);
}
Configuration conf = new Configuration();
NutchBean bean = new NutchBean(conf);
Query query = Query.parse(args[0], conf);
query.addRequiredTerm(args[0]);
Hits hits = bean.search(query, NUM_HITS);
for (int i = 0; i < hits.getLength(); i++) {
Hit hit = hits.getHit(i);
HitDetails details = bean.getDetails(hit);
String title = details.getValue("title");
String url = details.getValue("url");
String summary =
bean.getSummary(details, query).toString();
System.out.print(title);
System.out.print(" (");
System.out.print(url);
System.out.println(")");
System.out.println("\t" + summary);
}
}
}
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell.
http://searchmarketing.yahoo.com/-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Nutch-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nutch-general