java.lang.IllegalAccessError: tried to access class org.springframework.beans.PropertyMatches from class org.springframework.data.mapping.PropertyReferenceException

Spring JIRA | Stefan Kuehnel | 1 year ago
  1. 0

    I've created an application that tries to read entries from a MongoDB which were written with Log4j's NoSQL Appender. In a SpringBatch job which uses MongoItemReader the following query {code} { millis: { $gt : 1441000000 } } {code} causes this exception: Stacktrace: {code} java.lang.IllegalAccessError: tried to access class org.springframework.beans.PropertyMatches from class org.springframework.data.mapping.PropertyReferenceException at org.springframework.data.mapping.PropertyReferenceException.detectPotentialMatches(PropertyReferenceException.java:134) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mapping.PropertyReferenceException.<init>(PropertyReferenceException.java:59) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.getPath(QueryMapper.java:843) ~[QueryMapper$MetadataBackedField.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.<init>(QueryMapper.java:735) ~[QueryMapper$MetadataBackedField.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.with(QueryMapper.java:746) ~[QueryMapper$MetadataBackedField.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.with(QueryMapper.java:692) ~[QueryMapper$MetadataBackedField.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper.getMappedKeyword(QueryMapper.java:263) ~[QueryMapper.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObjectForField(QueryMapper.java:200) ~[QueryMapper.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObject(QueryMapper.java:123) ~[QueryMapper.class:?] at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1700) ~[spring-data-mongodb-1.8.0.RELEASE.jar:?] {code} When I patch the method getMappedKeyword as follows, the exception does not occur: {code} protected DBObject getMappedKeyword(Field property, Keyword keyword) { boolean needsAssociationConversion = property.isAssociation() && !keyword.isExists(); Object value = keyword.getValue(); Object convertedValue = value; // PATCH if (!isKeyword(keyword.getKey())) { convertedValue = needsAssociationConversion ? convertAssociation(value, property) : getMappedValue(property.with(keyword.getKey()), value); } return new BasicDBObject(keyword.key, convertedValue); } {code} Here's an excerpt from the batch configuration (full version: see attachment): {code} <bean id="itemReader" class="org.springframework.batch.item.data.MongoItemReader"> <property name="template" ref="mongoTemplate"/> <!-- This one causes the error --> <property name="query" value="{ millis: { $gt : 1441000000 } }"/> <!-- This one works --> <!-- <property name="query" value='{level: "INFO"}' /> --> <property name="sort> <map> <entry key="millis" value="#{T(org.springframework.data.domain.Sort.Direction).ASC}"/> </map> </property> <property name="collection" value="LOGGING"/> <property name="targetType" value="com.lpsolutions.springdatademo.domain.LogEntryEntity"/> </bean> {code}

    Spring JIRA | 1 year ago | Stefan Kuehnel
    java.lang.IllegalAccessError: tried to access class org.springframework.beans.PropertyMatches from class org.springframework.data.mapping.PropertyReferenceException
  2. 0

    I've created an application that tries to read entries from a MongoDB which were written with Log4j's NoSQL Appender. In a SpringBatch job which uses MongoItemReader the following query {code} { millis: { $gt : 1441000000 } } {code} causes this exception: Stacktrace: {code} java.lang.IllegalAccessError: tried to access class org.springframework.beans.PropertyMatches from class org.springframework.data.mapping.PropertyReferenceException at org.springframework.data.mapping.PropertyReferenceException.detectPotentialMatches(PropertyReferenceException.java:134) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mapping.PropertyReferenceException.<init>(PropertyReferenceException.java:59) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270) ~[spring-data-commons-1.11.0.RELEASE.jar:?] at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.getPath(QueryMapper.java:843) ~[QueryMapper$MetadataBackedField.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.<init>(QueryMapper.java:735) ~[QueryMapper$MetadataBackedField.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.with(QueryMapper.java:746) ~[QueryMapper$MetadataBackedField.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.with(QueryMapper.java:692) ~[QueryMapper$MetadataBackedField.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper.getMappedKeyword(QueryMapper.java:263) ~[QueryMapper.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObjectForField(QueryMapper.java:200) ~[QueryMapper.class:?] at org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObject(QueryMapper.java:123) ~[QueryMapper.class:?] at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1700) ~[spring-data-mongodb-1.8.0.RELEASE.jar:?] {code} When I patch the method getMappedKeyword as follows, the exception does not occur: {code} protected DBObject getMappedKeyword(Field property, Keyword keyword) { boolean needsAssociationConversion = property.isAssociation() && !keyword.isExists(); Object value = keyword.getValue(); Object convertedValue = value; // PATCH if (!isKeyword(keyword.getKey())) { convertedValue = needsAssociationConversion ? convertAssociation(value, property) : getMappedValue(property.with(keyword.getKey()), value); } return new BasicDBObject(keyword.key, convertedValue); } {code} Here's an excerpt from the batch configuration (full version: see attachment): {code} <bean id="itemReader" class="org.springframework.batch.item.data.MongoItemReader"> <property name="template" ref="mongoTemplate"/> <!-- This one causes the error --> <property name="query" value="{ millis: { $gt : 1441000000 } }"/> <!-- This one works --> <!-- <property name="query" value='{level: "INFO"}' /> --> <property name="sort> <map> <entry key="millis" value="#{T(org.springframework.data.domain.Sort.Direction).ASC}"/> </map> </property> <property name="collection" value="LOGGING"/> <property name="targetType" value="com.lpsolutions.springdatademo.domain.LogEntryEntity"/> </bean> {code}

    Spring JIRA | 1 year ago | Stefan Kuehnel
    java.lang.IllegalAccessError: tried to access class org.springframework.beans.PropertyMatches from class org.springframework.data.mapping.PropertyReferenceException
  3. 0

    Spring Data MongoDB failed with "in" query

    Stack Overflow | 1 year ago | matrix
    java.lang.IllegalAccessError: tried to access class org.springframework.beans.PropertyMatches from class org.springframework.data.mapping.PropertyReferenceException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    IllegalAccessError Query Mongodb

    Stack Overflow | 2 weeks ago | http200
    java.lang.IllegalAccessError: tried to access class org.springframework.beans.PropertyMatches from class org.springframework.data.mapping.PropertyReferenceException
  6. 0

    tried to access class org.springframework.beans.PropertyMatches from class org.springframework.data.mapping.PropertyReferenceException

    Stack Overflow | 8 months ago | PotteryOrchid
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.chaoke.smart.repo.CompanyRepo com.chaoke.smart.service.impl.CompanyServiceImpl.companyRepo; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyRepo': Invocation of init method failed; nested exception is java.lang.IllegalAccessError: tried to access class org.springframework.beans.PropertyMatches from class org.springframework.data.mapping.PropertyReferenceException

    4 unregistered visitors
    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.IllegalAccessError

      tried to access class org.springframework.beans.PropertyMatches from class org.springframework.data.mapping.PropertyReferenceException

      at org.springframework.data.mapping.PropertyReferenceException.detectPotentialMatches()
    2. Spring Data Core
      PropertyPath.from
      1. org.springframework.data.mapping.PropertyReferenceException.detectPotentialMatches(PropertyReferenceException.java:134)[spring-data-commons-1.11.0.RELEASE.jar:?]
      2. org.springframework.data.mapping.PropertyReferenceException.<init>(PropertyReferenceException.java:59)[spring-data-commons-1.11.0.RELEASE.jar:?]
      3. org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75)[spring-data-commons-1.11.0.RELEASE.jar:?]
      4. org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327)[spring-data-commons-1.11.0.RELEASE.jar:?]
      5. org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307)[spring-data-commons-1.11.0.RELEASE.jar:?]
      6. org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270)[spring-data-commons-1.11.0.RELEASE.jar:?]
      6 frames
    3. Spring Data MongoDB - Core
      MongoTemplate.doFind
      1. org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.getPath(QueryMapper.java:843)[QueryMapper$MetadataBackedField.class:?]
      2. org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.<init>(QueryMapper.java:735)[QueryMapper$MetadataBackedField.class:?]
      3. org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.with(QueryMapper.java:746)[QueryMapper$MetadataBackedField.class:?]
      4. org.springframework.data.mongodb.core.convert.QueryMapper$MetadataBackedField.with(QueryMapper.java:692)[QueryMapper$MetadataBackedField.class:?]
      5. org.springframework.data.mongodb.core.convert.QueryMapper.getMappedKeyword(QueryMapper.java:263)[QueryMapper.class:?]
      6. org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObjectForField(QueryMapper.java:200)[QueryMapper.class:?]
      7. org.springframework.data.mongodb.core.convert.QueryMapper.getMappedObject(QueryMapper.java:123)[QueryMapper.class:?]
      8. org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1700)[spring-data-mongodb-1.8.0.RELEASE.jar:?]
      8 frames