开发者社区 > 数据库 > NoSQL数据库 > 正文

播放Cassandra Netty Server空指针异常

我正在使用playframework与技术,如,

spark = "2.3.1",
akka = "2.4.7"
hadoop = "2.7.7"
spring = "4.2.6.RELEASE",
spark-cassandra-connector 2.0.9 ,
cassandra-driver-core 3.0.6
在项目清理编译时我得到低于警告

c.d.d.c.NettyUtil - Found Netty's native epoll transport, but not running on linux-based operating system. Using NIO instead

io.netty:netty-handler:4.0.56.Final is selected over 4.0.36.Final

 +- com.datastax.cassandra:cassandra-driver-core:3.5.1 (depends on 4.0.56.Final)
 +- com.typesafe.netty:netty-reactive-streams:1.0.6    (depends on 4.0.36.Final)
 +- io.netty:netty-codec-http:4.0.36.Final             (depends on 4.0.36.Final)

在sbt运行时,低于错误

java.lang.NullPointerException

    at io.netty.channel.group.DefaultChannelGroup.add(DefaultChannelGroup.java:146)
    at play.core.server.NettyServer.bind(NettyServer.scala:140)
    at play.core.server.NettyServer.play$core$server$NettyServer

$$ bindChannel(NettyServer.scala:224) at play.core.server.NettyServer $$

anonfun$1.apply(NettyServer.scala:216)

    at play.core.server.NettyServer

$$ anonfun$1.apply(NettyServer.scala:216) at scala.Option.map(Option.scala:146) at play.core.server.NettyServer.(NettyServer.scala:216) at play.core.server.NettyServerProvider.createServer(NettyServer.scala:279) at play.core.server.NettyServerProvider.createServer(NettyServer.scala:278) at play.core.server.DevServerStart $$

anonfun$mainDev$1.apply(DevServerStart.scala:225)

    at play.core.server.DevServerStart

$$ anonfun$mainDev$1.apply(DevServerStart.scala:61) at play.utils.Threads$.withContextClassLoader(Threads.scala:21) at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:60) at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala:50) at play.core.server.DevServerStart.mainDevHttpMode(DevServerStart.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at play.runsupport.Reloader$.startDevMode(Reloader.scala:234) at play.sbt.run.PlayRun $$

anonfun$playRunTask$1

$$ anonfun$apply$2 $$

anonfun$apply$3.devModeServer$lzycompute$1(PlayRun.scala:74)

    at play.sbt.run.PlayRun

$$ anonfun$playRunTask$1 $$

anonfun$apply$2

$$ anonfun$apply$3.play$sbt$run$PlayRun $$

anonfun

$$ anonfun $$

anonfun

$$ devModeServer$1(PlayRun.scala:74) at play.sbt.run.PlayRun $$

anonfun$playRunTask$1

$$ anonfun$apply$2 $$

anonfun$apply$3.apply(PlayRun.scala:100)

    at play.sbt.run.PlayRun

$$ anonfun$playRunTask$1 $$

anonfun$apply$2

$$ anonfun$apply$3.apply(PlayRun.scala:53) at scala.Function1 $$

anonfun$compose$1.apply(Function1.scala:47)

    at sbt.$tilde$greater

$$ anonfun $$

u2219$1.apply(TypeFunctions.scala:40)

    at sbt.std.Transform

$$ anon$4.work(System.scala:63) at sbt.Execute $$

anonfun$submit$1

$$ anonfun$apply$1.apply(Execute.scala:228) at sbt.Execute $$

anonfun$submit$1

$$ anonfun$apply$1.apply(Execute.scala:228) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17) at sbt.Execute.work(Execute.scala:237) at sbt.Execute $$

anonfun$submit$1.apply(Execute.scala:228)

    at sbt.Execute

$$ anonfun$submit$1.apply(Execute.scala:228) at sbt.ConcurrentRestrictions $$

anon$4

$$ anonfun$1.apply(ConcurrentRestrictions.scala:159) at sbt.CompletionService $$

anon$2.call(CompletionService.scala:28)

    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

error java.lang.reflect.InvocationTargetException
如何解决网络问题?有版本不匹配的问题??

展开
收起
社区小助手 2018-12-11 17:26:32 3096 0
1 条回答
写回答
取消 提交回答
  • 社区小助手是spark中国社区的管理员,我会定期更新直播回顾等资料和文章干货,还整合了大家在钉群提出的有关spark的问题及回答。

    这个问题与Cassandra有关,所以,现在,我使用了cassandra的阴影版本。问题发生是因为应用程序使用了另一个netty版本,所以为了避免这种混乱,提供了shass版本的cassandra jar,它将Netty Classes捆绑在不同的包下

    “com.datastax.cassandra”%“cassandra-driver-core”%“3.1.4”exclude(“io.netty”,“*”)分类器“shaded”

    供参考:https://docs.datastax.com/en/developer/java-driver/3.1/manual/shaded_jar/

    另外,您可以使用dependencyOverrides:

    要更改所选版本,请添加覆盖:

    dependencyOverrides + =“”%“”%“”

    参考:https://www.scala-sbt.org/1.x/docs/Library-Management.html#Overriding+a+version

    2019-07-17 23:19:56
    赞同 展开评论 打赏

阿里云NoSQL数据库提供了一种灵活的数据存储方式,可以支持各种数据模型,包括文档型、图型、列型和键值型。此外,它还提供了一种分布式的数据处理方式,可以支持高可用性和容灾备份。包含Redis社区版和Tair、多模数据库 Lindorm、MongoDB 版。

相关电子书

更多
RocketMQ 新特性揭秘- Request-Reply 立即下载
RocketMQ Client-GO 介绍 立即下载
低代码开发师(初级)实战教程 立即下载