Community Forums
Combination View Flat View Tree View
Threads [ Previous | Next ]
Deploying liferay war under different context than ROOT
toggle
Deploying liferay war under different context than ROOT Alberto Labarga 12/21/06 8:14 AM
RE: Deploying liferay war under different context than ROOT Jorge Ferrer 12/22/06 1:04 PM
RE: Deploying liferay war under different context than ROOT Stephen More 1/9/07 7:46 AM
RE: Deploying liferay war under different context than ROOT Amokrane Belloui 12/24/06 8:07 AM
RE: Deploying liferay war under different context than ROOT Glenn Michael Keith 12/26/06 6:14 AM
RE: Deploying liferay war under different context than ROOT Borxa Varela Bouzas 12/26/06 12:19 PM
RE: Deploying liferay war under different context than ROOT Glenn Michael Keith 12/27/06 11:09 AM
RE: Deploying liferay war under different context than ROOT Jorge Ferrer 12/29/06 11:06 AM
RE: Deploying liferay war under different context than ROOT Ivano Carrara 1/9/07 7:33 AM
RE: Deploying liferay war under different context than ROOT Jorge Ferrer 1/11/07 4:52 AM
RE: Deploying liferay war under different context than ROOT Ivano Carrara 1/11/07 7:44 AM
RE: Deploying liferay war under different context than ROOT Andre Kreienbring 1/21/07 8:07 AM
RE: Deploying liferay war under different context than ROOT Stephen More 1/19/07 8:00 AM
RE: Deploying liferay war under different context than ROOT Andre Kreienbring 1/19/07 12:46 PM
RE: Deploying liferay war under different context than ROOT Vincent Wong 1/20/07 9:50 AM
RE: Deploying liferay war under different context than ROOT Andre Kreienbring 1/21/07 8:06 AM
RE: Deploying liferay war under different context than ROOT Brian Chan 1/22/07 11:11 AM
RE: Deploying liferay war under different context than ROOT Miche Pitt 2/4/07 12:48 PM
RE: Deploying liferay war under different context than ROOT Andre Kreienbring 2/5/07 3:05 AM
RE: Deploying liferay war under different context than ROOT Marshall Thompson 2/6/07 5:12 AM
RE: Deploying liferay war under different context than ROOT stephane Manou 2/7/07 8:12 AM
RE: Deploying liferay war under different context than ROOT Marshall Thompson 2/7/07 8:09 AM
RE: Deploying liferay war under different context than ROOT Marshall Thompson 2/8/07 7:38 AM
RE: Deploying liferay war under different context than ROOT Andres Gutierrez 2/15/07 12:35 PM
RE: Deploying liferay war under different context than ROOT Andre Kreienbring 2/16/07 2:19 AM
RE: Deploying liferay war under different context than ROOT Andres Gutierrez 2/16/07 6:33 AM
RE: Deploying liferay war under different context than ROOT Andre Kreienbring 2/16/07 9:01 AM
RE: Deploying liferay war under different context than ROOT Vincent Wong 2/21/07 7:14 AM
RE: Deploying liferay war under different context than ROOT Andres Gutierrez 3/14/07 2:14 PM
RE: Deploying liferay war under different context than ROOT Pier Paolo Bortone 3/15/07 2:46 AM
RE: Deploying liferay war under different context than ROOT Pier Paolo Bortone 3/15/07 3:32 AM
RE: Deploying liferay war under different context than ROOT Marcus Schmidke 3/16/07 1:03 AM
RE: Deploying liferay war under different context than ROOT Marcus Schmidke 3/16/07 3:21 AM
RE: Deploying liferay war under different context than ROOT Marcus Schmidke 3/16/07 6:10 AM
RE: Deploying liferay war under different context than ROOT Jamal Najmi 3/18/07 5:52 PM
RE: Deploying liferay war under different context than ROOT Stephen More 3/20/07 9:55 AM
RE: Deploying liferay war under different context than ROOT Jamal Najmi 3/20/07 6:37 PM
RE: Deploying liferay war under different context than ROOT Andres Gutierrez 3/21/07 8:07 AM
Deploying liferay war under different context than ROOT
12/21/06 8:14 AM
Hi,

for what I have read, this may not be possible, but can I deploy the liferay-portal-4.2.0.war under a different context PATH than ROOT?

if possible, how should I configure that? ideally, I would like to use an external file, do not wnat to mess up with the war contents

