org.hibernate.PropertyAccessException

tip

Take a look at this blog post on how to set up Grid2 https://goo.gl/rxzbE6. A user related (in the email group on the source) that using older selenium libs solves this exception.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • With Hibernate, when I have an entity property that must not be {{null}}, I cat enforce in a fail-fast manner in the property setter {code} @Column(nullable = false) public String getName() { return name; } public void setName(String name) { this.name = checkNotNull(name, "name"); } {code} While this might be considered superfluous (a DB {{NOT NULL}} constraint exists anyway), I find this valuable, as -- as I said -- provides fail-fast validation. Now, if I want to have the property {{@Audited}} then during reading audit records for delete, Envers fails with {code} org.hibernate.PropertyAccessException: Exception occurred inside setter of com.syncron.bpp.security.entity.Role.name at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:88) at org.hibernate.envers.entities.mapper.SinglePropertyMapper.mapToEntityFromMap(SinglePropertyMapper.java:96) at org.hibernate.envers.entities.mapper.MultiPropertyMapper.mapToEntityFromMap(MultiPropertyMapper.java:137) at org.hibernate.envers.entities.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:109) at org.hibernate.envers.query.impl.RevisionsOfEntityQuery.list(RevisionsOfEntityQuery.java:134) at org.hibernate.envers.query.impl.AbstractAuditQuery.getResultList(AbstractAuditQuery.java:106) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:65) ... 51 more Caused by: java.lang.NullPointerException: name at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:208) at com.example.MyEntity.setName(Role.java:126) ... 56 more {code} This might be logical, since there is no "name" stored in AUD table, but I've never told Envers to call my setter in this case. Why would it call it if it knows the data is all nulls?
    via by Piotr Findeisen,
  • With Hibernate, when I have an entity property that must not be {{null}}, I cat enforce in a fail-fast manner in the property setter {code} @Column(nullable = false) public String getName() { return name; } public void setName(String name) { this.name = checkNotNull(name, "name"); } {code} While this might be considered superfluous (a DB {{NOT NULL}} constraint exists anyway), I find this valuable, as -- as I said -- provides fail-fast validation. Now, if I want to have the property {{@Audited}} then during reading audit records for delete, Envers fails with {code} org.hibernate.PropertyAccessException: Exception occurred inside setter of com.syncron.bpp.security.entity.Role.name at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:88) at org.hibernate.envers.entities.mapper.SinglePropertyMapper.mapToEntityFromMap(SinglePropertyMapper.java:96) at org.hibernate.envers.entities.mapper.MultiPropertyMapper.mapToEntityFromMap(MultiPropertyMapper.java:137) at org.hibernate.envers.entities.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:109) at org.hibernate.envers.query.impl.RevisionsOfEntityQuery.list(RevisionsOfEntityQuery.java:134) at org.hibernate.envers.query.impl.AbstractAuditQuery.getResultList(AbstractAuditQuery.java:106) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:65) ... 51 more Caused by: java.lang.NullPointerException: name at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:208) at com.example.MyEntity.setName(Role.java:126) ... 56 more {code} This might be logical, since there is no "name" stored in AUD table, but I've never told Envers to call my setter in this case. Why would it call it if it knows the data is all nulls?
    via by Piotr Findeisen,
  • jClouds Swift Bloblist NullPointerException
    via by Unknown author,
  • Graphic issues
    via GitHub by skaldarnar
    ,
  • IDEA 14 plugin exception
    via GitHub by lrozenblyum
    ,
  • BungeeCord error. Cant Login.
    via GitHub by Nojus741
    ,
  • Android build system gradle
    via Stack Overflow by endian
    ,
  • exception on geogit diff
    via GitHub by bartvde
    ,
    • org.hibernate.PropertyAccessException: Exception occurred inside setter of com.syncron.bpp.security.entity.Role.name at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:88) at org.hibernate.envers.entities.mapper.SinglePropertyMapper.mapToEntityFromMap(SinglePropertyMapper.java:96) at org.hibernate.envers.entities.mapper.MultiPropertyMapper.mapToEntityFromMap(MultiPropertyMapper.java:137) at org.hibernate.envers.entities.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:109) at org.hibernate.envers.query.impl.RevisionsOfEntityQuery.list(RevisionsOfEntityQuery.java:134) at org.hibernate.envers.query.impl.AbstractAuditQuery.getResultList(AbstractAuditQuery.java:106) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:65) ... 6 more Caused by: java.lang.NullPointerException: name at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:208) at com.example.MyEntity.setName(Role.java:126) ... 11 more

    Users with the same issue

    Pilleo
    1 times, last one,
    Unknown visitor1 times, last one,
    Andreas Häber
    1 times, last one,
    Indri Yunita
    3 times, last one,
    jstrayer
    1 times, last one,
    83 more bugmates