1
votes

I have a play! application with typesafe activator which works well on the original developer's computer. But when I try to run the app on my computer with the command " sudo ./activator run ", I get the following error.

play.api.UnexpectedException: Unexpected exception[ClassNotFoundException: com.samza.adapter.JobFactory]
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:151) ~[play_2.10-2.3.0.jar:2.3.0]
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:115) ~[play_2.10-2.3.0.jar:2.3.0]
    at scala.Option.map(Option.scala:145) ~[scala-library.jar:na]
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:115) ~[play_2.10-2.3.0.jar:2.3.0]
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:113) ~[play_2.10-2.3.0.jar:2.3.0]
    at scala.util.Success.flatMap(Try.scala:200) ~[scala-library.jar:na]
    at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:113) ~[play_2.10-2.3.0.jar:2.3.0]
    at play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:105) ~[play_2.10-2.3.0.jar:2.3.0]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[scala-library.jar:na]
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1361) ~[scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) ~[scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) ~[scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) ~[scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) ~[scala-library.jar:na]
Caused by: java.lang.ClassNotFoundException: com.samza.adapter.JobFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0_51]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_51]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_51]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_51]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[na:1.7.0_51]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[na:1.7.0_51]
    at java.lang.Class.forName0(Native Method) ~[na:1.7.0_51]
    at java.lang.Class.forName(Class.java:190) ~[na:1.7.0_51]
    at org.apache.samza.job.JobRunner.run(JobRunner.scala:56) ~[samza-core_2.10-0.7.0.jar:na]
    at com.samza.adapter.Adapter$$anonfun$start$1.apply(Adapter.scala:31) ~[na:na]
    at com.samza.adapter.Adapter$$anonfun$start$1.apply(Adapter.scala:31) ~[na:na]
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na]
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244) ~[scala-library.jar:na]
    at scala.collection.Iterator$class.foreach(Iterator.scala:727) ~[scala-library.jar:na]
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1157) ~[scala-library.jar:na]
    at scala.collection.IterableLike$class.foreach(IterableLike.scala:72) ~[scala-library.jar:na]
    at scala.collection.AbstractIterable.foreach(Iterable.scala:54) ~[scala-library.jar:na]
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244) ~[scala-library.jar:na]
    at scala.collection.AbstractTraversable.map(Traversable.scala:105) ~[scala-library.jar:na]
    at com.samza.adapter.Adapter$.start(Adapter.scala:29) ~[na:na]
    at com.activities.Boot$.onStart(Boot.scala:26) ~[na:na]
    at play.api.GlobalPlugin.onStart(GlobalSettings.scala:220) ~[play_2.10-2.3.0.jar:2.3.0]
    at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91) ~[play_2.10-2.3.0.jar:2.3.0]
    at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91) ~[play_2.10-2.3.0.jar:2.3.0]
    at scala.collection.immutable.List.foreach(List.scala:318) ~[scala-library.jar:na]
    at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:91) ~[play_2.10-2.3.0.jar:2.3.0]
    at play.api.Play$$anonfun$start$1.apply(Play.scala:91) ~[play_2.10-2.3.0.jar:2.3.0]
    at play.api.Play$$anonfun$start$1.apply(Play.scala:91) ~[play_2.10-2.3.0.jar:2.3.0]
    at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ~[play_2.10-2.3.0.jar:2.3.0]
    at play.api.Play$.start(Play.scala:90) ~[play_2.10-2.3.0.jar:2.3.0]
    at play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:142) ~[play_2.10-2.3.0.jar:2.3.0]
    ... 14 common frames omitted

The com.samza.adapter.JobFactory class does exist and is in the correct directory.

The 29th to 32st lines of API.scala is:

def start: Unit = config getStringList ("task-containers") map
  {
      load(_) run
  }

Then I tried to define the class path with command

export CLASSPATH=${CLASSPATH}:/directoryTo/com/samza/adapter

But unfortunately it didn't work..

The versions:

scala -version
Scala code runner version 2.11.0 -- Copyright 2002-2013, LAMP/EPFL

play -version
play 2.2.3 built with Scala 2.10.3 (running Java 1.7.0_51), http://www.playframework.com

typesafe-activator : 1.2.3
1

1 Answers

1
votes

I've come across a similar problem before. Try to run the app using activator ui. If you are running on command line, try to run using activator start instead of activator run.

Check here for more references: https://typesafe.com/activator/docs