{"action":"created","issue":{"url":"https://api.github.com/repos/datastax/java-driver/issues/493","labels_url":"https://api.github.com/repos/datastax/java-driver/issues/493/labels{/name}","comments_url":"https://api.github.com/repos/datastax/java-driver/issues/493/comments","events_url":"https://api.github.com/repos/datastax/java-driver/issues/493/events","html_url":"https://github.com/datastax/java-driver/pull/493","id":112916157,"number":493,"title":"JAVA-961 Log a warning when an older version of guava (< 16.0.1) is found.","user":{"login":"tolbertam","id":6889771,"avatar_url":"https://avatars.githubusercontent.com/u/6889771?v=3","gravatar_id":"","url":"https://api.github.com/users/tolbertam","html_url":"https://github.com/tolbertam","followers_url":"https://api.github.com/users/tolbertam/followers","following_url":"https://api.github.com/users/tolbertam/following{/other_user}","gists_url":"https://api.github.com/users/tolbertam/gists{/gist_id}","starred_url":"https://api.github.com/users/tolbertam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tolbertam/subscriptions","organizations_url":"https://api.github.com/users/tolbertam/orgs","repos_url":"https://api.github.com/users/tolbertam/repos","events_url":"https://api.github.com/users/tolbertam/events{/privacy}","received_events_url":"https://api.github.com/users/tolbertam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-23T00:05:14Z","updated_at":"2015-10-23T15:50:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/datastax/java-driver/pulls/493","html_url":"https://github.com/datastax/java-driver/pull/493","diff_url":"https://github.com/datastax/java-driver/pull/493.diff","patch_url":"https://github.com/datastax/java-driver/pull/493.patch"},"body":"For [JAVA-961](https://datastax-oss.atlassian.net/browse/JAVA-961).\r\n\r\nIntroduces a check on reference of `CodecRegistry` where is creating a `TypeToken<Map<String,String>>` improperly sets the type information for the value type (`Object`/`V` instead of `String`) a warning is logged.\r\n\r\nI'm unsure if this is the best way of determining this, but it seems pretty reliable.\r\n\r\nWhen running with Guava 15.0 to 16.01, the following will happen when attempting to resolve a codec with more than one parameterized type argument:\r\n\r\n```\r\nWARN  [2015-10-22 18:57:20,308] [main] - Detected Guava Issue #1635 which indicates that a version of Guava less than 16.01 is in use.  This may introduce codec resolution issues in the driver, please upgrade to Guava 16.01 or later.\r\nINFO  [2015-10-22 18:57:20,406] [main] - Did not find Netty's native epoll transport in the classpath, defaulting to NIO.\r\nINFO  [2015-10-22 18:57:20,912] [main] - Using data-center name 'datacenter1' for DCAwareRoundRobinPolicy (if this is incorrect, please provide the correct datacenter name with DCAwareRoundRobinPolicy constructor)\r\nINFO  [2015-10-22 18:57:20,912] [main] - New Cassandra host /127.0.0.1:9042 added\r\nINFO  [2015-10-22 18:57:20,913] [main] - New Cassandra host /127.0.0.2:9042 added\r\nINFO  [2015-10-22 18:57:20,913] [main] - New Cassandra host /127.0.0.3:9042 added\r\nException in thread \"main\" com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [varchar <-> V]\r\n\tat com.datastax.driver.core.CodecRegistry.notFound(CodecRegistry.java:711)\r\n\tat com.datastax.driver.core.CodecRegistry.createCodec(CodecRegistry.java:558)\r\n\tat com.datastax.driver.core.CodecRegistry.findCodec(CodecRegistry.java:539)\r\n\tat com.datastax.driver.core.CodecRegistry.maybeCreateCodec(CodecRegistry.java:613)\r\n\tat com.datastax.driver.core.CodecRegistry.createCodec(CodecRegistry.java:556)\r\n\tat com.datastax.driver.core.CodecRegistry.findCodec(CodecRegistry.java:539)\r\n\tat com.datastax.driver.core.CodecRegistry.access$200(CodecRegistry.java:153)\r\n\tat com.datastax.driver.core.CodecRegistry$TypeCodecCacheLoader.load(CodecRegistry.java:246)\r\n\tat com.datastax.driver.core.CodecRegistry$TypeCodecCacheLoader.load(CodecRegistry.java:243)\r\n\tat com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)\r\n\tat com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)\r\n\tat com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)\r\n\tat com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)\r\n\tat com.google.common.cache.LocalCache.get(LocalCache.java:3932)\r\n\tat com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3936)\r\n\tat com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4806)\r\n\tat com.datastax.driver.core.CodecRegistry.lookupCodec(CodecRegistry.java:516)\r\n\tat com.datastax.driver.core.CodecRegistry.codecFor(CodecRegistry.java:485)\r\n\tat com.datastax.driver.core.AbstractGettableByIndexData.codecFor(AbstractGettableByIndexData.java:81)\r\n\tat com.datastax.driver.core.AbstractGettableByIndexData.getMap(AbstractGettableByIndexData.java:346)\r\n\tat com.datastax.driver.core.AbstractGettableData.getMap(AbstractGettableData.java:26)\r\n\tat com.datastax.driver.core.AbstractGettableByIndexData.getMap(AbstractGettableByIndexData.java:335)\r\n\tat com.datastax.driver.core.AbstractGettableData.getMap(AbstractGettableData.java:26)\r\n\tat com.datastax.driver.core.AbstractGettableData.getMap(AbstractGettableData.java:233)\r\n```\r\n\r\nIn this case the pre-emptive warning should give the user enough information to know that they need to upgrade guava.\r\n\r\nIn the case of using older versions of guava (<= 14.01) a `NoSuchMethodError` is raised while registering default codecs because `TypeToken.isPrimitive` is missing:\r\n\r\n```\r\nWARN  [2015-10-22 19:02:54,807] [main] - Detected Guava Issue #1635 which indicates that a version of Guava less than 16.01 is in use.  This may introduce codec resolution issues in the driver, please upgrade to Guava 16.01 or later.\r\nException in thread \"main\" java.lang.NoSuchMethodError: com.google.common.reflect.TypeToken.isPrimitive()Z\r\n\tat com.datastax.driver.core.TypeCodec.<init>(TypeCodec.java:406)\r\n\tat com.datastax.driver.core.TypeCodec.<init>(TypeCodec.java:400)\r\n\tat com.datastax.driver.core.TypeCodec$BlobCodec.<init>(TypeCodec.java:947)\r\n\tat com.datastax.driver.core.TypeCodec$BlobCodec.<clinit>(TypeCodec.java:944)\r\n\tat com.datastax.driver.core.TypeCodec.blob(TypeCodec.java:248)\r\n\tat com.datastax.driver.core.CodecRegistry.<clinit>(CodecRegistry.java:180)\r\n\tat com.datastax.driver.core.Configuration$Builder.build(Configuration.java:267)\r\n\tat com.datastax.driver.core.Cluster$Builder.getConfiguration(Cluster.java:1228)\r\n\tat com.datastax.driver.core.Cluster.<init>(Cluster.java:113)\r\n\tat com.datastax.driver.core.Cluster.buildFrom(Cluster.java:182)\r\n\tat com.datastax.driver.core.Cluster$Builder.build(Cluster.java:1249)\r\n```\r\n\r\nIn this case I consider the warning adequate information to know that the user needs to upgrade as well.\r\n\r\nThoughts on this strategy/idea?   Is the error descriptive enough? I can add tests (can add an integration test to osgi-examples) if this sounds ok."},"comment":{"url":"https://api.github.com/repos/datastax/java-driver/issues/comments/150613789","html_url":"https://github.com/datastax/java-driver/pull/493#issuecomment-150613789","issue_url":"https://api.github.com/repos/datastax/java-driver/issues/493","id":150613789,"user":{"login":"tolbertam","id":6889771,"avatar_url":"https://avatars.githubusercontent.com/u/6889771?v=3","gravatar_id":"","url":"https://api.github.com/users/tolbertam","html_url":"https://github.com/tolbertam","followers_url":"https://api.github.com/users/tolbertam/followers","following_url":"https://api.github.com/users/tolbertam/following{/other_user}","gists_url":"https://api.github.com/users/tolbertam/gists{/gist_id}","starred_url":"https://api.github.com/users/tolbertam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tolbertam/subscriptions","organizations_url":"https://api.github.com/users/tolbertam/orgs","repos_url":"https://api.github.com/users/tolbertam/repos","events_url":"https://api.github.com/users/tolbertam/events{/privacy}","received_events_url":"https://api.github.com/users/tolbertam/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T15:50:14Z","updated_at":"2015-10-23T15:50:14Z","body":"Updated based on suggestions.   I added a static block in `Cluster` that calls `SanityChecks.check()` so the check is done at most once and as soon as `Cluster` is referenced.  The new error message looks like such:\r\n\r\n< 15.0:\r\n```\r\nERROR [2015-10-23 10:45:36,885] [main] - Detected Guava issue #1635 which indicates that a version of Guava less than 16.01 is in use.  This may introduce codec resolution issues or other problems in the driver, please upgrade to Guava 16.01 or later.\r\nException in thread \"main\" java.lang.NoSuchMethodError: com.google.common.reflect.TypeToken.isPrimitive()Z\r\n\tat com.datastax.driver.core.TypeCodec.<init>(TypeCodec.java:406)\r\n\tat com.datastax.driver.core.TypeCodec.<init>(TypeCodec.java:400)\r\n\tat com.datastax.driver.core.TypeCodec$BlobCodec.<init>(TypeCodec.java:947)\r\n\tat com.datastax.driver.core.TypeCodec$BlobCodec.<clinit>(TypeCodec.java:944)\r\n\tat com.datastax.driver.core.TypeCodec.blob(TypeCodec.java:248)\r\n\tat com.datastax.driver.core.CodecRegistry.<clinit>(CodecRegistry.java:158)\r\n\tat com.datastax.driver.core.Configuration$Builder.build(Configuration.java:267)\r\n\tat com.datastax.driver.core.Cluster$Builder.getConfiguration(Cluster.java:1233)\r\n\tat com.datastax.driver.core.Cluster.<init>(Cluster.java:118)\r\n\tat com.datastax.driver.core.Cluster.buildFrom(Cluster.java:187)\r\n\tat com.datastax.driver.core.Cluster$Builder.build(Cluster.java:1254)\r\n```\r\n\r\n15.0-16.0:\r\n```\r\nERROR [2015-10-23 10:47:15,851] [main] - Detected Guava issue #1635 which indicates that a version of Guava less than 16.01 is in use.  This may introduce codec resolution issues or other problems in the driver, please upgrade to Guava 16.01 or later.\r\nINFO  [2015-10-23 10:47:16,002] [main] - Did not find Netty's native epoll transport in the classpath, defaulting to NIO.\r\nWARN  [2015-10-23 10:47:16,422] [main] - Error while computing token map for datacenter DC1: could not achieve replication factor 1 (found 0 replicas only), check your keyspace replication settings.\r\nINFO  [2015-10-23 10:47:16,422] [main] - Using data-center name 'datacenter1' for DCAwareRoundRobinPolicy (if this is incorrect, please provide the correct datacenter name with DCAwareRoundRobinPolicy constructor)\r\nINFO  [2015-10-23 10:47:16,423] [main] - New Cassandra host /127.0.0.1:9042 added\r\nINFO  [2015-10-23 10:47:16,423] [main] - New Cassandra host /127.0.0.2:9042 added\r\nINFO  [2015-10-23 10:47:16,423] [main] - New Cassandra host /127.0.0.3:9042 added\r\nException in thread \"main\" com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [varchar <-> V]\r\n\tat com.datastax.driver.core.CodecRegistry.notFound(CodecRegistry.java:689)\r\n\tat com.datastax.driver.core.CodecRegistry.createCodec(CodecRegistry.java:536)\r\n\tat com.datastax.driver.core.CodecRegistry.findCodec(CodecRegistry.java:517)\r\n\tat com.datastax.driver.core.CodecRegistry.maybeCreateCodec(CodecRegistry.java:591)\r\n\tat com.datastax.driver.core.CodecRegistry.createCodec(CodecRegistry.java:534)\r\n\tat com.datastax.driver.core.CodecRegistry.findCodec(CodecRegistry.java:517)\r\n\tat com.datastax.driver.core.CodecRegistry.access$200(CodecRegistry.java:153)\r\n\tat com.datastax.driver.core.CodecRegistry$TypeCodecCacheLoader.load(CodecRegistry.java:224)\r\n\tat com.datastax.driver.core.CodecRegistry$TypeCodecCacheLoader.load(CodecRegistry.java:221)\r\n\tat com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)\r\n\tat com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)\r\n\tat com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)\r\n\tat com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)\r\n\tat com.google.common.cache.LocalCache.get(LocalCache.java:3934)\r\n\tat com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)\r\n\tat com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)\r\n\tat com.datastax.driver.core.CodecRegistry.lookupCodec(CodecRegistry.java:494)\r\n\tat com.datastax.driver.core.CodecRegistry.codecFor(CodecRegistry.java:463)\r\n\tat com.datastax.driver.core.AbstractGettableByIndexData.codecFor(AbstractGettableByIndexData.java:81)\r\n\tat com.datastax.driver.core.AbstractGettableByIndexData.getMap(AbstractGettableByIndexData.java:346)\r\n\tat com.datastax.driver.core.AbstractGettableData.getMap(AbstractGettableData.java:26)\r\n\tat com.datastax.driver.core.AbstractGettableByIndexData.getMap(AbstractGettableByIndexData.java:335)\r\n\tat com.datastax.driver.core.AbstractGettableData.getMap(AbstractGettableData.java:26)\r\n\tat com.datastax.driver.core.AbstractGettableData.getMap(AbstractGettableData.java:233)\r\n```"}}