5 Replies Latest reply on Aug 14, 2008 10:39 AM by peterj

    Portlets on differents wars to same page

    samppaa

      Hello,

      I'm trying to get two portlets on different wars to be installed on same page in JBP when I deploy them but with no luck.

      I'm using JBP 2.6.5-SP1 and JBAS 4.2.2.

      I have A.war that has PortletA in it with following portal-object.xml

      <deployments>
       <deployment>
       <parent-ref>default</parent-ref>
       <if-exists>keep</if-exists>
       <page>
       <page-name>Test</page-name>
       <window>
       <window-name>testa</window-name>
       <instance-ref>PortletAInstance</instance-ref>
       <region>left</region>
       <height>1</height>
       </window>
       </page>
       </deployment>
      </deployments>
      


      And B.war with that has portletB and following portal-object.xml

      <deployments>
       <deployment>
       <parent-ref>default</parent-ref>
       <if-exists>keep</if-exists>
       <page>
       <page-name>Test</page-name>
       <window>
       <window-name>testb</window-name>
       <instance-ref>PortletBInstance</instance-ref>
       <region>left</region>
       <height>1</height>
       </window>
       </page>
       </deployment>
      </deployments>
      


      Both wars are deployed correctly and portlet instances are created but on the "Test" page only one of the portlets is shown. Am I doing something wrong or is this something that cannot be done automatically? (I can get the portlets on the same page using admin console)

      Thanks in advance,

      Samppa

        • 1. Re: Portlets on differents wars to same page
          peterj

          You have if-exists is set to keep. This setting means that if the portlet object/window has already been define to ignore the settings in the file. Either wipe out the database and start from scratch, or change if-exists to overwrite.

          Also, if you log in as admin and look in the admin portal, were both instances created? What about the page layout - is only one there?

          • 2. Re: Portlets on differents wars to same page
            samppaa

            Hello and thanks for the reply!

            I tried setting if-exists to overwrite but it did not solve the issue. Now what happens is that only the portlet on the war that is deployed last is shown on the page.

            Both portlet instances are created as expected but on the Test page there's only one window and its the one defined in the war that was deployed last.

            I also tried to set the other portlet window to center region but it didn't help.

            I guess that using if-exists overwrite clears the page layout and then adds the windows that are defined in the config.

            Any more ideas?

            -Samppa

            • 3. Re: Portlets on differents wars to same page
              peterj

              My general rule of thumb is that once a portlet has been deployed, after that I never modify the configuration files to change the deployment - instead I use the admin portal to do that.

              Alternately, you can wipe the database and thereby redeploy the porltlet. For example, during development, every time I change the config files, I stop the app server, re-create the portal database and restart the app server. Then the portal database is initialized from the updated config files.

              • 4. Re: Portlets on differents wars to same page
                samppaa

                I tried using a clean DB but it did not help. I was not able to get the portlets to show on the same page.

                If i put the two portlets into same war and declare them on the same portal-object.xml then both portlets end up showing correctly on the same page.

                So I guess it is just not possible to achieve what I am trying to do.

                Thanks for the help anyway

                -Samppa

                • 5. Re: Portlets on differents wars to same page
                  peterj

                  It should work because I have done it before (I'll look for an example later to verify this). But I had a though - the height property is the same for both, try changing the height for one of them. (Height is a horrible name for this property - it really defines the relative positioning of the portlet window within the column on the portal page, and not vertical dimension of the portlet window.)