java.lang.StackOverflowError

DataStax JIRA | Roman Kondrashov | 1 year ago
  1. 0

    Hi folks, I tried to persisit a tree structure using UDT and mapper, but got a StackOverflowError. The problem is the endless recursion on UDT mapper creation for the circular referenced class member. h4. Cassandra-KS: {code:title=tree.cql|borderStyle=solid} CREATE KEYSPACE tree_test WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; CREATE TYPE tree_test.node ( name text, ); ALTER TYPE tree_test.node ADD children frozen<list<tree_test.node>>; CREATE TABLE tree_test.tree ( id uuid PRIMARY KEY, children frozen<list<tree_test.node>> ); {code} h4.Node UDT: {code:title=Node.java|borderStyle=solid} @UDT(keyspace = "tree_test", name = "node") public class Node { private String name; private List<Node> childeren; // getters and setters omitted } {code} h4.Tree table {code:title=Tree.java|borderStyle=solid} @Table(keyspace = "tree_test", name = "tree") public class Tree { @PartitionKey private UUID id; @FrozenValue List<Node> children; // getters and setters omitted } {code} h4.Test class {code:title=TreeTest.java|borderStyle=solid} public class TreeTest { @Test public void testMapper() { Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build(); Session session = cluster.connect(); MappingManager manager = new ExtendedMappingManager(session); UDTMapper<Node> mapper = manager.udtMapper(Node.class); assertNotNull(mapper); } } {code} h4.Stacktrace {code} java.lang.StackOverflowError at java.lang.Character.toUpperCaseEx(Character.java:7138) at java.lang.String.toUpperCase(String.java:2729) at java.beans.NameGenerator.capitalize(NameGenerator.java:82) at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:71) at com.datastax.driver.mapping.ReflectionMapper$ReflectionFactory.createColumnMapper(ReflectionMapper.java:209) at com.datastax.driver.mapping.ExtendedMappingManager.convert(ExtendedMappingManager.java:107) at com.datastax.driver.mapping.ExtendedMappingManager.parseUDT(ExtendedMappingManager.java:98) at com.datastax.driver.mapping.ExtendedMappingManager.getUDTMapper(ExtendedMappingManager.java:40) at com.datastax.driver.mapping.MappingManager.udtMapper(MappingManager.java:123) at com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:84) at com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:65) at com.datastax.driver.mapping.InferredCQLType.from(InferredCQLType.java:43) at com.datastax.driver.mapping.ReflectionMapper$ReflectionFactory.createColumnMapper(ReflectionMapper.java:221) at com.datastax.driver.mapping.ExtendedMappingManager.convert(ExtendedMappingManager.java:107) at com.datastax.driver.mapping.ExtendedMappingManager.parseUDT(ExtendedMappingManager.java:98) at com.datastax.driver.mapping.ExtendedMappingManager.getUDTMapper(ExtendedMappingManager.java:40) at com.datastax.driver.mapping.MappingManager.udtMapper(MappingManager.java:123) at com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:84) at com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:65) at com.datastax.driver.mapping.InferredCQLType.from(InferredCQLType.java:43) .................... {code}

    DataStax JIRA | 1 year ago | Roman Kondrashov
    java.lang.StackOverflowError
  2. 0

    Hi folks, I tried to persisit a tree structure using UDT and mapper, but got a StackOverflowError. The problem is the endless recursion on UDT mapper creation for the circular referenced class member. h4. Cassandra-KS: {code:title=tree.cql|borderStyle=solid} CREATE KEYSPACE tree_test WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; CREATE TYPE tree_test.node ( name text, ); ALTER TYPE tree_test.node ADD children frozen<list<tree_test.node>>; CREATE TABLE tree_test.tree ( id uuid PRIMARY KEY, children frozen<list<tree_test.node>> ); {code} h4.Node UDT: {code:title=Node.java|borderStyle=solid} @UDT(keyspace = "tree_test", name = "node") public class Node { private String name; private List<Node> childeren; // getters and setters omitted } {code} h4.Tree table {code:title=Tree.java|borderStyle=solid} @Table(keyspace = "tree_test", name = "tree") public class Tree { @PartitionKey private UUID id; @FrozenValue List<Node> children; // getters and setters omitted } {code} h4.Test class {code:title=TreeTest.java|borderStyle=solid} public class TreeTest { @Test public void testMapper() { Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build(); Session session = cluster.connect(); MappingManager manager = new ExtendedMappingManager(session); UDTMapper<Node> mapper = manager.udtMapper(Node.class); assertNotNull(mapper); } } {code} h4.Stacktrace {code} java.lang.StackOverflowError at java.lang.Character.toUpperCaseEx(Character.java:7138) at java.lang.String.toUpperCase(String.java:2729) at java.beans.NameGenerator.capitalize(NameGenerator.java:82) at java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:71) at com.datastax.driver.mapping.ReflectionMapper$ReflectionFactory.createColumnMapper(ReflectionMapper.java:209) at com.datastax.driver.mapping.ExtendedMappingManager.convert(ExtendedMappingManager.java:107) at com.datastax.driver.mapping.ExtendedMappingManager.parseUDT(ExtendedMappingManager.java:98) at com.datastax.driver.mapping.ExtendedMappingManager.getUDTMapper(ExtendedMappingManager.java:40) at com.datastax.driver.mapping.MappingManager.udtMapper(MappingManager.java:123) at com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:84) at com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:65) at com.datastax.driver.mapping.InferredCQLType.from(InferredCQLType.java:43) at com.datastax.driver.mapping.ReflectionMapper$ReflectionFactory.createColumnMapper(ReflectionMapper.java:221) at com.datastax.driver.mapping.ExtendedMappingManager.convert(ExtendedMappingManager.java:107) at com.datastax.driver.mapping.ExtendedMappingManager.parseUDT(ExtendedMappingManager.java:98) at com.datastax.driver.mapping.ExtendedMappingManager.getUDTMapper(ExtendedMappingManager.java:40) at com.datastax.driver.mapping.MappingManager.udtMapper(MappingManager.java:123) at com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:84) at com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:65) at com.datastax.driver.mapping.InferredCQLType.from(InferredCQLType.java:43) .................... {code}

    DataStax JIRA | 1 year ago | Roman Kondrashov
    java.lang.StackOverflowError
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Unable to trace the source of a stack overflow error

    Stack Overflow | 5 years ago | David
    java.lang.StackOverflowError

    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.StackOverflowError

      No message provided

      at java.lang.Character.toUpperCaseEx()
    2. Java RT
      PropertyDescriptor.<init>
      1. java.lang.Character.toUpperCaseEx(Character.java:7138)
      2. java.lang.String.toUpperCase(String.java:2729)
      3. java.beans.NameGenerator.capitalize(NameGenerator.java:82)
      4. java.beans.PropertyDescriptor.<init>(PropertyDescriptor.java:71)
      4 frames
    3. com.datastax.driver
      InferredCQLType.from
      1. com.datastax.driver.mapping.ReflectionMapper$ReflectionFactory.createColumnMapper(ReflectionMapper.java:209)
      2. com.datastax.driver.mapping.ExtendedMappingManager.convert(ExtendedMappingManager.java:107)
      3. com.datastax.driver.mapping.ExtendedMappingManager.parseUDT(ExtendedMappingManager.java:98)
      4. com.datastax.driver.mapping.ExtendedMappingManager.getUDTMapper(ExtendedMappingManager.java:40)
      5. com.datastax.driver.mapping.MappingManager.udtMapper(MappingManager.java:123)
      6. com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:84)
      7. com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:65)
      8. com.datastax.driver.mapping.InferredCQLType.from(InferredCQLType.java:43)
      9. com.datastax.driver.mapping.ReflectionMapper$ReflectionFactory.createColumnMapper(ReflectionMapper.java:221)
      10. com.datastax.driver.mapping.ExtendedMappingManager.convert(ExtendedMappingManager.java:107)
      11. com.datastax.driver.mapping.ExtendedMappingManager.parseUDT(ExtendedMappingManager.java:98)
      12. com.datastax.driver.mapping.ExtendedMappingManager.getUDTMapper(ExtendedMappingManager.java:40)
      13. com.datastax.driver.mapping.MappingManager.udtMapper(MappingManager.java:123)
      14. com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:84)
      15. com.datastax.driver.mapping.InferredCQLType.<init>(InferredCQLType.java:65)
      16. com.datastax.driver.mapping.InferredCQLType.from(InferredCQLType.java:43)
      16 frames