1

我正在努力解决一个问题(使用 Gradle 的 Java/Scala Web 项目),因为我必须将 apache tika 版本从 1.19.1升级到至少版本1.22 (以前的版本存在安全漏洞)。但是当我尝试更改版本(甚至更低版本)时,我收到一个异常

org.osgi.framework.BundleException: The activator org.apache.tika.config.TikaActivator for bundle org.apache.tika.core is invalid
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:172)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:679)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
    at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
    at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.lang.ClassCastException: org.apache.tika.config.TikaActivator cannot be cast to org.osgi.framework.BundleActivator
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:167)
    ... 12 common frames omitted

我没有使用任何配置文件,我只升级了库(库内抛出了异常,我在堆栈跟踪中没有参考我的代码)。tika 依赖版本不同,主要关注 org.osgi:org.osgi.core 从 4.0.0 升级到 6.0.0。我在 gradle 中强制在项目中使用 4.0.0 版本,但我收到错误,找不到org.osgi.framework.BundleActivator类。根据文档,类之间的区别是附加注释@ConsumerType。我认为这是造成问题的原因。有没有办法解决这个问题?

4

0 回答 0