Plugin Deployment Troubleshooting
Table of Contents [-]
- Unable to process deployment descriptor for context 'null'
- The WAR disappears but it's not available to the portal
- ERROR [portal-web.docroot.html.portal.render_portlet.jsp] java.lang.NullPointerException
- Absolute vs. Relative Path
- “Incorrect zip format” exception
- Log shows that the portlet was copied, but it doesn't appear in the list
- NullPointerException from Log4j
- BeanLocator is not set
- See Also
The purpose of this article is to document the typical errors that are often found when deploying themes, layout templates and portlets to Liferay.
Unable to process deployment descriptor for context 'null' #
Check that you've deployed the WAR file to Liferay's autodeploy directory and not to the deploy directory of the application server directly.
By default Liferay's autodeploy directory will be in: $USER_HOME/liferay/deploy (assuming 'your-user' is the name of the user that runs Liferay). $USER_HOME is /home/your-user in UNIX based systems such as Linux and MacOS and c:\Document and Settings\your-user in Windows.
You can change the directory in Plugin Installer portlet -> Configuration (version 4.3), Admin porttlet (4.1, 3.6. etc.) or in portal-ext.properties file.
It is absolutely essential that the paths are correct, you have access to them and that you deploy (copy the war) into the Deploy Directory, not into Destination Directory .
The WAR disappears but it's not available to the portal #
This means that there has been an error during the deployment process. The WAR is removed so that Liferay does not get into a loop trying to deploy it again and again.
To find out which was the error take a look at the logs of the application server. On Jboss logs could be found at server/default/log/server.log
ERROR [portal-web.docroot.html.portal.render_portlet.jsp] java.lang.NullPointerException #
You can get an exception like this:
ERROR [portal-web.docroot.html.portal.render_portlet.jsp] java.lang.NullPointerException
at com.liferay.portlet.CachePortlet._invoke(CachePortlet.java:289) at com.liferay.portlet.CachePortlet.render(CachePortlet.java:153) at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:674) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
It happens if you try to deploy the portlet, and it is not fully deployed before you update the page that contains that portlet. To avoid that you need to fully deploy portlet before updating the page. You can observe the deployment process in the logs or just give it some time, one minute is usually sufficient. To get rid of the error you need to rebuild your war and deploy it again.
Absolute vs. Relative Path #
By default the Destination Directory is ../server/default/deploy which is a relative path. It starts from your /bin folder in JBoss/Tomcat where the startup script is located. If you want to start it from some other place you need to use absolute path instead of relative.
“Incorrect zip format” exception #
Sometimes liferay starts deployment before the file is fully copied. You would get “Incorrect zip format” exception. You just need to update the timestamp on the war or rebuild it and deploy again to fix this problem. It might only apply to older versions of Liferay 4.1 and older.
Log shows that the portlet was copied, but it doesn't appear in the list #
You get something like:
14:07:32,029 INFO [STDOUT] 14:07:32,028 INFO [AutoDeployDir:76] Processing sample-test-portlet-126.96.36.199.war 14:07:32,029 INFO [STDOUT] 14:07:32,029 INFO [PortletAutoDeployListener:77] Copying portlets for /home/jboss/liferay/deploy/sample-test-portlet-188.8.131.52.war 14:07:32,031 INFO [STDOUT] 14:07:32,030 INFO [BaseDeployer:482] Deploying sample-test-portlet-184.108.40.206.war 14:07:32,034 INFO [STDOUT] Expanding: /home/jboss/liferay/deploy/sample-test-portlet-220.127.116.11.war into /tmp/20071029140732032 14:07:32,052 INFO [STDOUT] Copying 1 file to /tmp/20071029140732032/WEB-INF 14:07:32,105 INFO [STDOUT] Copying 1 file to /tmp/20071029140732032/WEB-INF 14:07:32,133 INFO [STDOUT] 14:07:32,132 INFO [BaseDeployer:992] Modifying Geronimo /tmp/20071029140732032/WEB-INF/geronimo-web.xml 14:07:32,151 INFO [STDOUT] 14:07:32,150 INFO [BaseDeployer:1038] Modifying Servlet 2.3 /tmp/20071029140732032/WEB-INF/web.xml 14:07:32,168 INFO [STDOUT] Copying 22 files to /opt/jboss-4.2.1.GA/bin/../server/default/deploy/sample-test-portlet.war 14:07:32,181 INFO [STDOUT] Copying 1 file to /opt/jboss-4.2.1.GA/bin/../server/default/deploy/sample-test-portlet.war 14:07:32,181 INFO [STDOUT] Deleting directory /tmp/20071029140732032 14:07:32,184 INFO [STDOUT] 14:07:32,183 INFO [PortletAutoDeployListener:87] Portlets for /home/jboss/liferay/deploy/sample-test-portlet-18.104.22.168.war copied successfully
you don't see the portlet appearing in the list of available portlets after that. It doesn't mean that the portlets were deployed, it means something went wrong. Most likely it is this path: /opt/jboss-4.2.1.GA/bin/../server/default/deploy/ that is wrong. It is relative and could be referencing incorrect path, change the Destination Path to absolute and it should deploy without problems. You would see something like this when deploying:
17:22:33,765 INFO [AutoDeployDir] Processing sample-portal-client-portlet-22.214.171.124.war 17:22:33,765 INFO [PortletAutoDeployListener] Copying portlets for C:\jboss\autodeploy\sample-portal-client-portlet-126.96.36.199.war 17:22:33,765 INFO [BaseDeployer] Deploying sample-portal-client-portlet-188.8.131.52.war 17:22:33,859 INFO [STDOUT] Expanding: C:\jboss\autodeploy\sample-portal-client-portlet-184.108.40.206.war into C:\DOCUME~1\rhoyenko\LOCALS~1\Temp\20071030172233765 17:22:34,156 INFO [STDOUT] Copying 1 file to C:\DOCUME~1\rhoyenko\LOCALS~1\Temp\20071030172233765\WEB-INF 17:22:34,468 INFO [STDOUT] Copying 1 file to C:\DOCUME~1\rhoyenko\LOCALS~1\Temp\20071030172233765\WEB-INF 17:22:35,125 INFO [BaseDeployer] Modifying Geronimo C:\DOCUME~1\rhoyenko\LOCALS~1\Temp\20071030172233765\WEB-INF\geronimo-web.xml 17:22:35,219 INFO [BaseDeployer] Modifying Servlet 2.3 C:\DOCUME~1\rhoyenko\LOCALS~1\Temp\20071030172233765\WEB-INF\web.xml 17:22:35,297 INFO [STDOUT] Copying 21 files to C:\jboss\server\default\deploy\sample-portal-client-portlet.war 17:22:35,500 INFO [STDOUT] Copying 1 file to C:\jboss\server\default\deploy\sample-portal-client-portlet.war 17:22:35,515 INFO [STDOUT] Deleting directory C:\DOCUME~1\rhoyenko\LOCALS~1\Temp\20071030172233765 17:22:35,578 INFO [PortletAutoDeployListener] Portlets for C:\jboss\autodeploy\sample-portal-client-portlet-220.127.116.11.war copied successfully 17:22:36,750 INFO [TomcatDeployer] deploy, ctxPath=/sample-portal-client-portlet, warUrl=.../deploy/sample-portal-client-portlet.war/ 17:22:37,141 INFO [PluginPackageHotDeployListener] Reading plugin package for sample-portal-client-portlet 17:22:37,547 INFO [PluginPackageHotDeployListener] Plugin package liferay/sample-portal-client-portlet/18.104.22.168/war registered successfully 17:22:37,562 INFO [PortletHotDeployListener] Registering portlets for sample-portal-client-portlet 17:22:37,625 INFO [PortletHotDeployListener] Portlets for sample-portal-client-portlet registered successfully
NullPointerException from Log4j #
This is caused by what seems to be a bug in Tomcat. It's been notified by the Log4j developers to the Tomcat developers but for some reason it's not being fixed.
Fortunately there is a workaround. Run Tomcat with the following option:
This will be the default option in bundles from version 5.1
BeanLocator is not set #
This error appears when the plugin uses ServiceBuilder and Spring has not been initialized correctly. Make sure the web.xml file of the plugin has a similar code to:
<context-param> <param-name>contextClass</param-name> <param-value>com.liferay.portal.spring.context.PortletApplicationContext</param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value>WEB-INF/classes/META-INF/data-source-spring.xml,WEB-INF/classes/META-INF/portlet-spring.xml,WEB-INF/classes/META-INF/ext-spring.xml</param-value> </context-param> <listener> <listener-class>com.liferay.portal.kernel.spring.context.PortletContextLoaderListener</listener-class> </listener>