org.hibernate.PropertyAccessException: Exception occurred inside setter of com.syncron.bpp.security.entity.Role.name

Hibernate JIRA | Piotr Findeisen | 3 years ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael . Or join the community to write better ones.
  1. 0

    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?

    Hibernate JIRA | 3 years ago | Piotr Findeisen
    org.hibernate.PropertyAccessException: Exception occurred inside setter of com.syncron.bpp.security.entity.Role.name
  2. 0

    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?

    Hibernate JIRA | 3 years ago | Piotr Findeisen
    org.hibernate.PropertyAccessException: Exception occurred inside setter of com.syncron.bpp.security.entity.Role.name
  3. 0
    samebug 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.
    via gmane.org
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    jClouds Swift Bloblist NullPointerException

    Stack Overflow | 2 years ago
    org.jclouds.http.HttpResponseException: Error parsing input: name {statusCode=200, message=OK, headers={Transfer-Encoding=[chunked], Server=[Apache], Date=[Fri, 01 May 2015 03:35:09 GMT]}, payload=[content=true, contentMetadata=[contentDisposition=null, contentEncoding=null, contentLanguage=null, contentLength=null, contentMD5=null, contentType=application/json; charset=utf-8, expires=null], written=false]}
  6. 0

    Graphic issues

    GitHub | 4 years ago | skaldarnar
    java.lang.NullPointerException: Vertex elements for chunk mesh segment #0 must not be null
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.NullPointerException

    name

    at com.google.common.base.Preconditions.checkNotNull()
  2. Guava
    Preconditions.checkNotNull
    1. com.google.common.base.Preconditions.checkNotNull(Preconditions.java:208)
    1 frame
  3. com.example
    MyEntity.setName
    1. com.example.MyEntity.setName(Role.java:126)
    1 frame
  4. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:606)
    4 frames
  5. Hibernate
    BasicPropertyAccessor$BasicSetter.set
    1. org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:65)
    2. org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:88)
    2 frames
  6. A Hibernate O/RM Module
    AbstractAuditQuery.getResultList
    1. org.hibernate.envers.entities.mapper.SinglePropertyMapper.mapToEntityFromMap(SinglePropertyMapper.java:96)
    2. org.hibernate.envers.entities.mapper.MultiPropertyMapper.mapToEntityFromMap(MultiPropertyMapper.java:137)
    3. org.hibernate.envers.entities.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:109)
    4. org.hibernate.envers.query.impl.RevisionsOfEntityQuery.list(RevisionsOfEntityQuery.java:134)
    5. org.hibernate.envers.query.impl.AbstractAuditQuery.getResultList(AbstractAuditQuery.java:106)
    5 frames