Liferay 7.1.3 GA4 自定义 Portlet 与番石榴依赖于部署:灾难性初始化失败! TypeNotPresentExceptionProxy

Posted

技术标签:

【中文标题】Liferay 7.1.3 GA4 自定义 Portlet 与番石榴依赖于部署:灾难性初始化失败! TypeNotPresentExceptionProxy【英文标题】:Liferay 7.1.3 GA4 Custom Portlet wit guava dependency on deploy: Catastrophic initialization failure! TypeNotPresentExceptionProxy 【发布时间】:2021-10-13 11:29:21 【问题描述】:

我试图使用来自 Guava 依赖项的 MD5:

<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>30.1.1-jre</version>
</dependency>

但是当我部署 porlet 时,我收到了以下错误:

java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
        at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
        at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
        at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
        at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
        at java.lang.Class.createAnnotationData(Class.java:3521)
        at java.lang.Class.annotationData(Class.java:3510)
        at java.lang.Class.getAnnotation(Class.java:3415)
        at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.processServletContainerInitializerClass(WabBundleProcessor.java:729)
        at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.initServletContainerInitializers(WabBundleProcessor.java:623)
        at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:161)
        at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer._initWabBundle(WebBundleDeployer.java:184)
        at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer.doStart(WebBundleDeployer.java:106)
        at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory$WABExtension.start(WabFactory.java:175)
        at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)
        at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)
        at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488)
        at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
        at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
        at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:230)
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:137)
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:129)
        at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:191)
        at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
        at org.eclipse.osgi.container.Module.start(Module.java:467)
        at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
        at org.eclipse.osgi.container.ModuleContainer.start(ModuleContainer.java:777)
        at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:768)
        at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:538)
        at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:484)
        at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:1028)
        at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1409)
        at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.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)

为了解决这个问题,我删除了 guava 依赖并使用 Apache Commons 的 MD5。

希望这会对某人有所帮助:)

【问题讨论】:

感谢分享!如果您将解决方案作为答案而不是作为问题的一部分发布会更好,因此对其他人来说更清楚。当您提出问题时,应该有一个“回答您自己的问题”复选框用于此目的。 是的,你是对的。也许解决方案是删除解决方案部分并添加答案@TylerTian 【参考方案1】:

为了解决这个问题,我删除了 guava 依赖并使用 Apache Commons 的 MD5。

似乎这种类型的错误有时来自 maven pom.xlm 的依赖项: https://issues.liferay.com/browse/LPS-69679

希望这会对某人有所帮助:)

【讨论】:

以上是关于Liferay 7.1.3 GA4 自定义 Portlet 与番石榴依赖于部署:灾难性初始化失败! TypeNotPresentExceptionProxy的主要内容,如果未能解决你的问题,请参考以下文章

Liferay-删除控制面板菜单

如何在 Liferay DXP 中添加语言图标

Liferay,来自搜索的 Freemarker 错误模板,但不是来自其他链接

如何使用管理员 Liferay 将我的自定义 portlet 拖/添加到 liferay 页面?

Liferay 7.2 自定义文档和媒体 Portlet

在 liferay 6.2 中自定义停靠栏