thank you very much

Alberto
RE: Deploying liferay war under different context than ROOT
12/22/06 1:04 PM as a reply to Alberto Labarga.
Hi Alberto,

You'll be glad to hear that it is possible. You can see how in the following FAQ entry in LiferayPedia:

http://wiki.liferay.com/index.php/Liferay_FAQ#How_do_I_deploy_Liferay_to_a_context_different_than_the_root_one
RE: Deploying liferay war under different context than ROOT
1/9/07 7:46 AM as a reply to Alberto Labarga.
This is how I have deployed multiple wars of version 4.1.3 to 1 tomcat.

 1
 2A. Configure tomcat
 31. create conf/jaas.config
 4
 5PortalRealm {
 6    com.liferay.portal.kernel.security.jaas.PortalLoginModule required;
 7};
 8
 92. modify bin/catalina.sh to include
10
11JAVA_OPTS="-Xms128m -Xmx512m -Dfile.encoding=UTF8 -Duser.timezone=EST -Djava.security.auth.login.config=$CATALINA_BASE/conf/jaas.config"
12
13
143. Copy Libs   
15     cp mysql-connector-java-3.1.13-bin.jar $CATALINA_HOME/common/lib
16
17    ( From liferay-portal-dependencies-4.1.3.zip )
18    cp portlet.jar $CATALINA_HOME/common/lib
19    cp portal-kernel.jar $CATALINA_HOME/common/lib
20
21    ( From liferay-portal-4.1.3.war )
22    mv liferay-portal-4.1.3/WEB-INF/lib/* into $CATALINA_HOME/shared/lib
23
24B. Configure the war
251. mkdir myPortal
26
272. cd myPortal
28
293. jar -xvf ../liferay-portal-4.1.3.war
30
314. rm index.html
32
335. create META-INF/context.xml
34    <Context path="/myPortal" reloadable="true" >
35   
36    <Resource
37        name="jdbc/LiferayPool"
38        auth="Container"
39        type="javax.sql.DataSource"
40        driverClassName="com.mysql.jdbc.Driver"
41        url="jdbc:mysql://localhost/lportal?useUnicode=true&amp;characterEncoding=UTF-8"
42        username="root"
43        password=""
44        maxActive="100"
45        maxIdle="30"
46        maxWait="10000"
47    />
48
49    <Resource
50                name="mail/MailSession"
51                auth="Container"
52                type="javax.mail.Session"
53                mail.transport.protocol="smtp"
54                mail.smtp.host="localhost"
55    />
56
57    <Realm
58                className="org.apache.catalina.realm.JAASRealm"
59                appName="PortalRealm"
60                userClassNames="com.liferay.portal.security.jaas.PortalPrincipal"
61                roleClassNames="com.liferay.portal.security.jaas.PortalRole"
62                debug="99"
63                useContextClassLoader="false"
64    />
65</Context>
66
67
68
696. modify WEB-INF/web.xml
70    - change company_id
71    - change root_path
72
737. mkdir WEB-INF/classes
74
758. cd classes
76
779. create WEB-INF/classes/portal-ext.properties
78   portal.release=professional
79
80   portal.ctx=/myPortal
81
82   auto.deploy.dest.dir=../webapps
83
84   portal.instances=1
85
86   lucene.dir=/var/liferay/lucene/
87
88   jcr.jackrabbit.repository.root=/var/liferay/jackrabbit
89
90   omniadmin.users=
91
9210. jar -cvf ../myPortal.war *
93
9411. copy myPortal.war to tomcats webapp directory



Now http://localhost:8080/myPortal/c should now work.

If you want to create a second instance, change the items in red
to yourPortal.

Remove the items in blue

Now you can deploy yourPortal.war to tomcat.
RE: Deploying liferay war under different context than ROOT
12/24/06 8:07 AM as a reply to Stephen More.
Hi everybody,

Had been working for version 4.1.2,

But without success for version 4.2.0

The problem is :
on the main page the portlets are not visible, keeps loading without success,

Has anyone faced this problem with version 4.2.0

Br,
Amokrane,
RE: Deploying liferay war under different context than ROOT
12/26/06 6:14 AM as a reply to Amokrane Belloui.
I've got the same problem, looks like the portlets are still trying to access from the ROOT context instead of the new portal context: http://localhost:8080/c/portal/render_portlet
instead of what it should be
http://localhost:8080/myportal/c/portal/render_portlet

Any liferay guru's know where the config for that is? Or is just a version bug?

Thanx
RE: Deploying liferay war under different context than ROOT
12/26/06 12:19 PM as a reply to Glenn Michael Keith.
I think that is a bug. I have the same problem and i haven't it with previous versions.

I investigate the bug, and detect in the file portal-web/docroot/html/portal/load_render_portlet.jsp in the 4.2.0 source code this fragment of code for the javascript render:


...
function <%= namespace %>loadPortlet() {
var path = "/c/portal/render_portlet";
var queryString = "p_l_id=<%= plid %>&p_p_id=<%= portlet.getPortletId() %>&p_p_action=0&p_p_state=normal&p_p_mode=view&p_p_col_id=<%= columnId %>&p_p_col_pos=<%= columnPos %>&p_p_col_count=<%= columnCount %>";
...


I find this file only in the last version 4.2.0, you see the variable path, which don't use our context path modified. I solve it patching the file like this:


...
function <%= namespace %>loadPortlet() {
var path = "<%=PropsUtil.get(PropsUtil.PORTAL_CTX)%>/c/portal/render_portlet";
var queryString = "p_l_id=<%= plid %>&p_p_id=<%= portlet.getPortletId() %>&p_p_action=0&p_p_state=normal&p_p_mode=view&p_p_col_id=<%= columnId %>&p_p_col_pos=<%= columnPos %>&p_p_col_count=<%= columnCount %>";
...


I add PropsUtil.get(PropsUtil.PORTAL_CTX) in the definition of var path, for add property portal.ctx, which we have modified previously.

For solve the problem if you don't use source code, you go to the webapps directory in the server, navigate in your webapp to ...html/portal/load_render_portlet.jsp, find the var path and change it.
RE: Deploying liferay war under different context than ROOT
12/27/06 11:09 AM as a reply to Borxa Varela Bouzas.
I found, a similiar solution by simply finding the load_render_portlet.jsp file and hardcoding the new context.

I thought I'd add a little note here as well for newbie's to liferay like myself. When you modify the company_id in the WEB.xml you'll notice that you will loose the default communities and pages inside liferays orignal configuration.

If you want to keep these setting and still change the company_id you'll need to go digging inside the lportal database create script to alter the primary key inside the insert statement into the table company from the liferay.com to your new company_id.
RE: Deploying liferay war under different context than ROOT
12/29/06 11:06 AM as a reply to Glenn Michael Keith.
Hi,

This issue is already solved in SVN and will be included in 4.2.1. Thanks for noticing emoticon
RE: Deploying liferay war under different context than ROOT
1/9/07 7:33 AM as a reply to Jorge Ferrer.
Dear Jorge,

please, could you help me to understand if Liferay can run in multiple instances on one Tomcat server, each Liferay instance poiting to a separate database?

Since many times I'm running three separate Liferay servers on three separate Tomcat 5.5 servers.

Each portal points to a separate database in one MySql server instance. I don't used 'lportal' unique database, but 'companyA' 'companyB' 'companyC' databases running on a MySql 5 server.

Now I have to setup more Liferay portals so I'm trying to run one only Tomcat server and multiple Liferay instances.

I successfully setup three instances of Liferay following the High Availability Guide published on wiki.liferay.com

Then I changed:

C:\Java\tomcat-liferay\conf\Catalina\localhost\ROOT.xml to point to the 'companyA' MySql database

C:\Java\tomcat-liferay\conf\Catalina\localhost2\ROOT.xml to point to the 'companyB' MySql database

C:\Java\tomcat-liferay\conf\Catalina\localhost3\ROOT.xml to point to the 'companyC' MySql database

To do the above I changed:
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
-----> url="jdbc:mysql://localhost/companyA / companyB / companyC <--
....
...
/>

But now I understand that Liferay use the "jdbc/LiferayPool" of the first instance (localhost) for the all instances, so it point only to the 'companyA' database!!

Please, could you tell me if different instance of Liferay can read data from different jdbc/LiferayPool sources?

In professional and/or ASP environment, a Company can ask to separate their corporate data from other Companies.

If this is impossible, there is a path to follow to merge the contents of the actual 'companyA' 'companyB' 'companyC' databases?

Thank you in advance for your help!

Ivano C.
RE: Deploying liferay war under different context than ROOT
1/11/07 4:52 AM as a reply to Ivano Carrara.
Liferay has support for Application Server Provider hosting environments. The data of each company (called Enterprise in the web interface) is isolated from each other although only one database is required. Addition of new companies is done by deploying new portal WARS and changing the company_id parameter in the web.xml. The exact procedure depends on the application server.

If the databases must be different the best way to do it is to have several Tomcat instances.
RE: Deploying liferay war under different context than ROOT
1/11/07 7:44 AM as a reply to Jorge Ferrer.
Jorge, thank you for your reply!

Also, I wrote the multiple-db problem in the Support site - see LEP-1975.

Brian Chan updated the record setting in Version 4.2.2 a probable fix of the problem, as you can see here: http://support.liferay.com/browse/LEP-1975?page=all

Thank you for your valuable support!

Ivano C.
RE: Deploying liferay war under different context than ROOT
1/21/07 8:07 AM as a reply to Ivano Carrara.
In this other Post there's also information to this topic

Portlets not rendered when running liferay on other context than root

This one is fixed in liferay 4.2.1

BUT:
I think I encountered another Problem:
When using a different context than root no images are shown in articles based on Structure/Template Basic-Image-Text emoticon

Here's what I have done to change context from Root to myPortal. As soon as I can confirm my eMail adress I will also change the Wiki Article Jorge mentioned.

1. stop tomcat and change $CATALINA_HOME/webapps/ROOT to $CATALINA_HOME/webapps/myportal

2. (TOMCAT 5.5) change $CATALINA_HOME/conf/localhost/ROOT.xml to $CATALINA_HOME/conf/localhost/myportal.xml

3. In myportal.xml change/add ...Context ... docBase="/myportal" ...

4. In $CATALINA_HOME/webapps/myportal/index.html redirect to /myportal/c instead of /c

5. In portal-ext.properties add portal.ctx=/myportal

6. modify $CATALINA_HOME/webapps/myportal/WEB_INF/web.xml:
change the root_path from / to /myportal

7. start tomcat

By the way: Uploading the Images again AFTER changing the context did not help.

The source of the rendered HTML Page shows: ...img src="/image/journal/article?...

My System:
Tomcat 5.5.20
Liferay 4.2.1 with classic theme
MySQL 5
RE: Deploying liferay war under different context than ROOT
1/19/07 8:00 AM as a reply to Andre Kreienbring.
Andre Kreienbring:

This one is fixed in liferay 4.2.1

BUT:
When using a different context than root no images are shown in articles based on Structure/Template Basic-Image-Text emoticon



Has this been documented in JIRA ?

I looked but did not see one....

If you are running apache httpd infront of tomcat there is a workaround:

1
2      RewriteEngine On
3      RewriteRule ^/image/(.*)$   /myportal/image/$1 [PT]
RE: Deploying liferay war under different context than ROOT
1/19/07 12:46 PM as a reply to Stephen More.
Not sure if this is a misconfiguration or a bug!

Thats why I not reported it to Jira.

André
RE: Deploying liferay war under different context than ROOT
1/20/07 9:50 AM as a reply to Stephen More.
Stephen More:
Andre Kreienbring:

This one is fixed in liferay 4.2.1

BUT:
When using a different context than root no images are shown in articles based on Structure/Template Basic-Image-Text emoticon



Has this been documented in JIRA ?

I looked but did not see one....

If you are running apache httpd infront of tomcat there is a workaround:

1
2      RewriteEngine On
3      RewriteRule ^/image/(.*)$   /myportal/image/$1 [PT]


No need, just tweak the journal.transformer.listener in portal-ext.properties with the following line

journal.transformer.listener=com.liferay.portlet.journal.util.TokensTransformerListener,com.liferay.portlet.journal.util.PropertiesTransformerListener,com.liferay.portlet.journal.util.ContentTransformerListener,com.liferay.portlet.journal.util.LocaleTransformerListener


It is found that the default active journal.transformer.listener in portal.properties omits the ContentTransformerListener in the chain, while the correct one is commented out. Therefore the /image/ token is not updated correctly in the web page.

Liferay guys, please double check and accept the fix.
RE: Deploying liferay war under different context than ROOT
1/21/07 8:06 AM as a reply to Vincent Wong.
YES!

This was only the second Post of this guy. Man, you should post more often...

Great!

André
RE: Deploying liferay war under differe