13 Replies Latest reply on Nov 17, 2005 4:41 AM by Thorsten Schmidt

    How do I write my Own Portal..

    ray lukas Newbie

      I just installed JBoss server and the Portal server and configured it for PostgreSql. It was really easy, my complements to the designers and builders.

      Now I want to try my hand at writing my own portal with say two very simple portlets. So I found a simple portlet called HelloWorld.

      I placed this war file into the Jboss-portal.sar directory and the URL http://localhost:8080/portal displays the default portal server page with the hello world portlet in the list. Clicking on that link brings up my Hello World message.

      This is great.

      But I want to write my own portal with my own portlets. How can I deploy just the hello world on its own. How do I start working in ?my area? and not from within the default area.

      Should I delete the portal-core directory and ? go from there.... or is there a simpler, less destructive way, how is this done..

      Thanks

        • 1. Re: How do I write my Own Portal..
          ray lukas Newbie

          default-portal.xml lives inside of server\default\jboss-portal.sar\portal-core.war\web-info.. I think that this is the file I need to work in.. I think that I need to define a new portal (which by definition is what I am asking) in this file or replace the contents of this file with my stuff (which is what I eventually will do).

          I think that I found it.. I am going to work in this file and I will post what I find. Perhaps it might help some one else new to the portal server..
          ray

          • 2. Re: How do I write my Own Portal..
            Giordano Vicoli Newbie

            I also am interested in configuring a new portal. More in details did you find how to change the context (i.e. from /portal to /myportal)?

            Giordano

            • 3. Re: How do I write my Own Portal..
              ray lukas Newbie

              No.. this is what I have done. I created a new *-portal.xml file as described in the JBoss manual JBoss Portal 2.0 Final Reference Guide.
              It does not work as far as I can tell. This is quite discouraging. This really should be a simple task.


              Inside of

              C:\jboss-portal-2.0-jboss-4.0.2\server\default\deploy\jboss-portal.sar
              I have the following directories


              Conf
              lib
              META-INF
              org
              portal-cms.sar
              portal-cms.war
              portal-core.war
              portal-server.war
              and my helloworld.war


              Inside of helloworld.war I have a WEB-INF directory with all the files from the helloworld example. I added helloworld-portal.xml with the following contents which I would think defines a new portal called helloworld:

              <?xml version="1.0" encoding="UTF-8"?>
              <portal>
               <portal-name>helloworld</portal-name>
               <supported-modes>
               <mode>view</mode>
               <mode>edit</mode>
               <mode>help</mode>
               </supported-modes>
               <supported-window-states>
               <window-state>normal</window-state>
               <window-state>minimized</window-state>
               <window-state>maximized</window-state>
               </supported-window-states>
               <pages>
               <default-page>default</default-page>
               <page>
               <page-name>samples</page-name>
               <window>
               <window-name>HelloWorldPortletWindow</window-name>
               <instance-ref>helloworld.HelloWorldPortlet.HelloWorldPortletInstance</instance-ref>
               <default>true</default>
               <region>center</region>
               <height>0</height>
               </window>
               </page>
               </pages>
              </portal>
              



              I also corrected the <page-name>helloworld</page-name> in helloworld-pages.xml from hellworld to helloworld.

              I then point the browser at http://localhost:8080/helloworld I get a directory listing for ?/?.
              If then point the browser to http://localhost:8080/portal I get the default portal for JBoss with my helloworld portlet in the menu. Somehow the default portal seems to discover my portlet automagically (?) even though it is not included in the default-portal.xml file.

              Can someone please help me with this..
              ray


              • 4. Re: How do I write my Own Portal..
                Ernesto Nebel Newbie

                I approached this slightly differently. I put my portal's WAR file in the server\default\deploy\ directory, and I also put my *-portal.xml file in this directory. All other *.xml files mentioned in chapter 2 of the reference guide I put in the WEB-INF directory of my WAR file, except for the *-pages.xml file, which I don't have at all. (If I want my portal to be a page of the default portal, then I have a *-pages.xml and no *-portal.xml.) This approach allows you to access your portal directly using a URL like: http://localhost:8080/portal/yourportal/ (assuming "yourportal" is the text inside the <portal-name> element in your *-portal.xml file). The JBoss default portal is still accessible at http://localhost:8080/portal/ .

                Any deviations from the above are undocumented, which I also find very disappointing.

                • 5. Re: How do I write my Own Portal..
                  ray lukas Newbie

                  thanks let me give this a try..
                  ray

                  • 6. Re: How do I write my Own Portal..
                    ray lukas Newbie

                    Sorry I did not get back to you sooner.. Your post was a big help and it works great. I now have things working and can start to actually build my own portlets. This is very exciting. Thanks for taking the time to help me with this.
                    ray

                    • 7. Re: How do I write my Own Portal..
                      ashok hament Newbie


                      I tried to create my own portlet using helloworld.war in a way given by Nebel.
                      I put the helloworld.war file in deploy folder and also put the helloworld-portal.xml file in the directory deploy/. I got the error "not found" even placing helloworld-pages.xml file in hellowworld/WEB-INF.

                      • 8. Re: How do I write my Own Portal..
                        Ernesto Nebel Newbie

                        Ray, you're welcome.

                        ashokhament, it's hard to tell why it doesn't work for you without more information. Are you using the right URL, including the trailing / ? What I did to get it to work is to look closely at both the documentation and the XML files inside:

                        server\default\deploy\jboss-portal.sar\portal-core.war\WEB-INF\

                        which are used for the default portal

                        Good luck.

                        • 9. Re: How do I write my Own Portal..
                          ashok hament Newbie

                          nebel, Thanks for your response
                          Now it's working fine.

                          • 10. Re: How do I write my Own Portal..
                            Giordano Vicoli Newbie

                            Hi,

                            thank you for these explanations. It works fine.

                            I propose another question:

                            I created my own portal. How can I install a new theme for only my portal?

                            Thanks and bye,
                            Giordano

                            • 11. Re: How do I write my Own Portal..
                              rincewind23 Newbie

                              Looks like quite a few people have got this working. I can't, but I think I'm doing it slightly differently. What I'm trying to do is add a portlet and a page containing that portlet to the default portal. From reading the documentation it looks like what I need to do is put into a war the following:

                              the code for my portlet (in WEB-INF/classes)

                              helloworld-portlet.xml, the portlet descriptor (in WEB-INF) which contains the portlet class name and the portlet-name, which is referenced by

                              jboss-portlet.xml (in WEB-INF) which contains the portlet-name defined in the portlet.xml

                              portlet-instances.xml (in WEB-INF) which contains an instance-name for referring to the portlet (where component-ref in this file= portlet-name in jboss-portlet.xml and portlet.xml)

                              jboss-app.xml (in WEB-INF) which contains an app-name which is referenced in helloworld-pages.xml

                              helloworld-pages.xml (in WEB-INF) which is a definition for a page, where portal-name is the name of an existing portal definition, and instance-ref is <app-name>/<portlet-name>/<instance-name>

                              So basically what I would be doing is defining a new page in helloworld-pages, but have the portal-name set to default so it attaches the page to the existing (default) portal.

                              Can anyone see what I'm doing wrong? Or is this not the right info to diagnose the problem?

                              Or if anyone could let me have a working HelloWorld.war I can take a look at, that would be much appreciated - the link in the Documentation to where the HelloWorld example is now takes you to portletswap.com where there is no HelloWorld portlet.

                              Cheers,
                              Kev.

                              • 12. Re: How do I write my Own Portal..
                                Thorsten Schmidt Newbie

                                Hello everyone,

                                sorry for posting in this thread but I thought its better to post here than create a new, since my question is directly related to ray_lukas initial posting. I have done all the basic steps (Installing AppServer, connecting MySQL as datasource, installing JBoss Portal) and I can access and play around with the default portal (create users, define roles etc).

                                Then I downloaded the HelloWorld.war (got the link from somewhere here in the forum), extracted it and put it in the Jboss-portal.sar dir (filestructure Jboss-portal.sar\helloworld.war\WEB-INF\...). Now there appears an additional page in the menu called "helloworld" however when clicking on it I get a NullPointerException. I fail to see the difference from what ray_lukas has done, yet its working for him. Did I miss something ? Considering the type of exception I must assume this is some kind of newbie mistake, but I cant figure it out.

                                Thanks in advance

                                Thorsten

                                • 13. Re: How do I write my Own Portal..
                                  Thorsten Schmidt Newbie

                                  nevermind I just got it to work...(no clue why I didnt work in the first place).

                                  sorry to have messed up this thread

                                  Greetings

                                  Thorsten