Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Ram J
No Hibernate Session bound to thread, and configuration does not allow crea
15. April 2009 03:55
Antwort

Ram J

Rang: New Member

Nachrichten: 1

Eintrittsdatum: 15. April 2009

Neue Beiträge

HI,

I tried to write a portlet, when I run the portlet I was getting an error as below. plz help me out.

2009-04-15 14:24:45,762 [http-8080-Processor21] ERROR com.liferay.portal.service.persistence.impl.BasePersistenceImpl - Caught unexpected exception org.hibernate.HibernateException
2009-04-15 14:24:49,545 [http-8080-Processor21] ERROR portal-web.docroot.html.portal.render_portlet.jsp - com.liferay.portal.SystemException: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.processException(BasePersistenceImpl.java:91)
at com.ext.portlet.access.service.persistence.AccessPersistenceImpl.applyAccessPersistence(AccessPersistenceImpl.java:29)
at com.ext.portlet.access.service.impl.AccessLocalServiceImpl.applyAccess(AccessLocalServiceImpl.java:18)
at com.ext.portlet.access.service.impl.AccessServiceImpl.applyAccess(AccessServiceImpl.java:10)
at com.ext.portlet.access.service.AccessServiceUtil.applyAccess(AccessServiceUtil.java:8)
at com.ext.portlet.access.action.ViewAccessAction.processAction(ViewAccessAction.java:43)
at com.liferay.portal.struts.PortletRequestProcessor.process(PortletRequestProcessor.java:180)
at com.liferay.portlet.StrutsPortlet.processAction(StrutsPortlet.java:197)
at com.sun.portal.portletcontainer.appengine.filter.FilterChainImpl.doFilter(FilterChainImpl.java:98)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:57)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:630)
at com.liferay.portlet.InvokerPortletImpl.invokeAction(InvokerPortletImpl.java:662)
at com.liferay.portlet.InvokerPortletImpl.processAction(InvokerPortletImpl.java:357)
at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:591)
at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:419)
at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:191)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:159)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
Caused by: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
at com.liferay.portal.spring.hibernate.SessionFactoryInvocationHandler.invoke(SessionFactoryInvocationHandler.java:68)
at $Proxy1.getCurrentSession(Unknown Source)
at com.liferay.portal.dao.orm.hibernate.SessionFactoryImpl.openSession(SessionFactoryImpl.java:50)
at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.openSession(BasePersistenceImpl.java:67)
at com.ext.portlet.access.service.persistence.AccessPersistenceImpl.applyAccessPersistence(AccessPersistenceImpl.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy307.applyAccessPersistence(Unknown Source)
at com.ext.portlet.access.service.impl.AccessLocalServiceImpl.applyAccess(AccessLocalServiceImpl.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy306.applyAccess(Unknown Source)
at com.ext.portlet.access.service.impl.AccessServiceImpl.applyAccess(AccessServiceImpl.java:10)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy308.applyAccess(Unknown Source)
at com.ext.portlet.access.service.AccessServiceUtil.applyAccess(AccessServiceUtil.java:8)
at com.ext.portlet.access.action.ViewAccessAction.processAction(ViewAccessAction.java:43)
at com.liferay.portal.struts.PortletRequestProcessor.process(PortletRequestProcessor.java:180)
at com.liferay.portlet.StrutsPortlet.processAction(StrutsPortlet.java:197)
at com.sun.portal.portletcontainer.appengine.filter.FilterChainImpl.doFilter(FilterChainImpl.java:98)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:57)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:630)
at com.liferay.portlet.InvokerPortletImpl.invokeAction(InvokerPortletImpl.java:662)
at com.liferay.portlet.InvokerPortletImpl.processAction(InvokerPortletImpl.java:357)
at com.liferay.portal.action.LayoutAction.processPortletRequest


and the code in persistence impl as follows.

Session session = null;

try {
session = openSession(); // here I was getting an error
session.save(access);
session.flush();
return access;


plz help me on this ASAP.

Thanks
Ram.
gianluca maranzana
RE: No Hibernate Session bound to thread, and configuration does not allow
4. März 2010 01:02
Antwort

gianluca maranzana

Rang: Junior Member

Nachrichten: 26

Eintrittsdatum: 30. Juli 2008

Neue Beiträge

Put in portal-ext.properties hibernate.connection.release_mode=auto, this may help.

If not, consider to modify your SessionFactoryInvocationHandler.java invoke method (put a "retry" call in catch), as below:

if (methodName.equals("getCurrentSession")) {
try { session = (Session)SessionFactoryUtils.doGetSession(
(SessionFactory)proxy, false);
} catch (IllegalStateException ise) {
session = (Session)SessionFactoryUtils.doGetSession(
(SessionFactory)proxy, true); // FALSE --> TRUE
} finally { return wrapLiferaySession(session);
}


This will give you a chance (it's only a workaround....not a fix).

G.
Mahmudur Rahman Manna
RE: No Hibernate Session bound to thread, and configuration does not allow
28. Dezember 2010 23:11
Antwort

Mahmudur Rahman Manna

Rang: New Member

Nachrichten: 7

Eintrittsdatum: 9. Juli 2010

Neue Beiträge

There is some change in localServiceImpl classes referring persistence beans

like in 5.2.3 it was @BeanReference(name = XYZ)
But in 6.0.5 they are using @BeanReference(type = XYZPersistence.class)
So here you have to be careful about defining beans in portlet-spring.xml and put id of the bean as full qualified name of the Interface otherwise it wont find that..

This worked for me... Hope it would come to your help also..