Packing many portlets in the same war

I am trying put two portlet to one war file, but I can get work in liferay. Is it on vaadin side any limitation to do this. I only want share few class instances for both portlet.

There is no limitation in Vaadin for this. The
Vaadin demo.war
included in the distribution contains several portlets. Take a look at that for an example.

Have tried to deploy the demo war:
http://vaadin.com/download-packages
That contains several portlets.

Actually earlier there was problems with the Liferay and potlets in separate wars. To avoid this.make sure you are using the latest Vaadin version (currently 6.1.1). This problem did not affect several portlets within the same war, that should work.

Hi,

It would also be easier to help if you provided a little more information - at what point does it fail, how?

Best Regards,
Marc

I downloaded vaadin-demo.6.1.1.war and added to liferay 5.2.3. After that I added PortletDemo and Calc portlets.
Everything went fine expect both portlets was empty (there is no any content inside portlet).

Same problem was my own portlet war. It support one portlet after change servlet mapping point to /* in web.xml.
For example I have two portlet configured in web.xml and both portlets is empty

Test1
/test1/


Test2
/test2/

when change mapping like below…

<servlet-mapping>
	<servlet-name>Test1</servlet-name>
	<url-pattern>/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
	<servlet-name>Test2</servlet-name>
	<url-pattern>/*</url-pattern>
</servlet-mapping>

Servlet Test1 work fine but Test2 is actually Test1 portlet

Anyone ideas for vaadin-demo.war problem?

No error about a missing widgetset?
(There is a 30sec or so delay before warning is show)

For me, this seems like nothing is loaded (by nothing I here mean the widgetset or themes).

This in turn means that there is something wrong with the static resources URL. Do you have a FireBug or similar to catch the source of the empty portlets in picture. Just to make sure what is going on there…

I’m guessing here but:

It tries to look for an URL like “/test1/VAADIN/…” That is not found and nothing static resources area loaded.

In the case you change the servlet mapping to /* it works because then everything under /test1/* goes to the same servlet and also resources are served as they should. The unwanted side effect is that you cannot have two portlets in the same war.

You can test this: Try adding mapping for /VAADIN also into web.xml and make it point to the first servlet.

I’ll check what is wrong with the demo war.

Another thing would be if you have tested the servlets by directly opening the url, you might have a separate JSESSIONID-cookie for the servlets. This will break the portlets and might cause them to be empty. The session must be the same for the portal and the servlets. So, do not visit the servlet directly and if you still do, verify that you do not have more than one session cookie in your browser (simplest way is to clear the cache, including cookies and try again).

Hi,
i have the same problem.
i installed the eclipse plugin, created a new project with test (Hello vaadin user) application.
as long as the servlet is mapped to /* everything works fine (even without defining portlet.xml etc),
but as soon as i change the mapping, it shows me just an empty portlet…
the servlet itself is working tho.
i tried with and without vaadin installed to liferay (i got the mail-portlet running, so i think i installed it right)
and with and without the vaadin.jar in the webapp.
i tried the trick with clearing the cache, still empty portlet…

web.xml:


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>VaadinTest</display-name>
  <context-param>
  	<description>Vaadin production mode</description>
  	<param-name>productionMode</param-name>
  	<param-value>false</param-value>
  </context-param>
  <servlet>
  	<servlet-name>Vaadintest</servlet-name>
  	<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
  	<init-param>
  		<description>
  		Vaadin application class to start</description>
  		<param-name>application</param-name>
  		<param-value>com.example.vaadintest.VaadintestApplication</param-value>
  	</init-param>
  </servlet>
  <servlet-mapping>
  	<servlet-name>Vaadintest</servlet-name>
  	<url-pattern>/vaadintest/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
		<servlet-name>Vaadintest</servlet-name>
		<url-pattern>/VAADIN/*</url-pattern>
	</servlet-mapping>
  <welcome-file-list>
    ...
  </welcome-file-list>
</web-app>

portlet.xml:


<?xml version="1.0" encoding="UTF-8"?>
<portlet-app
        xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
        version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
        <portlet>
                <portlet-name>1</portlet-name>
                <display-name>PortletDemoPortlet</display-name>
                <portlet-class>com.vaadin.terminal.gwt.server.ApplicationPortlet</portlet-class>
                <init-param>
                        <name>application</name>
                        <value>Vaadintest</value>
                </init-param>
                
                <supports>
                        <mime-type>text/html</mime-type>
                        <portlet-mode>view</portlet-mode>
                        <portlet-mode>edit</portlet-mode>
                        <portlet-mode>help</portlet-mode>
                </supports>
                <portlet-info>
                        <title>PortletDemo</title>
                        <short-title>PortletDemo</short-title>
                </portlet-info>
                
                <security-role-ref>
                        ...
                </security-role-ref>
        </portlet>
</portlet-app>

liferay-portlet.xml:


<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 4.3.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_4_3_0.dtd">

<liferay-portlet-app>
        <portlet>
                <portlet-name>1</portlet-name>
                <instanceable>true</instanceable>       
                <ajaxable>false</ajaxable>
        </portlet>
    
        <role-mapper>
                ...
        </role-mapper>
</liferay-portlet-app>

liferay-display.xml:


<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 4.0.0//EN" "http://www.liferay.com/dtd/liferay-display_4_0_0.dtd">

<display>
        <category name="Vaadin">
                <portlet id="1" />
        </category>
</display>

sorry for all those spam, but as i dont have any clue, where the mistake is, i wanted to post the complete stuff (only cutted out the welcome file list and role sections, as i really can’t imagine that the error is in there)
i hope i didn’t missed something important…
again, as soon as i change [quote]
/vaadintest/
[/quote] to [quote]
/

[/quote] everything works…

Greetings,
Felix

EDIT
i forgott to mention, that when i installed vaadin to liferay and don’t place the vaadin.jar in the web-inf/lib folder of the webapp, i can’t deploy it. it can’t find the com.vaadin.terminal.gwt.server.ApplicationPortlet class then.
but the mail-portlet deploys without errors and it uses the ApplicationPortlet class too, so i don’t know why this error occurs.

You have a case mismatch there. The application parameter for the portlet must be the URL the servlet is listening to, not the servlet name. So change it to vaadintest and see if it starts working.

If you are using 6.1.0/6.1.1 there is a bug which forces you to install the vaadin.jar into Liferay. Try the latest nightly to avoid this. Otherwise you will get a “widgetset not found” if you wait a while as it always tries to load it from the Liferay installation and not from the servlet. Vaadin 6.1.2 with a fix for this will also be released tomorrow if you can wait that long :slight_smile:

I don’t understand? In Book of Vaadin chapter 11.8.2 learn to use servelet name in application parameter.


    <init-param>
      <name>application</name>
      <!-- Must match the servlet name in web.xml. -->
      <value>PortletExample</value>
    </init-param>

I tested vaadin 6.1.2 but same problem. No portlet and widgetset not found error message. 6.1.2 is inside war file and I deployed to liferay/deploy folder

This was my own mistake. I missed add one dependency library.

This is an unfortunate error in the Book of Vaadin and will be corrected asap. If you use our Eclipse plugin you will get all the files set up automatically for you.

Thank you very much for your help! I got it working now. The onlything that confuses me, is that if i map the servlet to /*, i dont leave the application param empty or use / there, i put the servlet-name into it…
But anyway, i got it working now and thats the important thing :slight_smile: Thank you again