0

Hi I recently migrated from 2.3.8 to 2.4.0 (play framework with Activator 1.3.6). I had 2 similar projects. I upgraded the first one without any errors. However, the 2nd project gives me this error :

NoSuchMethodError: org.apache.commons.codec.digest.DigestUtils.sha1Hex(Ljava/lang/String;)Ljava/lang/String;

There is no stack trace pointing to my code. In the web debugger it says

No source available, here is the exception stack trace:

I'm unable to figure out what's wrong. Has anyone experienced this before? Here is the screenshot of what I see after (successful) compilation and running the application:

enter image description here

I followed the steps given here:

https://www.playframework.com/documentation/2.4.x/Migration24 https://www.playframework.com/documentation/2.4.x/JavaEbean

Any help is appreciated. Thank you for your time.

[Update] When I disable the evolutions plugin, the errors go away. Whenever I set this to false in applicatin.conf

play.evolutions.enabled=false

The application seems to work. I believe there is some issue with the evolutions plugin. Not sure how to address the issue.

UPDATE: Although the applications seems to run now, it is giving me the same error on calling any files from assets. Therefore, my styles are not getting compiled. Checkout the browser console log here: enter image description here

I'm logging the error message from Global.java and outputting the errors. The output in the terminal is as follows: enter image description here

My build.sbt is as below:

name := """PROJECT_NAME"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayJava,PlayEbean,SbtWeb)

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
  javaJdbc,
  cache,
  javaWs
)

libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.29"

libraryDependencies += "commons-codec" % "commons-codec" % "1.10"

libraryDependencies += evolutions

includeFilter in (Assets, LessKeys.less) := "*.less"

excludeFilter in (Assets, LessKeys.less) := "_*.less"

Stack trace for the error that I logged in Global.java:

[ERROR] MESSAGE: java.lang.NoSuchMethodError: org.apache.commons.codec.digest.DigestUtils.sha1Hex(Ljava/lang/String;)Ljava/lang/String;  CAUSED BY : java.lang.NoSuchMethodError: org.apache.commons.codec.digest.DigestUtils.sha1Hex(Ljava/lang/String;)Ljava/lang/String; STACK TRACE BELOW: 

play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:96)
play.api.libs.iteratee.DoneIteratee$$anonfun$mapM$2.apply(Iteratee.scala:741)
play.api.libs.iteratee.DoneIteratee$$anonfun$mapM$2.apply(Iteratee.scala:741)
scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
play.api.mvc.ActionBuilder$$anon$1.apply(Action.scala:498)
akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:105)
play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:105)
play.utils.Threads$.withContextClassLoader(Threads.scala:21)
play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:104)
play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:103)
scala.Option.map(Option.scala:146)
play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:103)
play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:96)
play.api.libs.iteratee.DoneIteratee$$anonfun$mapM$2.apply(Iteratee.scala:741)
play.api.libs.iteratee.DoneIteratee$$anonfun$mapM$2.apply(Iteratee.scala:741)
scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)
scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
harsh8888
  • 477
  • 9
  • 22

1 Answers1

2

It looks like you are using an older version of Apache Commons that doesn't have the sha1Hex() function yet. Try a newer one by adding commons-codec version 1.10 to your build.sbt.

libraryDependencies ++= Seq(
  ...
  "commons-codec" % "commons-codec" % "1.10",
  ...
)
Kris
  • 4,595
  • 7
  • 32
  • 50
  • Hey Kris thanks for the reply. I figured out that activator clean, cleanFiles, clean-files commands do not actually clean up all the class files. Try doing a *.class search and you will see. Probably in some previous compilation there was some problem with the said library, which caused this problem to come up. I ended up deleting all the class files. Upon recompiling it seems to work well. – harsh8888 Nov 14 '15 at 09:05
  • I noticed, though for Assets file requests it gives me a 404 with same error in the stack trace. I tried addining common-io as per your suggestion but doesn't seem to work. – harsh8888 Nov 16 '15 at 05:07
  • I'm sorry! I put the wrong library: not io but codec. I edited my answer. – Kris Nov 16 '15 at 09:18
  • I added commons-codec, still no luck! Check the updates in the questions. – harsh8888 Nov 16 '15 at 23:19
  • Even if I add a test image file in public/images/ and try to access it with a url, it gives me the same error. – harsh8888 Nov 16 '15 at 23:30
  • There seem to be similar questions on SO http://stackoverflow.com/questions/15919007/play-use-different-version-of-jar-than-local-repository and http://stackoverflow.com/questions/32250326/denodo-jar-get-conflicts-with-play-framework-jar. Maybe they help? – Kris Nov 17 '15 at 09:10
  • Did you have any more luck or any updates in resolving the issue? I'm facing the same :/ – Dominik Bucher Nov 28 '15 at 10:04
  • Found the problem in my case. A .jar in the server/lib. And I only checked the /libs folder in the parent folder :S. – Dominik Bucher Nov 28 '15 at 14:34