2 Replies Latest reply on Apr 29, 2008 12:36 PM by shankarkhanna

    Unable to itrate through portal nodes

    shankarkhanna

      Hi,

      I am not able to get childeren of a portal node. I am getting this exception ( org.hibernate.HibernateException: Unable to locate current JTA transaction
      )

      Here is my code:

      protected void doView(JBossRenderRequest req, JBossRenderResponse res) throws PortletException, PortletSecurityException, IOException {
      
       res.setContentType("text/html");
       PortalNode portalNode = req.getPortalNode();
      
       Locale locale = req.getLocale();
       if (locale == null)
       locale = Locale.getDefault();
      
       while (portalNode.getType() != PortalNode.TYPE_PORTAL)
       {
       portalNode = portalNode.getParent();
       System.out.println(portalNode.getDisplayName(locale));
       System.out.println(portalNode.getName());
       System.out.println(portalNode.getType());
       }
      
       Iterator childrenIt = portalNode.getChildren().iterator();
      
       while (childrenIt.hasNext())
       {
       PortalNode child = (PortalNode)childrenIt.next();
       System.out.println(child.getDisplayName(locale));
       }
       }



      Code does not work at this line:

      Iterator childrenIt = portalNode.getChildren().iterator();



      This is an exception that i am facing

      18:46:04,984 ERROR [PortalPermissionCollection] Permission check against the repository failed
      org.hibernate.HibernateException: Unable to locate current JTA transaction
       at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61)
       at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:544)
       at org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer.getObjectNode(PersistentPortalObjectContainer.java:252)
       at org.jboss.portal.core.impl.model.portal.AbstractPortalObjectContainer.getPermission(AbstractPortalObjectContainer.java:166)
       at org.jboss.portal.core.model.portal.PortalObjectPermission.implies(PortalObjectPermission.java:227)
       at org.jboss.portal.security.PortalPermissionCollection.implies(PortalPermissionCollection.java:96)
       at org.jboss.portal.security.impl.jacc.Permissions.implies(Permissions.java:93)
       at org.jboss.portal.security.impl.jacc.SecurityContext.implies(SecurityContext.java:81)
      
      
      
      Please Help
      
      
      Shankar Khanna