Deploy Spring Sample to Liferay 3.6.1/Tomcat
August 31, 2005 – 22:06 | java, springJust upgraded to Liferay Pro 3.6.1 (Tomcat 5.5.9). Smooth process as usual with just a couple minor points make a note of.
A couple folks seem to have some problem getting the Spring Portlet sample portlet content rendered. I just gave it a try and it appears to work fine with my installation. I guess you need to use Liferay's hot deploy script, and follow the steps listed in the Development guide. Copying the portlet directory into tomcat's webapps directory won't work because Liferay won't get a chance to do its own magic - like, make a little "adjustment" to your web.xml.
And here goes the latest version of the deployer script I used, in case you need it:
-
<project name="portlet-deployer" basedir="." default="deploy">
-
<target name="init">
-
<property environment="env" />
-
-
<!-- Tomcat -->
-
-
<property name="app.server.type" value="tomcat" />
-
<property name="app.server.dir" value="e:\tomcats\5.5.9-liferay" />
-
<property name="app.server.deploy.dir" value="${app.server.dir}/webapps" />
-
-
<path id="project.classpath">
-
<pathelement location="${env.ANT_HOME}/lib/ant.jar" />
-
<fileset dir="${app.server.dir}/shared/lib" />
-
<pathelement location="${app.server.dir}/common/lib/servlet-api.jar" />
-
</path>
-
</target>
-
-
<target name="deploy" depends="init">
-
<java classname="com.liferay.portal.tools.PortletDeployer"
-
classpathref="project.classpath"
-
fork="true"
-
newenvironment="true">
-
-
<!-- Required Arguments -->
-
-
<jvmarg value="-Ddeployer.base.dir=./" />
-
<jvmarg value="-Ddeployer.dest.dir=${app.server.deploy.dir}" />
-
<jvmarg value="-Ddeployer.app.server.type=${app.server.type}" />
-
<jvmarg value="-Ddeployer.portlet.taglib.dtd=${liferay.dir}/WEB-INF/tld/liferay-portlet.tld" />
-
-
<!-- Optional Arguments -->
-
-
<jvmarg value="-Ddeployer.jboss.prefix=1" />
-
<jvmarg value="-Ddeployer.tomcat.lib.dir=${app.server.dir}/shared/lib" />
-
-
<!-- Dependent Libraries -->
-
-
<arg value="${app.server.deploy.dir}/ext.ear/portal-web-complete.war/WEB-INF/lib/util-taglib.jar" />
-
<arg value="${app.server.deploy.dir}/ext.ear/lib/util-java.jar" />
-
<!--<arg value="${app.server.deploy.dir}/ext.ear/lib/util-jsf.jar" />-->
-
</java>
-
</target>
-
</project>
Here's one note to myself in the future - if you get something like this while running the hot deployer script:
-
[java] Deploying spring-portlet-sample.war
-
[java] Expanding: .\spring-portlet-sample.war into 20050831212239171
-
[java] Modifying 20050831212239171\WEB-INF\web.xml
-
[java] java.lang.NullPointerException
-
[java] at com.liferay.util.FileUtil.listFiles(FileUtil.java:245)
-
[java] at com.liferay.util.FileUtil.listFiles(FileUtil.java:237)
-
[java] at com.liferay.portal.tools.BaseDeployer.deployDirectory(BaseDeployer.java:229)
-
[java] at com.liferay.portal.tools.BaseDeployer.deployFile(BaseDeployer.java:272)
-
[java] at com.liferay.portal.tools.BaseDeployer.deploy(BaseDeployer.java:188)
-
[java] at com.liferay.portal.tools.BaseDeployer.<init>(BaseDeployer.java:81)
-
[java] at com.liferay.portal.tools.PortletDeployer.</init><init>(PortletDeployer.java:71)
-
[java] at com.liferay.portal.tools.PortletDeployer.main(PortletDeployer.java:63)
It's because the tomcat lib directory set in the script doesn't exist.

11 Responses to “Deploy Spring Sample to Liferay 3.6.1/Tomcat”
HI Jing Xue,
thanks for your advice, i've finally got it working!
i had to use the expert tomcat installation and hot-deploy the spring sample portlet by using the deployer script provided by liferay (of course modify it to work for tomcat as recommended by you).
i've also checked that the web.xml of the spring war is modified by the deploy script in a different way than that of liferay 3.2! that's why manually copying the war into the webapps didn't work.
the main difference is an additional set of servlet-mappings for each portlet (this was not needed in 3.2).
By Jose Choi on Sep 1, 2005
Hi Jing Xue and Jose Choi
Thank you for your extremely useful explaination.
I got it work successfully.
By Mike Tran on Sep 3, 2005
HI Jing Xue,
Can you help me? I am developing JSF Portlets and I'd like to ask you for a help of integrating JSF Portlets into Liferay Jboss-Tomcat. I create JSF Portlets by using Sun Java Studio Creator 2 Early Access.
Sorry if this message is not in the right place.
Thanks in advance,
Ronald
netsearcher2000@yahoo.com
By Ronald on Sep 7, 2005
All
Please tell me the stpes to deploy the my own portlet war in liferay3.6.1
Defining a listener class in web.xml for liferay com.liferay.portal.servlet.PortletContextListener
is this mandatory?
and two liferay xml files are they mandatory files to deploy the myown portlet war?
can any one help out
Thanks in advance
Malligarjunan
By Malligarjunan S on Nov 11, 2005
12.
Hi,
I have the Spring portlets fully working with Liferay. However, I now want to put them into a category of portlets in Liferay. e.g. Wiki
Have you ever tried such things ?
PS I once followed the instruction at http://opensource2.atlassian.com/confluence/spring/display/JSR168/Home but yet it does not work at all.
By Mike Tran on Dec 4, 2005
Mike,
I'm not sure I understand what you mean by "put them into a category of portlets".
--Jing
By Jing Xue on Dec 5, 2005
Hi,
The portlet categories I mentioned are the ones you could see in the "Content and Layout" function page. I realised this function is extremely useful when I am an admin and trying to configure pages for many user groups who are not Power Users (can not add portlets into theirs pages themselves).
Every Liferay has some builtin categories such as Community, Development, Wiki and so on.
If I want to put the sample portlet into one of them and even a new one that I could create. How could I do that ?
-Mike
By Mike Tran on Dec 8, 2005
Mike,
I've never tried to do that myself, but I've noticed a liferay-display.xml under liferay/WEB-INF that looks like defining the category-portlet relationship. I'm not sure that's supposed to be hand edited though.
Did you ask around on the liferay forum?
--Jing
By Jing Xue on Dec 8, 2005
Hi,
There are some posts relating to this issue. They did show some instructions to create liferay-display.xml and liferay-portlet.xml manually.
After trying all of them, the portlet still does not show up in my case. I saw some peoples achieved it and some are the same as me.
I posted my question and yet not get any answer. I thought you might have experienced this.
Would you like to try it ?
-Mike
By Mike Tran on Dec 8, 2005
Hi,
actually i am deploying the spring samples("Books portlet") on Liferay 4.1.1. The portlets appear in the list of portlets. I am also able to add the portlet "books" to the main page but i am getting the following error in the portlet content: The requested resource (/spring-samples/WEB-INF/servlet/view) is not available
Can anyone help me on this issue?
Thanks,
Kenz K.
By kenz on Sep 1, 2006
make a entry of in web.xml to resolve the proble /WEB-INF/servlet/view) is not available
ViewRendererServlet
org.springframework.web.servlet.ViewRendererServlet
1
ViewRendererServlet
/WEB-INF/servlet/view
By Amit on Jul 31, 2008