You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@nutch.apache.org by Sznajder ForMailingList <bs...@gmail.com> on 2013/07/09 10:48:24 UTC

PluginRuntimeException: java.lang.ClassNotFoundException:

Hi

I wrote a plugin following the tutorial
http://wiki.apache.org/nutch/WritingPluginExample

However, when launching it via ant call, I get the following exception:

java.lang.RuntimeException: org.apache.nutch.plugin.PluginRuntimeException:
java.lang.ClassNotFoundException:


I had a look at the runtime/local/plugins/ directory, and I see there the
created directory corresponding to this plugin.

More strange, when I specifically add the created jar to the classpath, it
is running with no problem.

I do no understand why it doesn't it find the jar with the usal bin/nutch
script.....

Best regards

Benjamin

PS: When running from eclipse, it is running with no problem....

Re: PluginRuntimeException: java.lang.ClassNotFoundException:

Posted by Sznajder ForMailingList <bs...@gmail.com>.
Thanks!

But, strangely, it finds the external lib I defined in plugin.xml , but
does not find the jar corresponding to the plugin code itself...
And I need to add the plugin jar specifically in the classpath.

Benjamin


On Tue, Jul 9, 2013 at 4:17 PM, Canan GİRGİN <ca...@gmail.com> wrote:

> if you use an external library for your new plugin, you should define this
> library in plugins build.xml file.
> Example: urlfilter-automaton plugin uses external "automaton-1.11-8.jar"
> library. Its build.xml file is like:
>
> <plugin
>    id="urlfilter-automaton"
>    name="Automaton URL Filter"
>    version="1.0.0"
>    provider-name="nutch.org">
>
>    <runtime>
>       <library name="urlfilter-automaton.jar">
>          <export name="*"/>
>       </library>
>       <library name="automaton-1.11-8.jar"/>
>    </runtime>
>
>    <requires>
>       <import plugin="nutch-extensionpoints"/>
>       <import plugin="lib-regex-filter"/>
>    </requires>
>
>    <extension id="org.apache.nutch.net.urlfilter.automaton"
>               name="Nutch Automaton URL Filter"
>               point="org.apache.nutch.net.URLFilter">
>       <implementation id="AutomatonURLFilter"
>
> class="org.apache.nutch.urlfilter.automaton.AutomatonURLFilter"/>
>    </extension>
>
> </plugin>
>
>
> On Tue, Jul 9, 2013 at 12:28 PM, Sznajder ForMailingList <
> bs4mailinglist@gmail.com> wrote:
>
> > I copy here the correction in bin/nutch I made.
> >
> > But, I suspect that it is not the right way to force Nutch to find the
> > plugin jar...
> >
> >
> > # add libs to CLASSPATH
> > if $local; then
> >   for f in $NUTCH_HOME/lib/*.jar; do
> >    CLASSPATH=${CLASSPATH}:$f;
> >   done
> >   # local runtime
> >   # add plugins to classpath
> >   if [ -d "$NUTCH_HOME/plugins" ]; then
> >  *         for f in $NUTCH_HOME/plugins/*/*.jar; do
> >                CLASSPATH=${CLASSPATH}:$f;
> >            done
> > *     CLASSPATH=${NUTCH_HOME}:${CLASSPATH}
> >   fi
> > fi
> >
> >
> > On Tue, Jul 9, 2013 at 11:48 AM, Sznajder ForMailingList <
> > bs4mailinglist@gmail.com> wrote:
> >
> > > Hi
> > >
> > > I wrote a plugin following the tutorial
> > > http://wiki.apache.org/nutch/WritingPluginExample
> > >
> > > However, when launching it via ant call, I get the following exception:
> > >
> > > java.lang.RuntimeException:
> > > org.apache.nutch.plugin.PluginRuntimeException:
> > > java.lang.ClassNotFoundException:
> > >
> > >
> > > I had a look at the runtime/local/plugins/ directory, and I see there
> the
> > > created directory corresponding to this plugin.
> > >
> > > More strange, when I specifically add the created jar to the classpath,
> > it
> > > is running with no problem.
> > >
> > > I do no understand why it doesn't it find the jar with the usal
> bin/nutch
> > > script.....
> > >
> > > Best regards
> > >
> > > Benjamin
> > >
> > > PS: When running from eclipse, it is running with no problem....
> > >
> >
>

Re: PluginRuntimeException: java.lang.ClassNotFoundException:

