5 Replies Latest reply on Feb 25, 2010 1:32 PM by Monkey Den

    Resources for using portal api

    Monkey Den Master

      I am looking to use the portal api within my Seam application.  What I'd first like to do it integrate portal roles and permissions.  I looked through the portal documentation and found that it talks mostly about the "inside-out" view of the portal (administration and portlet development).  Is there a wiki or something that can tell me more about how to access the api from an "outside-in" approach, like from within a Seam component?  Does the portal expose anything via JNDI or JMX with which to acces this?

       

      Thanks

        • 1. Re: Resources for using portal api
          Wesley Hales Master
          You should take a look at the JBoss Portlet Bridge project. http://www.jboss.org/portletbridge and this video (http://www.vimeo.com/4521877) shows how to use the identity component, just fast forward it to 7:31.
          • 2. Re: Resources for using portal api
            Monkey Den Master
            very nice Wesley, down to the second.  I think that's as precise a response as I've ever received.  lol
            • 3. Re: Resources for using portal api
              Monkey Den Master

              The example in the video is pretty simple but it doesn't deploy correctly.  Here is the error I get on startup:

               

              Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
              java.lang.RuntimeException: error while reading /WEB-INF/components.xml
                  at org.jboss.seam.init.Initialization.initComponentsFromXmlDocument(Initialization.java:231)
                  at org.jboss.seam.init.Initialization.create(Initialization.java:134)
                  at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:35)
                  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3856)
                  at org.apache.catalina.core.StandardContext.start(StandardContext.java:4361)
                  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
                  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
                  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
                  at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

              ....

              Caused by: java.lang.RuntimeException: Error loading element PortalIdentity with component name null and component class null

               

              Can anyone shed some light on it?

               

              Thanks

              • 4. Re: Resources for using portal api
                Wesley Hales Master

                In version 1.0.0.CR2 The PortalIdentity component is external to the core api/impl, so make sure you are building your project with the -Psso switch in "mvn install". Also I would recommend using the 2.0.0.CR1 version of the bridge instead of 1.0.x - because PortalIdentity is internal to the later 2.0 versions and you don't need to add it as a dependency of the project..

                 

                I would also check your components.xml, there are occasions when the archetype does not parse the maven expression language properly on the windows platform. Make sure everything looks good in that file.

                • 5. Re: Resources for using portal api
                  Monkey Den Master

                  Thanks again Wesley.  I've been able to get everything working correctly within my code but transaction committal fails after the request.  Seam doesn't know anything about the persistence context the portal API is using so when it tries to commit it fails with:

                   

                  org.jboss.util.NestedSQLException: Could not enlist in transaction on entering meta-aware object!

                  ...

                  Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection

                   

                  Here is the bit of code that works, until the response:

                   

                  UserModule userMod = (UserModule) new InitialContext().lookup("java:portal/UserModule");
                  user = userMod.findUserByUserName(username);

                   

                  Any idea of how to get around this?