java.lang.NullPointerException

Spring JIRA | James Howe | 11 months ago
  1. 0

    This code works: {code:java} public class Entity { @PrimaryKeyColumn(ordinal = 0, type = PrimaryKeyType.PARTITIONED) private String col1; public String getCol1() { return col1; } @PrimaryKeyColumn(ordinal = 1) private String col2; public String getCol2() { return col2; } } {code} This code doesn't: {code:java} public class Entity { private String col1; @PrimaryKeyColumn(ordinal = 0, type = PrimaryKeyType.PARTITIONED) public String getCol1() { return col1; } private String col2; @PrimaryKeyColumn(ordinal = 1) public String getCol2() { return col2; } } {code} Exception is: {noformat} java.lang.NullPointerException at org.springframework.data.cassandra.mapping.CassandraPrimaryKeyColumnAnnotationComparator.compare(CassandraPrimaryKeyColumnAnnotationComparator.java:46) at org.springframework.data.cassandra.mapping.CassandraPersistentPropertyComparator.compare(CassandraPersistentPropertyComparator.java:67) at org.springframework.data.cassandra.mapping.CassandraPersistentPropertyComparator.compare(CassandraPersistentPropertyComparator.java:29) at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) at java.util.TimSort.sort(TimSort.java:220) at java.util.Arrays.sort(Arrays.java:1512) at java.util.ArrayList.sort(ArrayList.java:1454) at java.util.Collections.sort(Collections.java:175) at org.springframework.data.mapping.model.BasicPersistentEntity.verify(BasicPersistentEntity.java:382) at org.springframework.data.cassandra.mapping.BasicCassandraPersistentEntity.verify(BasicCassandraPersistentEntity.java:196) at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:317) at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:276) at org.springframework.data.mapping.context.AbstractMappingContext.initialize(AbstractMappingContext.java:392) at org.springframework.data.cassandra.mapping.BasicCassandraMappingContext.initialize(BasicCassandraMappingContext.java:79) at org.springframework.data.mapping.context.AbstractMappingContext.afterPropertiesSet(AbstractMappingContext.java:382) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ... 119 more {noformat} This becomes a particular problem when the Entity is in a class hierarchy, as methods can be overridden but fields cannot.

    Spring JIRA | 11 months ago | James Howe
    java.lang.NullPointerException
  2. 0

    This code works: {code:java} public class Entity { @PrimaryKeyColumn(ordinal = 0, type = PrimaryKeyType.PARTITIONED) private String col1; public String getCol1() { return col1; } @PrimaryKeyColumn(ordinal = 1) private String col2; public String getCol2() { return col2; } } {code} This code doesn't: {code:java} public class Entity { private String col1; @PrimaryKeyColumn(ordinal = 0, type = PrimaryKeyType.PARTITIONED) public String getCol1() { return col1; } private String col2; @PrimaryKeyColumn(ordinal = 1) public String getCol2() { return col2; } } {code} Exception is: {noformat} java.lang.NullPointerException at org.springframework.data.cassandra.mapping.CassandraPrimaryKeyColumnAnnotationComparator.compare(CassandraPrimaryKeyColumnAnnotationComparator.java:46) at org.springframework.data.cassandra.mapping.CassandraPersistentPropertyComparator.compare(CassandraPersistentPropertyComparator.java:67) at org.springframework.data.cassandra.mapping.CassandraPersistentPropertyComparator.compare(CassandraPersistentPropertyComparator.java:29) at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) at java.util.TimSort.sort(TimSort.java:220) at java.util.Arrays.sort(Arrays.java:1512) at java.util.ArrayList.sort(ArrayList.java:1454) at java.util.Collections.sort(Collections.java:175) at org.springframework.data.mapping.model.BasicPersistentEntity.verify(BasicPersistentEntity.java:382) at org.springframework.data.cassandra.mapping.BasicCassandraPersistentEntity.verify(BasicCassandraPersistentEntity.java:196) at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:317) at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:276) at org.springframework.data.mapping.context.AbstractMappingContext.initialize(AbstractMappingContext.java:392) at org.springframework.data.cassandra.mapping.BasicCassandraMappingContext.initialize(BasicCassandraMappingContext.java:79) at org.springframework.data.mapping.context.AbstractMappingContext.afterPropertiesSet(AbstractMappingContext.java:382) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ... 119 more {noformat} This becomes a particular problem when the Entity is in a class hierarchy, as methods can be overridden but fields cannot.

    Spring JIRA | 11 months ago | James Howe
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    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

      No message provided

      at org.springframework.data.cassandra.mapping.CassandraPrimaryKeyColumnAnnotationComparator.compare()
    2. Spring Data Cassandra - Core
      CassandraPersistentPropertyComparator.compare
      1. org.springframework.data.cassandra.mapping.CassandraPrimaryKeyColumnAnnotationComparator.compare(CassandraPrimaryKeyColumnAnnotationComparator.java:46)
      2. org.springframework.data.cassandra.mapping.CassandraPersistentPropertyComparator.compare(CassandraPersistentPropertyComparator.java:67)
      3. org.springframework.data.cassandra.mapping.CassandraPersistentPropertyComparator.compare(CassandraPersistentPropertyComparator.java:29)
      3 frames
    3. Java RT
      Collections.sort
      1. java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
      2. java.util.TimSort.sort(TimSort.java:220)
      3. java.util.Arrays.sort(Arrays.java:1512)
      4. java.util.ArrayList.sort(ArrayList.java:1454)
      5. java.util.Collections.sort(Collections.java:175)
      5 frames
    4. Spring Data Core
      BasicPersistentEntity.verify
      1. org.springframework.data.mapping.model.BasicPersistentEntity.verify(BasicPersistentEntity.java:382)
      1 frame
    5. Spring Data Cassandra - Core
      BasicCassandraPersistentEntity.verify
      1. org.springframework.data.cassandra.mapping.BasicCassandraPersistentEntity.verify(BasicCassandraPersistentEntity.java:196)
      1 frame
    6. Spring Data Core
      AbstractMappingContext.initialize
      1. org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:317)
      2. org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:276)
      3. org.springframework.data.mapping.context.AbstractMappingContext.initialize(AbstractMappingContext.java:392)
      3 frames
    7. Spring Data Cassandra - Core
      BasicCassandraMappingContext.initialize
      1. org.springframework.data.cassandra.mapping.BasicCassandraMappingContext.initialize(BasicCassandraMappingContext.java:79)
      1 frame
    8. Spring Data Core
      AbstractMappingContext.afterPropertiesSet
      1. org.springframework.data.mapping.context.AbstractMappingContext.afterPropertiesSet(AbstractMappingContext.java:382)
      1 frame
    9. Spring Beans
      AbstractAutowireCapableBeanFactory.initializeBean
      1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
      2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
      2 frames