Unfortunately, just adding these two libraries (see previous post) did
not do the trick. Tika uses a lot of other libraries (for extraction
from PDF files, etc.) and classes from the latter libraries are not
found due to the class loader configuration.

What did work for me is to add the following line somewhere in the
startup code (in the servlet context listener in my case):

 
Parser.class.isAssignableFrom(Class.forName("org.apache.tika.parser.asm.ClassParser"));

Without this,

      final Iterator<Parser> it =
ServiceRegistry.lookupProviders(org.apache.tika.parser.Parser.class);
      while (it.hasNext())
      {
        System.err.println(it.next().getClass());
      }

produces no results; with the above line, I see all parsers from Tika.
(ClassParser is one such parser. It was not enough to simply define a
ClassParser instance "ClassParser dummy".)

Kaspar

On Aug 13, 2:48 pm, hbf <[email protected]> wrote:
> I added the two libraries to the "Classpath" tab (under "Bootstrap
> Entries") and this works like a charm!
>
> Thanks for your help, cokol and Thomas!
> Kaspar
>
> On Aug 13, 12:40 pm, cokol <[email protected]> wrote:
>
>
>
> > hi, when you put something into WEB-INF/lib folder, the library is
> > loaded to the classpath of the servlet container regardless if its on
> > eclipse classpath or not. if you dont want to roll out the library
> > with the war file or it resides somewhere else than WEB-INF/lib - you
> > can still add the jar to eclipse classpath manually, so just do it.
>
> > you can also put this special jar on servlet container's classpath
> > when starting it, do it from a context menu on the root project ->
> > Run... -> Run As... then ensure "Google Web Toolkit" is selected on
> > the right menu and choose the "Classpath" tab on the right window
> > panel, then add the jar there manually and click "Run"
>
> > On 13 Aug., 12:00, hbf <[email protected]> wrote:
>
> > > Hi everybody,
>
> > > I am using the Apache Tika libraries [1] in my GWT project. All JUnit
> > > test pass fine but in hosted mode, Tika does not find any parsers.
> > > I've checked the source and see that they use the ServiceRegistry [2]
> > > to find parsers, and in hosted mode, none are found.
>
> > > When I put the Tika JARs into project/war/WEB-INF/lib/, Tika finds all
> > > parsers in hosted mode, but I am not so happy with this as I am using
> > > Maven to manage dependencies (and mvn eclipse:eclipse together with
> > > the GWT Eclipse Plugin).
>
> > > Tika offers me to pass a class loader to the ServiceRegistry. Is there
> > > a way I can find a suitable class loader?
> > > I have tried Thread.currentThread().getContextClassLoader() (the
> > > standard one) and its parent without success.
>
> > > Any ideas?
>
> > > Thanks in advance,
> > > Kaspar
>
> > > [1]http://tika.apache.org/download.html, version 0.8-SNAPSHOT
> > > [2]http://download.oracle.com/javase/1.4.2/docs/api/javax/imageio/spi/Se...

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to