我在OpenXava 4.6中创建了一个portlet。但是在Liferay 6.1.1 CE GA下部署后它无法正常运行。
这些是问题:
a。)Liferay 6.1无法识别由OX 4.5.1和4.6创建的web.xml
15:23:28,665 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:182] Processing <..>.war. This is attempt 2.
15:23:28,673 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][PortletAutoDeployListener:77] Copying portlets for ../liferay-portal-6.1.1-ce-ga2/deploy/<..>.war
15:23:28,676 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][BaseDeployer:1674] ../liferay-portal-6.1.1-ce-ga2/deploy/<..>.war does not have a WEB-INF/liferay-plugin-package.xml or WEB-INF/liferay-plugin-package.properties
15:23:28,677 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][BaseDeployer:763] Deploying <..>.war
15:23:33,110 ERROR [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:210] com.liferay.portal.kernel.deploy.auto.AutoDeployException: com.liferay.portal.kernel.deploy.auto.AutoDeployException: web.xml must be updated to the Servlet 2.4 specification
b。)web.xml文件需要有这个标题:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id=".." version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
<http://java.sun.com/xml/ns/j2ee%5C>" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance\
<http://www.w3.org/2001/XMLSchema-instance%5C>"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\
<http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd%5C>">
<display-name>...</display-name>
...
c。)即使按照上面的方法修改了“web.xml”文件(并创建了一个新的WAR文件),Liferay也可以加载portlet,它出现在可用的portlet列表中。但是portlet不起作用:
15:35:01,457 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][PortletAutoDeployListener:87] Portlets for ../liferay-portal-6.1.1-ce-ga2/deploy/<..>.war copied successfully. Deployment will start in a few seconds.
15:35:04,651 INFO [pool-2-thread-2][HotDeployImpl:178] Deploying <..> from queue
15:35:04,653 INFO [pool-2-thread-2][PluginPackageUtil:1033] Reading plugin package for <..>
15:35:04,653 WARN [pool-2-thread-2][PluginPackageUtil:1131] Plugin package on context <..> cannot be tracked because this WAR does not contain a liferay-plugin-package.xml file
d。)我手动将文件“liferay-plugin-package.xml”添加到WAR文件中,但Liferay仍然没有正确显示portlet。
欢迎任何建议。感谢。
答案 0 :(得分:1)
听起来你并没有使用Liferay IDE来创建portlet,我建议你这样做,因为它真的有助于开发! (Liferay IDE Installation Guide&amp; Liferay IDE Getting Started Guide)
注意,您需要在portlet docroot中包含liferay-plugin-package。属性,liferay-portlet.xml,portlet.xml,liferay-display.xml和web.xml。 / WEB-INF文件夹。
每个文件的内容应类似:
<强>的web.xml 强>
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>my-portlet</display-name>
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri>
<taglib-location>
/WEB-INF/tld/liferay-portlet.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://liferay.com/tld/aui</taglib-uri>
<taglib-location>/WEB-INF/tld/aui.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>
<强>的liferay-display.xml 强>
<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.1.0//EN" "http://www.liferay.com/dtd/liferay-display_6_1_0.dtd">
<display>
<category name="category.sample">
<portlet id="my-portlet" />
</category>
</display>
<强> liferay-plugin-package.properties 强>
name=My Portlet
module-group-id=liferay
module-incremental-version=1
tags=
short-description=
change-log=
page-url=http://www.liferay.com
author=Liferay, Inc.
licenses=LGPL
liferay-versions=6.1.1
<强>的liferay-portlet.xml中强>
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.1.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_1_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>my-portlet</portlet-name>
<icon>/icon.png</icon>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>my-portlet</css-class-wrapper>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>
答案 1 :(得分:1)
OpenXava尚不支持Liferay 6.1,我们将为未来的OX版本添加Liferay 6.1支持。
然而,一些OX用户已经在Liferay 6.1上实现了部署OX应用程序,只是更新了web.xml,看看OpenXava论坛中的下一个线程:
https://sourceforge.net/p/openxava/discussion/419690/thread/79695196/
https://sourceforge.net/p/openxava/discussion/419690/thread/da118e74/
所以,我认为你的问题d)与其他问题有关。 你有没有将jta.jar和ejb.jar复制到Liferay的lib文件夹中? 你能把堆栈跟踪产生到这里吗?