简体   繁体   English

2个具有相同名称的类在WebSphere Portal的Portlet中的不同jar中

[英]2 classes with same name in different jar's in portlet for WebSphere portal

I am working on a portlet project and came across a problem with 2 classes with same name (including packages) in different .jar files. 我正在研究一个portlet项目,并且在不同的.jar文件中遇到了两个同名类(包括包)的问题。 I have com.ibm.ws.webcontainer.jar as a default WebSphere library and jsf-impl.jar which is necessary for some JSF features. 我将com.ibm.ws.webcontainer.jar作为默认的WebSphere库,并将jsf-impl.jar作为某些JSF功能所必需的。
The problem comes out when PortletFacesContextFactoryImpl class (another JSF class) tries to get access to com.sun.faces.util.Util.parameterNonNull(Object arg) method and I get NoSuchMethodError . PortletFacesContextFactoryImpl类(另一个JSF类)尝试获取对com.sun.faces.util.Util.parameterNonNull(Object arg)方法的访问PortletFacesContextFactoryImpl出现了问题,并且出现了NoSuchMethodError
I tried setting classloader policy to PARENT_LAST, this doesn't help. 我尝试将类加载器策略设置为PARENT_LAST,这没有帮助。 I can't remove com.ibm.ws.webcontainer.jar from the server, but when I try to use Util class in my code, the only option is the class from it, not from jsf-impl.jar . 我无法从服务器中删除com.ibm.ws.webcontainer.jar ,但是当我尝试在我的代码中使用Util类时,唯一的选择是从其中的类,而不是jsf-impl.jar jsf-impl.jar is included into Java Build Path. jsf-impl.jar包含在Java构建路径中。

How can this problem be solved since I cannot alter PortletFacesContextFactoryImpl source and move .jar with wrong class? 由于无法更改PortletFacesContextFactoryImpl源和使用错误的类移动.jar,如何解决此问题?

Parent Last should be your solution. 上一个父母应该是您的解决方案。 WebSphere Portal deploys portlet application with Parent Last as default, but it does not hurt to double check it at the WebSphere Application Server Integrated Solutions Console (Admin Console) > WebSphere Portal部署portlet应用程序时默认使用Parent Last,但是在WebSphere Application Server集成解决方案控制台(管理控制台)>再次检查它不会有任何问题。

However, it also depends on your portlet application setup. 但是,这还取决于您的Portlet应用程序设置。 I assume it is com.sun.faces.util.Util which is troubling you. 我以为是com.sun.faces.util.Util困扰着您。 On my system, this class is located in jsf-impl.jar and the Application Server Web Container . 在我的系统上,此类位于jsf-impl.jar和Application Server Web容器中 In order to get it to work, jsf-impl.jar needs to be placed in the WEB-INF/lib directory of your portlet application. 为了使其正常工作,需要将jsf-impl.jar放置在portlet应用程序的WEB-INF/lib目录中。 To verify that, use the Class Loader View of WAS: Admin Console > Troubleshooting > Class loader viewer > WebSphere_Portal > Applications and then the your portlet application. 要验证这一点,请使用WAS的类加载器视图:管理控制台>故障排除>类加载器查看器> WebSphere_Portal>应用程序,然后使用您的Portlet应用程序。 It must start with PA. 它必须以PA开头。 Switch to the table view and search for the class. 切换到表格视图并搜索类。

You also mentioned the Java Build Path . 您还提到了Java Build Path This is another topic and depends on your IDE - assumingly Eclipse. 这是另一个主题,取决于您的IDE-可能是Eclipse。 Check the Order and Export tab, jsf-impl.jar should be placed at the top, so that it overrules the server runtime classpath entries. 检查“ 订购和出口”选项卡,应将jsf-impl.jar放在顶部,以便它覆盖服务器运行时类路径条目。

PARENT_LAST classpath setting will help you. PARENT_LAST类路径设置将为您提供帮助。 However, for this setting to be done, your portlet muste be packaged as a EAR. 但是,要完成此设置,您的portlet muste必须打包为EAR。 If your portlet is packaged as a war and you configure the classpath settings manually, they get erased everytime you deploy the portlet. 如果您将portlet打包打包,并且您手动配置了classpath设置,则每次部署该Portlet时,它们都会被删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用于 WebSphere Portal 7 的 IBM Script Portlet - IBM Script Portlet for WebSphere Portal 7 将Portlet部署自动化到WebSphere Portal Server 6.1 - Automating Portlet Deployment to WebSphere Portal Server 6.1 Websphere Portal中的Spring Web MVC Portlet - Spring web mvc portlet in websphere portal Websphere Portal中的Spring MVC Portlet重用 - Spring MVC Portlet reuse in Websphere Portal 从WebSphere Portal重新建立除去的portlet - Reestablish the removed portlet from WebSphere Portal 如何在Websphere Portal上从Struts portlet显示Excel内容 - How to display Excel content from Struts portlet on Websphere Portal 在Websphere Portal 8.5上的JSR286 Portlet中读取URL参数 - Reading URL parameters in a JSR286 portlet on Websphere Portal 8.5 在WebSphere Portal Portlet中获取响应表单定制@proceesAction - Getting response form custom @proceesAction in WebSphere Portal Portlet 我在不同的jar中有两个具有相同名称和相同包结构的类。 是否可以从jar中专门选择一个类? - I have two classes with same name and same package structure in different jars. Is it possbile to choose a class from jar specifically? WebSphere Portal 8.5-Portlet应用程序-Error.jsp的服务方法抛出NullPointerException - WebSphere Portal 8.5 - Portlet app - NullPointerException thrown by service method of Error.jsp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM