Hi,
I'm currently running a Twitter4s application in a Flink cluster.
And I'm running into the following error:
taskrunner_1 | Uncaught error from thread [twitter4s-rest-akka.actor.default-dispatcher-5]: loader constraint violation: when resolving method "akka.actor.ActorCell$$anonfun$3.<init>(Lakka/actor/ActorCell;)V" the class loader (instance of org/apache/flink/runtime/execution/librarycache/FlinkUserCodeClassLoaders$ChildFirstClassLoader) of the current class, akka/actor/ActorCell, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, akka/actor/ActorCell$$anonfun$3, have different Class objects for the type akka/actor/ActorCell used in the signature, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for for ActorSystem[twitter4s-rest]
taskrunner_1 | java.lang.LinkageError: loader constraint violation: when resolving method "akka.actor.ActorCell$$anonfun$3.<init>(Lakka/actor/ActorCell;)V" the class loader (instance of org/apache/flink/runtime/execution/librarycache/FlinkUserCodeClassLoaders$ChildFirstClassLoader) of the current class, akka/actor/ActorCell, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for the method's defining class, akka/actor/ActorCell$$anonfun$3, have different Class objects for the type akka/actor/ActorCell used in the signature
taskrunner_1 | Exception in thread "twitter4s-streaming-shutdown-hook-1" java.lang.NoClassDefFoundError: akka/actor/CoordinatedShutdown$$anonfun$totalTimeout$1
Basically what my application does:
- Retrieve trending topics.
- Start statuses stream and filter on trending topics.
- Repeat this every 15 minutes.
Here some snippets of my code:
override def run(ctx: SourceFunction.SourceContext[TweetWrapper]): Unit = {
var stream: TwitterStream = null
while (isRunning) {
//get stream
val currentTrends = requestTrending()
logger.info(s"Retrieved new trends: $currentTrends")
//close the old stream
if (stream != null) Await.result(stream.close(), 10 seconds)
//start new stream
stream = Await.result(startStream(currentTrends, ctx), 10 seconds)
//time to sleep
logger.info(s"Started new stream, now sleeping for $sleepTime minute(s).")
Thread.sleep(sleepTimeMilli)
}
}
And the startStream method:
def startStream(trending: List[String], ctx: SourceFunction.SourceContext[TweetWrapper]): Future[TwitterStream] = {
getStreamingClient.filterStatuses(tracks = trending) {
case tweet: Tweet => ctx.collectWithTimestamp(TweetWrapper(tweet), tweet.created_at.getTime)
case x => logger.info(x)
}
}
I think this error is caused by version conflicts related to Akka (Flink also uses Akka), but I have no idea how to solve it. The Twitter4s version I'm using: 5.5
Hi,
I'm currently running a Twitter4s application in a Flink cluster.
And I'm running into the following error:
Basically what my application does:
Here some snippets of my code:
And the
startStreammethod:I think this error is caused by version conflicts related to Akka (Flink also uses Akka), but I have no idea how to solve it. The Twitter4s version I'm using: 5.5