[ 
https://issues.apache.org/jira/browse/TIKA-2987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16977564#comment-16977564
 ] 

Bob Paulin commented on TIKA-2987:
----------------------------------

I happened to have the source of your project on my pc from a evaluation I was 
doing last month.  This is a cool add to the Sling project.  I see 2 issues 
when I run the build off of master.  The first is that the tika-bundle appears 
to be at 1.21 while tika-core and tika-parsers are at 1.22.  These versions 
should match so upgrade your tika-bundle to 1.22.  The second is that 
tika-parsers is included with tika-bundle.  The tika-bundle embeds tika-parsers 
and exports it's packages so you'll have 2 bundles exporting the same packages. 
 The error occurs when tika-core is searching for imports it might find the 
tika-parsers instead of tika-bundle.  Since tika-parsers does not have the 
dependencies embedded and tika-bundle does not export the dependency package 
the class is not found.  This also explains why your approach to bundling the 
metadata-extractor did not work.  The tika-parsers include is probably a hold 
over from sling.  It might be a good idea to see if we can get sling to use the 
bundle or you could look at excluding tika-parsers from your project.   When I 
remove tika-parsers from the osgi runtime the class is found successfully:

 
{code:java}
19.11.2019 09:19:27.684 *INFO* [oak-executor-68] 
org.apache.sling.cms.core.internal.FileMetadataExtractorImpl Extracting 
metadata from /static/DJI_0032.JPG
19.11.2019 09:19:28.429 *INFO* [oak-executor-68] 
org.apache.sling.cms.core.internal.FileMetadataExtractorImpl Metadata extracted 
from /static/DJI_0032.JPG
19.11.2019 09:19:28.432 *INFO* [oak-executor-64] 
org.apache.sling.cms.core.internal.FileMetadataExtractorImpl Extracting 
metadata from /static/DJI_0032.JPG
19.11.2019 09:19:28.518 *INFO* [oak-executor-64] 
org.apache.sling.cms.core.internal.FileMetadataExtractorImpl Metadata extracted 
from /static/DJI_0032.JPG
19.11.2019 09:19:33.582 *INFO* [oak-executor-68] 
org.apache.sling.cms.core.internal.FileMetadataExtractorImpl Extracting 
metadata from /static/DJI_0032.JPG
19.11.2019 09:19:33.663 *INFO* [oak-executor-68] 
org.apache.sling.cms.core.internal.FileMetadataExtractorImpl Metadata extracted 
from /static/DJI_0032.JPG {code}

> Extracting Metadata from JPEG Fails with Tika Bundle
> ----------------------------------------------------
>
>                 Key: TIKA-2987
>                 URL: https://issues.apache.org/jira/browse/TIKA-2987
>             Project: Tika
>          Issue Type: New Feature
>    Affects Versions: 1.21
>            Reporter: Dan Klco
>            Priority: Major
>
> When attempting to extract metadata from a JPEG image with Tika OSGi Bundle, 
> it fails with the following exception:
> {code:java}
> 18.11.2019 14:57:26.000 *ERROR* [oak-executor-37] 
> org.apache.jackrabbit.oak.plugins.observation.FilteringDispatcher Uncaught 
> exception in 
> org.apache.jackrabbit.oak.plugins.observation.FilteringDispatcher@139d97c618.11.2019
>  14:57:26.000 *ERROR* [oak-executor-37] 
> org.apache.jackrabbit.oak.plugins.observation.FilteringDispatcher Uncaught 
> exception in 
> org.apache.jackrabbit.oak.plugins.observation.filteringdispatc...@139d97c6java.lang.NoClassDefFoundError:
>  com/drew/imaging/jpeg/JpegProcessingException at 
> org.apache.tika.parser.jpeg.JpegParser.parse(JpegParser.java:58) at 
> org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) 
> [org.apache.tika.core:1.22.0] at 
> org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) 
> [org.apache.tika.core:1.22.0] at 
> org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280) 
> [org.apache.tika.core:1.22.0] at 
> org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:143) 
> [org.apache.tika.core:1.22.0] at 
> org.apache.sling.cms.core.internal.FileMetadataExtractorImpl.extractMetadata(FileMetadataExtractorImpl.java:148)
>  [org.apache.sling.cms.core:0.12.1.SNAPSHOT] at 
> org.apache.sling.cms.core.internal.FileMetadataExtractorImpl.updateMetadata(FileMetadataExtractorImpl.java:123)
>  [org.apache.sling.cms.core:0.12.1.SNAPSHOT] at 
> org.apache.sling.cms.core.internal.listeners.FileMetadataExtractorListener.handleChange(FileMetadataExtractorListener.java:59)
>  [org.apache.sling.cms.core:0.12.1.SNAPSHOT] at 
> org.apache.sling.cms.core.internal.listeners.FileMetadataExtractorListener.onChange(FileMetadataExtractorListener.java:74)
>  [org.apache.sling.cms.core:0.12.1.SNAPSHOT] at 
> org.apache.sling.resourceresolver.impl.observation.BasicObservationReporter.reportChanges(BasicObservationReporter.java:211)
>  [org.apache.sling.resourceresolver:1.6.14] at 
> org.apache.sling.jcr.resource.internal.JcrResourceListener.onEvent(JcrResourceListener.java:155)
>  [org.apache.sling.jcr.resource:3.0.18] at 
> org.apache.jackrabbit.commons.observation.ListenerTracker$1.onEvent(ListenerTracker.java:190)
>  [org.apache.jackrabbit.jackrabbit-jcr-commons:2.18.2] at 
> org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor.contentChanged(ChangeProcessor.java:513)
>  [org.apache.jackrabbit.oak-jcr:1.16.0] at 
> org.apache.jackrabbit.oak.plugins.observation.FilteringDispatcher.contentChanged(FilteringDispatcher.java:52)
>  [org.apache.jackrabbit.oak-core:1.16.0] at 
> org.apache.jackrabbit.oak.spi.commit.BackgroundObserver$1$1.call(BackgroundObserver.java:127)
>  [org.apache.jackrabbit.oak-store-spi:1.16.0] at 
> org.apache.jackrabbit.oak.spi.commit.BackgroundObserver$1$1.call(BackgroundObserver.java:121)
>  [org.apache.jackrabbit.oak-store-spi:1.16.0] at 
> java.util.concurrent.FutureTask.run(FutureTask.java:266) at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>  at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>  at java.lang.Thread.run(Thread.java:748)Caused by: 
> java.lang.ClassNotFoundException: 
> com.drew.imaging.jpeg.JpegProcessingException not found by 
> org.apache.tika.parsers [67] at 
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1597)
>  at 
> org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
>  at 
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1982)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 20 common 
> frames omitted
> {code}
> It seems to have something to do with the way the Drew Noakes MetadaExtractor 
> is embedded into the Tika Bundle. I have tried supplying the metadata 
> extractor as a separate bundle, even including the Adobe XMP Core inline and 
> Tika does fails with the same issue.
> You can reproduce the issue in the [Apache Sling 
> CMS|[https://github.com/apache/sling-org-apache-sling-app-cms]] by starting 
> the app, uploading a JPEG file and seeing the log at sling/logs/error.log



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to