10 Replies Latest reply on Aug 27, 2010 12:07 PM by adnanqureshi

    Integrating Legacy applications (JSP/Servlet)

    adnanqureshi

      Hi all,

       

      I am new to this Portlet world and has been asked to develop sample apps as Proof of Concept.

      One of the task is to embed existing apps developed in different technologies (JSP/Servlet, JSF, Struts) as a portlet.

       

      These existing applications are deployed on different server machine then of JBoss Portal.

      All the documentation provided online is building your apps from scratch, is there a way I can embed these existing apps?

       

      Any feedback on how I can achieve this task is appreciated.

       

      Thanks a bunch in advance.

      Adnan

        • 1. Re: Integrating Legacy applications (JSP/Servlet)
          prabhat.jha

          Hi Adnan,

           

          This is a very wide and open question. Let me clarify few things for you.

           

          JBoss's current live community version of portal is GateIn Portal (http://www.jboss.org/gatein) and corresponding supported version is JBoss EPP5 (http://www.jboss.com/products/platforms/portals/). The previous project JBoss Portal is no longer in active development so you should keep that in mind.

           

          JBoss PortletBridge allows you to run a JSF or Richfaces or Seam based applications in portal environment. JSP works by default. You should be able to import other web frameworks based application as well but you would have to look for their corresponding bridge implementation..for example Spring MVC has a portlet bridge as well.

           

          Applications running on different servers can be consumed in one portal server through WSRP so that will be something else to look into it.

          • 2. Re: Integrating Legacy applications (JSP/Servlet)
            adnanqureshi

            Thanks for your quick response,

             

            I have to stick with JBoss Portal, so can't work on GateIn.

            The documentation available online from JBoss is very specific to creating new apps, I need information on how I can embed existing apps as portlet.

             

            what steps would be involved?

            what descriptor files I'll need to add/change?

             

            Regards,

            Adnan

            • 3. Re: Integrating Legacy applications (JSP/Servlet)
              adnanqureshi

              Hi Prabhat,

               

              I was able to spend more time on JBoss Portal/Portlets, I got your point on WSRP (I am assuming you referring to remote Portlets and not Applications).

               

              I was able to write a portlet that do the iframe of all apps, but now I know I do have to work on Bridge for sure.

              As I said earlier, online documentation isn't helping me much, would you or anybody can help me on this? where to look for more detailed documentation?

               

              Regards,

              Adnan

              • 4. Re: Integrating Legacy applications (JSP/Servlet)
                prabhat.jha

                I believe portletbridge documentation at http://www.jboss.org/files/portletbridge/docs/2.0.0.FINAL/en/html_single/index.html is pretty good. I have created few applicaitons that use portletbridge and you can take a look at those as well such as Netflix portlet http://sensiblerationalization.blogspot.com/2010/08/some-new-kind-of-entertainment-for-your.html and tic-tac-toe portlet http://sensiblerationalization.blogspot.com/2010/03/what-you-can-tictactoe-in-gatein-portal.html

                 

                You are more than welcome to buy support contract if you need more specific help for your requirement.

                • 5. Re: Integrating Legacy applications (JSP/Servlet)
                  adnanqureshi

                  Thanks Prabhat,

                   

                  I still don't understand how to configure my project for using bridge and make this available on portlet server.

                  If I build application with bridge, will this app be available as web app / portlet app bot

                   

                  Adnan

                  • 6. Re: Integrating Legacy applications (JSP/Servlet)
                    adnanqureshi

                    Hi Prabhat,

                     

                    Finally I was able to configure/use the Bridge, however I am unable to see any page on my portlet.

                    Portlet Definition/Instance is there in the Admin, but when I add it's instance to a page, I can see the portlet window but seeing null instead of seeing my page.

                     

                    Another thing I noticed is, as soon as I deploy my ear file, I get few errors on console.

                     

                    19:12:18,643 INFO  [TomcatDeployer] undeploy, ctxPath=/JSPProject, warUrl=.../tmp/deploy/tmp19434JSPProject-exp.war/

                    19:12:18,756 ERROR [STDERR] Aug 25, 2010 7:12:18 PM javax.portlet.faces.GenericFacesPortlet destroy

                    INFO: Destroy GenericFacesPortlet for portlet JSPPortlet

                    19:12:18,975 INFO  [TomcatDeployer] deploy, ctxPath=/JSPProject, warUrl=.../tmp/deploy/tmp19435JSPProject-exp.war/

                    19:12:19,243 INFO  [PortletViewHandler] No Facelets library is present

                    19:12:19,488 ERROR [STDERR] Aug 25, 2010 7:12:19 PM javax.portlet.faces.GenericFacesPortlet init

                    INFO: Init GenericFacesPortlet for portlet JSPPortlet

                    19:12:19,500 ERROR [STDERR] Aug 25, 2010 7:12:19 PM javax.portlet.faces.GenericFacesPortlet calculateBridgeClassName

                    INFO: Bridge class name is org.jboss.portletbridge.AjaxPortletBridge

                    19:12:19,529 ERROR [STDERR] Aug 25, 2010 7:12:19 PM javax.portlet.faces.GenericFacesPortlet init

                    INFO: The bridge does not support doHeaders method

                     

                    here is my portlet.xml file, would really appreciate if you can help me out here.

                     

                    <portlet>
                    <portlet-name>JSPPortlet</portlet-name>
                    <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
                    <descriptionSample JSP Portlet</description>
                    <portlet-info>
                    <title>JSP Portlet Title</title>
                    <short-title>JSP Portlet</short-title>
                    </portlet-info>
                    <init-param>
                    <name>view-jsp</name>
                    <value>/welcome.jsp</value>
                    </init-param>
                    <init-param>
                    <name>edit-jsp</name>
                    <value>/home.jsp</value>
                    </init-param>
                    <init-param>
                    <name>help-jsp</name>
                    <value>/help.jsp</value>
                    </init-param>
                    <init-param>
                    <name>javax.portlet.faces.preserveActionParams</name>
                    <value>true</value>
                    </init-param>
                    <expiration-cache>0</expiration-cache>
                    <supports>
                    <mime-type>text/html</mime-type>
                    <portlet-mode>VIEW</portlet-mode>
                    <portlet-mode>EDIT</portlet-mode>
                    <portlet-mode>HELP</portlet-mode>
                    </supports>
                    </portlet>

                     

                     

                     

                    Regards,

                    Adnan

                    • 7. Re: Integrating Legacy applications (JSP/Servlet)
                      prabhat.jha

                      You should look at deployment descriptors at http://anonsvn.jboss.org/repos/portletbridge/tags/2.0.0.FINAL/examples/jsf-ri/1.2-basic/ . For example, portlet.xml is at http://anonsvn.jboss.org/repos/portletbridge/tags/2.0.0.FINAL/examples/jsf-ri/1.2-basic/src/main/webapp/WEB-INF/portlet.xml

                       

                      What error do you see on server side? If you have everything similar to what you see on above link then you might have some typo here and there.

                      1 of 1 people found this helpful
                      • 8. Re: Integrating Legacy applications (JSP/Servlet)
                        adnanqureshi

                        Thanks Prabhat for quick reply,

                         

                        here is the error am getting on server,

                         

                        19:12:18,643 INFO  [TomcatDeployer] undeploy, ctxPath=/JSPProject, warUrl=.../tmp/deploy/tmp19434JSPProject-exp.war/

                        19:12:18,756 ERROR [STDERR] Aug 25, 2010 7:12:18 PM javax.portlet.faces.GenericFacesPortlet destroy

                        INFO: Destroy GenericFacesPortlet for portlet JSPPortlet

                        19:12:18,975 INFO  [TomcatDeployer] deploy, ctxPath=/JSPProject, warUrl=.../tmp/deploy/tmp19435JSPProject-exp.war/

                        19:12:19,243 INFO  [PortletViewHandler] No Facelets library is present

                        19:12:19,488 ERROR[STDERR] Aug 25, 2010 7:12:19 PM javax.portlet.faces.GenericFacesPortlet init

                        INFO: Init GenericFacesPortlet for portlet JSPPortlet

                        19:12:19,500 ERROR [STDERR] Aug 25, 2010 7:12:19 PM javax.portlet.faces.GenericFacesPortlet calculateBridgeClassName

                        INFO: Bridge class name is org.jboss.portletbridge.AjaxPortletBridge

                        19:12:19,529 ERROR [STDERR] Aug 25, 2010 7:12:19 PM javax.portlet.faces.GenericFacesPortlet init

                        INFO: The bridge does not support doHeaders method

                         

                        I think the descriptor files are similar, I can see the portlet definition/instance in Admin.

                        Here are my conf files.

                         

                        faces-config.xml

                         

                        <application>
                        <view-handler>org.jboss.portletbridge.application.PortletViewHandler</view-handler>
                        <state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
                        </application>
                        Portlet Instance.xml
                        <deployments>
                        <deployment>
                        <instance>
                        <instance-id>JSPPortletInstance</instance-id>
                        <portlet-ref>JSPPortlet</portlet-ref>
                        </instance>
                        </deployment>
                        </deployments>

                        default-objects.xml

                         

                        <deployments>

                        <deployment>

                        <parent-ref>default.default</parent-ref>

                        <if-exists>overwrite</if-exists>

                        <window>

                        <window-name>JSPPortletWindow</window-name>

                        <instance-ref>JSPPortletInstance</instance-ref>

                        <region>center</region>

                        <height>5</height>

                        <initial-window-state>maximized</initial-window-state>

                        </window>

                        </deployment>

                        </deployments>

                         

                        web.xml

                         

                         

                        <context-param>

                        <param-name>javax.portlet.faces.RENDER_POLICY</param-name>

                        <param-value>NEVER_DELEGATE</param-value>

                        </context-param>

                         

                          <servlet>

                            <servlet-name>Faces Servlet</servlet-name>

                            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

                            <load-on-startup>1</load-on-startup>

                          </servlet>

                          <servlet-mapping>

                            <servlet-name>Faces Servlet</servlet-name>

                            <url-pattern>/faces/*</url-pattern>

                          </servlet-mapping>

                         

                         

                        portlet.xml

                         

                         

                         

                        <portlet>

                        <portlet-name>JSPPortlet</portlet-name>

                        <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>

                        <description>Sample JSP Portlet</description>

                         

                        <portlet-info>

                        <title>JSP Portlet Title</title>

                        <short-title>JSP Portlet</short-title>

                        </portlet-info>

                         

                        <init-param>

                        <name>view-jsp</name>

                        <value>/welcome.jsp</value>

                        </init-param>

                        <init-param>

                        <name>edit-jsp</name>

                        <value>/home.jsp</value>

                        </init-param>

                         

                        <init-param>

                        <name>help-jsp</name>

                        <value>/help.jsp</value>

                        </init-param>

                         

                        <init-param>

                        <name>javax.portlet.faces.preserveActionParams</name>

                        <value>true</value>

                        </init-param>

                         

                        <expiration-cache>0</expiration-cache>

                        <supports>

                        <mime-type>text/html</mime-type>

                        <portlet-mode>VIEW</portlet-mode>

                        <portlet-mode>EDIT</portlet-mode>

                        <portlet-mode>HELP</portlet-mode>

                        </supports>

                         

                        </portlet>

                         

                         

                        Regards,

                        Adnan

                        • 9. Re: Integrating Legacy applications (JSP/Servlet)
                          adnanqureshi

                          Hi Prabhat,

                           

                          I was able to resolve the issue with my simple JSP based portlets, here are my findings,

                          For JSP based apps to run as portlets,

                           

                               -     we don't need JSP JBoss Portlet Bridge

                               -     we need to write kind of Controller Classes extending GenericPortlet. (A portlet class)

                               -     Same configurations in portlet/instance/objects as other normal portlets.

                           

                          Now I'll work on JSF/Struts based apps.

                           

                          Regards,

                          Adnan

                          • 10. Re: Integrating Legacy applications (JSP/Servlet)
                            adnanqureshi

                            Hi Prabhat,

                             

                            I want to share/confirm my understanding with Portlet technology,

                            Say if I have an application build on JSP/Servlet and I have a feature of basic CRUD operation,

                             

                            My initial assumption was, I'll somehow wrap around these jsps and can use the same jsp for my portlet, but now I think I can't do this.

                            another assumption I had was, based on above, I would be able to access same app as a web app and at the same time this very same app will be available as portlet as well. but now I think this is not the case.

                             

                            Is it same for JSF as well? is my understanding correct?

                             

                             

                            Really appreciate your help !!!

                            Regards,

                            Adnan