正在进行ClassNotFoundException!应用类型安全激活器

时间:2014-07-06 05:54:45

标签: scala playframework classpath classnotfoundexception typesafe-activator

我玩了!使用类型安全激活器的应用程序,它在原始开发人员的计算机上运行良好。但是当我尝试使用命令“sudo ./activator run”在我的计算机上运行应用程序时,出现以下错误。

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

com.samza.adapter.JobFactory类确实存在并且位于正确的目录中。

API.scala的第29行到第32行是:

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

然后我尝试用命令

定义类路径
export CLASSPATH=${CLASSPATH}:/directoryTo/com/samza/adapter

但不幸的是它没有用..

版本:

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 个答案:

答案 0 :(得分:1)

我之前遇到过类似的问题。尝试使用激活器ui运行应用程序。如果您在命令行上运行,请尝试使用activator start代替activator run运行。

点击此处查看更多参考资料: https://typesafe.com/activator/docs