org.hibernate.PropertyAccessException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • hibernate JNDI error
    via Stack Overflow by zeusakm
    ,
  • Hibernate "No CurrenetSessionContext "Error
    via Stack Overflow by EdgeCase
    ,
  • Setting the exposeTransactionAwareSessionFactory property on a Hibernate 3 LocationSessionFactoryBean to false will break transactional tests. Is this expected? It made me scratch my head for a while so I thought I'd report it. For instance, the following config: <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="..." /> <property name="exposeTransactionAwareSessionFactory" value="false"/> <property name="hibernateProperties"> <props>...</props> </property> <property name="mappingDirectoryLocations" ref="..." /> <property name="mappingLocations" ref="..."/> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> Will cause this test to fail: @ContextConfiguration(locations = { "classpath:beans.xml" }) public class TestNGTest extends AbstractTransactionalTestNGSpringContextTests { @Autowired private SessionFactory sessionFactory; @Test public void testStuff() { sessionFactory.getCurrentSession().flush(); } } The same is true if you rewrite the test using classing JUnit: public class JUnitTest extends AbstractTransactionalSpringContextTests { private SessionFactory sessionFactory; protected String[] getConfigLocations() { return new String[] { "classpath:beans.xml" }; } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } @Test public void testStuff() { sessionFactory.getCurrentSession().flush(); } } The error you get is: org.hibernate.HibernateException: No CurrentSessionContext configured! at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542) at foo.bar.TestNGTest.testStuff(TestNGTest.java:19) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:146)
    via by Erwin Vervaet,
  • Setting the exposeTransactionAwareSessionFactory property on a Hibernate 3 LocationSessionFactoryBean to false will break transactional tests. Is this expected? It made me scratch my head for a while so I thought I'd report it. For instance, the following config: <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="..." /> <property name="exposeTransactionAwareSessionFactory" value="false"/> <property name="hibernateProperties"> <props>...</props> </property> <property name="mappingDirectoryLocations" ref="..." /> <property name="mappingLocations" ref="..."/> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> Will cause this test to fail: @ContextConfiguration(locations = { "classpath:beans.xml" }) public class TestNGTest extends AbstractTransactionalTestNGSpringContextTests { @Autowired private SessionFactory sessionFactory; @Test public void testStuff() { sessionFactory.getCurrentSession().flush(); } } The same is true if you rewrite the test using classing JUnit: public class JUnitTest extends AbstractTransactionalSpringContextTests { private SessionFactory sessionFactory; protected String[] getConfigLocations() { return new String[] { "classpath:beans.xml" }; } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } @Test public void testStuff() { sessionFactory.getCurrentSession().flush(); } } The error you get is: org.hibernate.HibernateException: No CurrentSessionContext configured! at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542) at foo.bar.TestNGTest.testStuff(TestNGTest.java:19) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:146)
    via by Erwin Vervaet,
    • org.hibernate.PropertyAccessException: could not get a field value by reflection getter of x.chalkboard.delivery.model.ChalkboardDelivery.user at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:35) at org.hibernate.tuple.entity.AbstractEntityTuplizer.getPropertyValues(AbstractEntityTuplizer.java:256) at org.hibernate.tuple.entity.PojoEntityTuplizer.getPropertyValues(PojoEntityTuplizer.java:209) at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyValues(AbstractEntityPersister.java:3576) at org.hibernate.event.def.AbstractVisitor.process(AbstractVisitor.java:123) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:293) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:223) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:89) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495) at x.common.dao.hibernate.HModelDao.save(Unknown Source) at x.common.dao.hibernate.HDeliveryDao.save(Unknown Source) at x.common.dao.hibernate.HDeliveryDao.save(Unknown Source) 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:296) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:155) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy19.save(Unknown Source) at x.chalkboard.services.ChalkboardAdminService$1.run(Unknown Source) at x.common.util.LowPriorityRunnableQueue.run(Unknown Source) at java.lang.Thread.run(Thread.java:595) Caused by: com.tc.exception.TCRuntimeException: com.tc.exception.TCRuntimeException: java.lang.reflect.InvocationTargetException at com.tc.object.ClientObjectManagerImpl.createNewPeer(ClientObjectManagerImpl.java:1043) at com.tc.object.TCObjectImpl.createPeerObjectIfNecessary(TCObjectImpl.java:176) at com.tc.object.TCObjectImpl.hydrate(TCObjectImpl.java:104) at com.tc.object.ClientObjectManagerImpl.lookup(ClientObjectManagerImpl.java:521) at com.tc.object.ClientObjectManagerImpl.lookupObject(ClientObjectManagerImpl.java:418) at com.tc.object.ClientObjectManagerImpl.lookupObject(ClientObjectManagerImpl.java:407) at com.tc.object.TCObjectPhysical.resolveReference(TCObjectPhysical.java:133) at x.common.model.Delivery.__tc_getuser(Unknown Source) at x.common.model.Delivery.__tc_getmanagedfield(Unknown Source) at x.chalkboard.delivery.model.ChalkboardDelivery.__tc_getmanagedfield(Unknown Source) at com.tc.util.FieldUtils.resolveReference(FieldUtils.java:212) at com.tc.util.FieldUtils.get(FieldUtils.java:38) at java.lang.reflect.Field.get(Field.java) at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:32) ... 28 more Caused by: com.tc.exception.TCRuntimeException: java.lang.reflect.InvocationTargetException at org.terracotta.modules.hibernate_3_1_2.object.applicator.HibernateProxyApplicator.getSession(HibernateProxyApplicator.java:271) at org.terracotta.modules.hibernate_3_1_2.object.applicator.HibernateProxyApplicator.getNewInstance(HibernateProxyApplicator.java:202) at com.tc.object.TCClassImpl.getNewInstanceFromNonDefaultConstructor(TCClassImpl.java:343) at com.tc.object.TCObjectFactoryImpl.getNewPeerObject(TCObjectFactoryImpl.java:50) at com.tc.object.ClientObjectManagerImpl.createNewPeer(ClientObjectManagerImpl.java:1041) ... 41 more Caused by: java.lang.reflect.InvocationTargetException 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.terracotta.modules.hibernate_3_1_2.object.applicator.HibernateProxyApplicator.getSession(HibernateProxyApplicator.java:257) ... 45 more Caused by: org.hibernate.HibernateException: No CurrentSessionContext configured! at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542) ... 50 more

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,