java.lang.NullPointerException

DataStax JIRA | Adrian Ng | 3 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. Speed up your debug routine!

    Automated exception search integrated into your IDE

  2. 0

    Loader NPEs in com.datastax.driver.core.BoundStatement.bind

    GitHub | 1 year ago | KenMcK1
    java.util.concurrent.ExecutionException: java.lang.NullPointerException
  3. 0

    The static initialisation order of the inner class in TypeCodec are not garanteed, and sometimes that causes the primitiveCodecs map to be initialised before LongCodec.instance is. it happens on oracle java8 travid ci build box, but if I ran that {code} public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException { Class<?> longCodec = Class.forName("com.datastax.driver.core.TypeCodec$LongCodec"); Field f = Class.forName("com.datastax.driver.core.TypeCodec").getDeclaredField("primitiveCodecs"); f.setAccessible(true); System.out.println("primitiveCodecs = " + f.get(null)); } {code} then it happens all the time {code} primitiveCodecs = {ascii=com.datastax.driver.core.TypeCodec$StringCodec@2e0fa5d3, bigint=null, blob=com.datastax.driver.core.TypeCodec$BytesCodec@5010be6, boolean=com.datastax.driver.core.TypeCodec$BooleanCodec@685f4c2e, counter=null, decimal=com.datastax.driver.core.TypeCodec$DecimalCodec@7daf6ecc, double=com.datastax.driver.core.TypeCodec$DoubleCodec@2e5d6d97, float=com.datastax.driver.core.TypeCodec$FloatCodec@238e0d81, inet=com.datastax.driver.core.TypeCodec$InetCodec@31221be2, int=com.datastax.driver.core.TypeCodec$IntCodec@377dca04, text=com.datastax.driver.core.TypeCodec$StringCodec@728938a9, timestamp=com.datastax.driver.core.TypeCodec$DateCodec@21b8d17c, uuid=com.datastax.driver.core.TypeCodec$UUIDCodec@6433a2, varchar=com.datastax.driver.core.TypeCodec$StringCodec@728938a9, varint=com.datastax.driver.core.TypeCodec$BigIntegerCodec@5910e440, timeuuid=com.datastax.driver.core.TypeCodec$TimeUUIDCodec@6267c3bb, custom=com.datastax.driver.core.TypeCodec$BytesCodec@5010be6} {code} the primitiveCodecs should not depends on the static initialisers, it could instead create the instance itself. during the build I then get the following error {code} testInsertDbObjects(org.sfm.datastax.SettableDataMapperTest) Time elapsed: 0.089 sec <<< ERROR! java.lang.NullPointerException: null at com.datastax.driver.core.BoundStatement.bind(BoundStatement.java:209) at com.datastax.driver.core.DefaultPreparedStatement.bind(DefaultPreparedStatement.java:103) at org.sfm.datastax.SettableDataMapperTest.checkObjectInserted(SettableDataMapperTest.java:45) {code} or {code} testMapSetUDT(org.sfm.datastax.DatastaxMapperCollectionTest) Time elapsed: 0.331 sec <<< ERROR! java.lang.NullPointerException: null at com.datastax.driver.core.DataType.deserialize(DataType.java:673) at com.datastax.driver.core.AbstractData.hashCode(AbstractData.java:457) at com.datastax.driver.core.UDTValue.hashCode(UDTValue.java:69) at java.util.HashMap.hash(HashMap.java:338) at java.util.HashMap.put(HashMap.java:611) at java.util.HashSet.add(HashSet.java:219) at com.datastax.driver.core.TypeCodec$SetCodec.deserialize(TypeCodec.java:1076) at com.datastax.driver.core.TypeCodec$SetCodec.deserialize(TypeCodec.java:1001) at com.datastax.driver.core.AbstractGettableByIndexData.getSet(AbstractGettableByIndexData.java:343) at com.datastax.driver.core.AbstractGettableData.getSet(AbstractGettableData.java:26) at org.sfm.datastax.impl.getter.DatastaxSetWithConverterGetter.get(DatastaxSetWithConverterGetter.java:24) at org.sfm.datastax.impl.getter.DatastaxSetWithConverterGetter.get(DatastaxSetWithConverterGetter.java:10) at org.sfm.map.impl.fieldmapper.FieldMapperImpl.mapTo(FieldMapperImpl.java:23) {code} see https://travis-ci.org/arnaudroger/SimpleFlatMapper/jobs/83902196

    DataStax JIRA | 1 year ago | Arnaud Roger
    java.lang.NullPointerException: 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

      No message provided

      at org.apache.cassandra.utils.ByteBufferUtil.bytes()
    2. Apache Cassandra
      ByteBufferUtil.bytes
      1. org.apache.cassandra.utils.ByteBufferUtil.bytes(ByteBufferUtil.java:243)
      1 frame
    3. org.apache.cassandra
      ListType.decompose
      1. org.apache.cassandra.cql.jdbc.JdbcUTF8.decompose(JdbcUTF8.java:98)
      2. org.apache.cassandra.db.marshal.UTF8Type.decompose(UTF8Type.java:38)
      3. org.apache.cassandra.db.marshal.UTF8Type.decompose(UTF8Type.java:25)
      4. org.apache.cassandra.db.marshal.ListType.decompose(ListType.java:109)
      5. org.apache.cassandra.db.marshal.ListType.decompose(ListType.java:29)
      5 frames
    4. DataStax Java Driver for Apache Cassandra - Core
      BoundStatement.bind
      1. com.datastax.driver.core.BoundStatement.bind(BoundStatement.java:193)
      1 frame