gpt4 book ai didi

java - portlet.jar 上的类加载器冲突

转载 作者:行者123 更新时间:2023-11-28 22:42:57 25 4
gpt4 key购买 nike

我得到错误:

Caused by: java.lang.ClassCastException: com.xxx.JbossBirtPortlet cannot be cast to  javax.portlet.Portlet
at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:254)

错误是因为 tomcat 和我的 portlet 的类加载器冲突,根据这些链接加载文件 portlet.jar: https://community.jboss.org/thread/81246?tstart=0

Deploying a simple Portlet to Liferay - ClassCastException

然后是问题:我需要 portlet.jar 来构建我的 war,但我的 war 不能包含 portlet.jar,因为那样会出现 ClassLoader 冲突。我不能从 tomcat 中删除 portlet.jar,因为其他 portlet 需要它。

那么我该如何解决呢?

最佳答案

Then the problem: I need portlet.jar to build my war but my war must not contain portlet.jar, because then arises a ClassLoader conflict.I can not delete portlet.jar from tomcat, because it is needed to other portlets.

正确,如果应用服务器提供了这些类,则不应将它们包含在 WAR 中。

如果您使用的是 Maven,请将您对 portlet API 的依赖性标记为 <scope>provided</scope> .它在构建 WAR 时可用,但不会包含在 WAR 中。如果您不使用 Maven,RTFM 将介绍如何使用您的构建工具实现类似的功能。

关于java - portlet.jar 上的类加载器冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21141960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com