Tina Agrawal
Tina Agrawal

Reputation: 616

Deploying theme and portlets in Liferay running on non root context

Our Liferay Server is setup on a non-root context. The portal context is setup as - portal.ctx=/lportal

As a result of this the theme that we developed doesn’t work. The images css are not loading in the non root context. Also, the custom css that the portlets have those are also not loading.

Any clues on how to fix this.

Regards, Tina

Upvotes: 1

Views: 2785

Answers (2)

axel_c
axel_c

Reputation: 6796

We ran into the same problem, and we solved it by using a custom deployment descriptor for the application server.

We were using WebLogic, so we added a weblogic.xml file to the theme, with a context-root directive specifying the non-root context:

<?xml version="1.0"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
    <context-root>/foo/your-theme</context-root>
</weblogic-web-app>

Instructions for doing this with Tomcat or JBoss should be fairly similar.

And then you also have to specify the virtual path in the Liferay theme descriptor (liferay-look-and-feel.xml)

<?xml version="1.0"?>
<!DOCTYPE look-and-feel PUBLIC "-//Liferay//DTD Look and Feel 6.0.0//EN" "http://www.liferay.com/dtd/liferay-look-and-feel_6_0_0.dtd">

<look-and-feel>
    <compatibility>
        <version>6.1.10+</version>
    </compatibility>
    <theme id="foo-theme" name="Foo Theme">
        <virtual-path>/foo/your-theme</virtual-path>
    </theme>
</look-and-feel>

After redeploying the theme, the links to CSS, javascript etc will be working fine under /foo/your-theme.

Upvotes: 2

Olaf Kock
Olaf Kock

Reputation: 48057

Note that a theme always is deployed as its own web context - independent of Liferay. So when Liferay is deployed at http://www.example.com/lportal, your theme is deployed at http://www.example.com/my-theme and should reference images from there.

If Apache is generating your 404 error, make sure that it's forwarding the request to your appserver. Typically, if you have mod_jk or mod_proxy or similar configured to forward /lportal to Liferay, you also need to forward /my-theme.

If that doesn't help, please give some more information, like version and sample css that doesn't work, including what it generates.

Upvotes: 0

Related Questions