Excellent, thank you! It did clarify a bit - in particular now I know that
I'm not crazy and that this is indeed a somewhat common problem with a
solution. However, I'm still a little lost on the solution part of it :-).
If I understand correctly...
In the plugin manifest file I need to define the dependencies and they will
be added to the class-loader such that they will get used. However, I'm a
little shady on how to do that, in my plugin.xml file I have the following:
<runtime>
<library name="index-vulns.jar">
<export name="*"/>
</library>
<library name="commons-codec-1.6.jar"/>
<library name="commons-io-2.4.jar"/>
<library name="commons-logging-1.1.1.jar"/>
<library name="fluent-hc-4.2.5.jar.jar"/>
<library name="httpclient-4.2.5.jar"/>
<library name="httpclient-cache-4.2.5.jar"/>
<library name="httpcore-4.2.4.jar"/>
<library name="httpmime-4.2.5"/>
<library name="web3-scanner-1.0.jar"/>
</runtime>
If I understand properly this should be sufficient to have the jars added
to the plugin class-loader. However, that doesn't appear to be the case - I
must be missing something, but I'm not sure what that is...?
Alex
On Tue, Jul 23, 2013 at 11:30 PM, Lewis John Mcgibbney <
[email protected]> wrote:
> Hi Alex,
> About now is a good time to read how Nutch deals with classloading.
> Navigate to plugin central on the wiki and you will see the documentation.
> hth you out
> Lewis
>
> On Tuesday, July 23, 2013, AC Nutch <[email protected]> wrote:
> > Hi All,
> >
> > I'm attempting to build a Nutch plugin on Nutch 1.7 with some external
> > dependencies. The way I've handled this in the past is to just put the
> > dependencies in lib/ and be done with it. However, now I have some
> > dependencies that are newer versions of dependencies already present in
> > Nutch. For example, I'm using the Apache httpclient-4.2.5.jar library
> > whereas Nutch appears to use httpclient-4.1.2 and httpclient-4.1.3.
> > Unfortunately, I do need the plugin to compile and run with my version (I
> > can't just downgrade, not a valid solution).
> >
> > I've added the necessary jars to my plugin's ivy.xml and they download
> just
> > fine and the plugin compiles, which is wonderful. However, when I go to
> run
> > it (in local mode) I get "Exception in thread "main"
> > java.lang.NoClassDefFoundError:
> > org/apache/http/client/utils/URLEncodedUtils". Moving my own later
> versions
> > of the file to the ClassPath in runtime/local/lib/ gives me additional
> > issues - "Exception in thread "main" java.lang.NoSuchMethodError:
> > org.apache.http.client.utils.URLEncodedUtils.parse" which appears to be
> an
> > error caused by Nutch trying to use an older version of the httpclient
> > library (it disappears if I remove the "older" jars from the classpath).
> >
> > My question is - how would I go about adding these dependencies such that
> > my plugin would use these jars and I'm not having to remove libraries
> that
> > Nutch may need? I believe I'm missing a critical step here or a missing
> > directive in one of the plugin XML directive files... any ideas?
> >
> > Thanks!
> >
> > Alex
> >
>
> --
> *Lewis*
>