问题原因是WebSphare下,servletContext.getContextPath()获取到的值为“/”而非空字符串。
在/portal-master/portal-impl/src/com/liferay/portal/spring/context/PortalContextLoaderListener.java文件中有如下代码:
if (ServerDetector.isWebSphere() &&_portalServletContextPath.isEmpty()) { _portalServlerContextName = StringPool.BLANK; }
修改为:
if (ServerDetector.isWebSphere() &&(_portalServletContextPath.isEmpty() || _portalServletContextPath.equals(StringPool.SLASH))) { _portalServletContextPath = StringPool.BLANK; _portalServlerContextName = StringPool.BLANK; }
本文解决了一个在WebSphere环境下,servletContext.getContextPath()方法返回不正确路径的问题。通过修改PortalContextLoaderListener.java文件中的代码,确保了在WebSphere服务器上该方法能正确返回空字符串,而不是'/'。

被折叠的 条评论
为什么被折叠?



