[jboss-user] [JBoss Portal] - org.hibernate.HibernateException: Unable to locate current J

eagleIT do-not-reply at jboss.com
Fri Jun 1 04:14:25 EDT 2007


Hi. I will want to get a list of all object in my portal. I use the "PortalObjectContainer" service. So I have add this service in my "jboss-portlet.xml" :

  | <service>
  | 	<service-name>PortalObjectContainer</service-name>
  | 	<service-class> org.jboss.portal.core.model.portal.PortalObjectContainer
  | 	</service-class>
  | 	<service-ref>:container=PortalObject</service-ref>
  | </service>
  | 

And after, I have create this class :


  | @Name("portletInfo")
  | @Scope(ScopeType.SESSION)
  | public class PortletInfo {
  | 
  |   PortletContext portletContext;
  |   
  |   @Create
  |   public void initPortletInfo() {
  |     Object requete = FacesContext.getCurrentInstance().getExternalContext().getRequest();
  |     if (requete instanceof RenderRequest) {
  |       this.portletContext = (PortletContext) ((RenderRequest) requete).getAttribute("javax.portlet.PortletContext");
  | 
  |     }
  |   }
  | 
  |   /**
  |    * Retourne la valeur de portletContext.
  |    * 
  |    * @return valeur de portletContext.
  |    */
  |   public PortletContext getPortletContext() {
  |     return this.portletContext;
  |   }
  | 
  |   /**
  |    * Définit la valeur de portletContext.
  |    * 
  |    * @param portletContext valeur de portletContext à définir.
  |    */
  |   public void setPortletContext(PortletContext portletContext) {
  |     this.portletContext = portletContext;
  |   }
  | 

I use this class to get my service :

  | @Name("dashboardManager")
  | public class DashboardManager {
  | 
  |   List<SelectItem> lstPortalObject;
  | 
  | 
  |   @In(create = true)
  |   PortletInfo portletInfo;
  | 
  |   @Create
  |   public void initialize() {
  |     initLstPortalObject();
  |   }
  | 
  |   public void initLstPortalObject() {
  |     // chargement de la liste des PortalObject
  |     this.lstPortalObject = new ArrayList<SelectItem>();
  |     PortalObjectContainer objectContainer = (PortalObjectContainer) this.portletInfo.getPortletContext().getAttribute("PortalObjectContainer");
  |     Collection<PortalObject> colPort = objectContainer.getRootObject().getChildren();
  |     for (PortalObject object : colPort) {
  |       this.lstPortalObject.add(new SelectItem(object, object.getName()));
  |     }
  | 
  |   }
  | 
  |   /**
  |    * Retourne la valeur de lstPortalObject.
  |    * 
  |    * @return valeur de lstPortalObject.
  |    */
  | 
  |   public List<SelectItem> getLstPortalObject() {
  |     return this.lstPortalObject;
  |   }
  | 
  |   /**
  |    * Définit la valeur de lstPortalObject.
  |    * 
  |    * @param lstPortalObject valeur de lstPortalObject à définir.
  |    */
  |   public void setLstPortalObject(List<SelectItem> lstPortalObject) {
  |     this.lstPortalObject = lstPortalObject;
  |   }
  | }
  | 

And in my "*.xhtml", I put the lstPortelObject in a "selectManyListbox". When I deploy my portal, there is no error, but when I execute it, there is this error :

  | 09:55:53,536 ERROR [D2DFaceletViewHandler] Problem in renderResponse: Unable to locate current JTA transaction
  | 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:541)
  | 	at org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer.getObjectNode(PersistentPortalObjectContainer.java:246)
  | 	at org.jboss.portal.core.impl.model.portal.AbstractPortalObjectContainer.getObject(AbstractPortalObjectContainer.java:141)
  | 	at org.jboss.portal.core.impl.model.portal.AbstractPortalObjectContainer.getRootObject(AbstractPortalObjectContainer.java:92)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  | 	at java.lang.reflect.Method.invoke(Unknown Source)
  | 	at org.jboss.mx.interceptor.AttributeDispatcher.invoke(AttributeDispatcher.java:99)
  | 	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
  | 	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
  | 	at org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor.invoke(ModelMBeanAttributeInterceptor.java:197)
  | 	at org.jboss.mx.interceptor.PersistenceInterceptor.invoke(PersistenceInterceptor.java:76)
  | ...
  | ...
  | 

Can you help me please.
Best regards.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050414#4050414

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050414




More information about the jboss-user mailing list