1
votes

I created a portlet in OpenXava 4.6. But it is not running properly once deployed under Liferay 6.1.1 CE GA.

These are the problems:

a.) The web.xml created by OX 4.5.1 and 4.6 is not recognized by Liferay 6.1

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.) The web.xml file needs to have this header:

<?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.) Even after modifying the "web.xml" file as per above (and creating a new WAR file) then Liferay is able to load the portlet, and it appears on the list of available portlets. BUT the portlet does not work:

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.) I manually added the file "liferay-plugin-package.xml" to the WAR file but Liferay still does not show the portlet properly.

Any suggestions welcome. Thanks.

2

2 Answers

1
votes

It doesn't sound like you're using the Liferay IDE to create portlets, I suggest that you do as it really helps development! (Liferay IDE Installation Guide & Liferay IDE Getting Started Guide)

As a note, you will need to include liferay-plugin-package.properties, liferay-portlet.xml, portlet.xml, liferay-display.xml and web.xml in your portlets docroot/WEB-INF folder.

Contents of each file should be similar to these:

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
votes

OpenXava does not support Liferay 6.1 yet, we'll add Liferay 6.1 support for future OX versions.

However, some OX users have achieve deploy OX application on Liferay 6.1 just updating the web.xml, hava a look at the next threads in OpenXava forums:

https://sourceforge.net/p/openxava/discussion/419690/thread/79695196/

https://sourceforge.net/p/openxava/discussion/419690/thread/da118e74/

So, I think that your problem d) is related to other issues. Have you copied jta.jar and ejb.jar to the lib folder of your Liferay? Can you put here the stacktrace produces where the portlet is displayed?