Posted by Canan GİRGİN <ca...@gmail.com>.
if you use an external library for your new plugin, you should define this
library in plugins build.xml file.
Example: urlfilter-automaton plugin uses external "automaton-1.11-8.jar"
library. Its build.xml file is like:

<plugin
   id="urlfilter-automaton"
   name="Automaton URL Filter"
   version="1.0.0"
   provider-name="nutch.org">

   <runtime>
      <library name="urlfilter-automaton.jar">
         <export name="*"/>
      </library>
      <library name="automaton-1.11-8.jar"/>
   </runtime>

   <requires>
      <import plugin="nutch-extensionpoints"/>
      <import plugin="lib-regex-filter"/>
   </requires>

   <extension id="org.apache.nutch.net.urlfilter.automaton"
              name="Nutch Automaton URL Filter"
              point="org.apache.nutch.net.URLFilter">
      <implementation id="AutomatonURLFilter"

class="org.apache.nutch.urlfilter.automaton.AutomatonURLFilter"/>
   </extension>

</plugin>


On Tue, Jul 9, 2013 at 12:28 PM, Sznajder ForMailingList <
bs4mailinglist@gmail.com> wrote:

> I copy here the correction in bin/nutch I made.
>
> But, I suspect that it is not the right way to force Nutch to find the
> plugin jar...
>
>
> # add libs to CLASSPATH
> if $local; then
>   for f in $NUTCH_HOME/lib/*.jar; do
>    CLASSPATH=${CLASSPATH}:$f;
>   done
>   # local runtime
>   # add plugins to classpath
>   if [ -d "$NUTCH_HOME/plugins" ]; then
>  *         for f in $NUTCH_HOME/plugins/*/*.jar; do
>                CLASSPATH=${CLASSPATH}:$f;
>            done
> *     CLASSPATH=${NUTCH_HOME}:${CLASSPATH}
>   fi
> fi
>
>
> On Tue, Jul 9, 2013 at 11:48 AM, Sznajder ForMailingList <
> bs4mailinglist@gmail.com> wrote:
>
> > Hi
> >
> > I wrote a plugin following the tutorial
> > http://wiki.apache.org/nutch/WritingPluginExample
> >
> > However, when launching it via ant call, I get the following exception:
> >
> > java.lang.RuntimeException:
> > org.apache.nutch.plugin.PluginRuntimeException:
> > java.lang.ClassNotFoundException:
> >
> >
> > I had a look at the runtime/local/plugins/ directory, and I see there the
> > created directory corresponding to this plugin.
> >
> > More strange, when I specifically add the created jar to the classpath,
> it
> > is running with no problem.
> >
> > I do no understand why it doesn't it find the jar with the usal bin/nutch
> > script.....
> >
> > Best regards
> >
> > Benjamin
> >
> > PS: When running from eclipse, it is running with no problem....
> >
>

Re: PluginRuntimeException: java.lang.ClassNotFoundException:

Posted by Sznajder ForMailingList <bs...@gmail.com>.
I copy here the correction in bin/nutch I made.

But, I suspect that it is not the right way to force Nutch to find the
plugin jar...


# add libs to CLASSPATH
if $local; then
  for f in $NUTCH_HOME/lib/*.jar; do
   CLASSPATH=${CLASSPATH}:$f;
  done
  # local runtime
  # add plugins to classpath
  if [ -d "$NUTCH_HOME/plugins" ]; then
 *         for f in $NUTCH_HOME/plugins/*/*.jar; do
               CLASSPATH=${CLASSPATH}:$f;
           done
*     CLASSPATH=${NUTCH_HOME}:${CLASSPATH}
  fi
fi


On Tue, Jul 9, 2013 at 11:48 AM, Sznajder ForMailingList <
bs4mailinglist@gmail.com> wrote:

> Hi
>
> I wrote a plugin following the tutorial
> http://wiki.apache.org/nutch/WritingPluginExample
>
> However, when launching it via ant call, I get the following exception:
>
> java.lang.RuntimeException:
> org.apache.nutch.plugin.PluginRuntimeException:
> java.lang.ClassNotFoundException:
>
>
> I had a look at the runtime/local/plugins/ directory, and I see there the
> created directory corresponding to this plugin.
>
> More strange, when I specifically add the created jar to the classpath, it
> is running with no problem.
>
> I do no understand why it doesn't it find the jar with the usal bin/nutch
> script.....
>
> Best regards
>
> Benjamin
>
> PS: When running from eclipse, it is running with no problem....
>