playframework / play-slick

Slick Plugin for Play
Apache License 2.0
804 stars 282 forks source link

NoClassDefFoundError with 3.0.1 #420

Open klclee opened 7 years ago

klclee commented 7 years ago

Hi there I am runing Play 2.6.5 and play-slick 3.0.1. When I run my inetgration tests I am getting the following exception. (Reverting back to 3.0.0 stops it)

A needed class was not found. This could be due to an error in your runpath. Missing class: slick/lifted/MappedProjection$
java.lang.NoClassDefFoundError: slick/lifted/MappedProjection$
    at daos.PendingInviteDao$PendingInviteTable.$times(PendingInviteDao.scala:63)
    at slick.lifted.AbstractTable.toNode(AbstractTable.scala:43)
    at slick.lifted.RepShape$.toNode(Shape.scala:114)
    at slick.lifted.RepShape$.toNode(Shape.scala:106)
    at slick.lifted.ShapedValue.toNode(Shape.scala:276)
    at slick.lifted.TableQuery.toNode$lzycompute(Query.scala:301)
    at slick.lifted.TableQuery.toNode(Query.scala:301)
    at slick.jdbc.JdbcProfile$API$class.queryDeleteActionExtensionMethods(JdbcProfile.scala:54)
    at slick.jdbc.JdbcProfile$$anon$1.queryDeleteActionExtensionMethods(JdbcProfile.scala:67)
    at daos.PendingInviteDao.deleteAll(PendingInviteDao.scala:21)
    at helper.IntegrationHelperWithDB$$anonfun$1.apply$mcV$sp(IntegrationHelper.scala:58)
    at helper.IntegrationHelperWithDB$$anonfun$1.apply(IntegrationHelper.scala:48)
    at helper.IntegrationHelperWithDB$$anonfun$1.apply(IntegrationHelper.scala:48)
    at org.scalatest.BeforeAndAfter$class.runTest(BeforeAndAfter.scala:195)
    at services.UserServiceSpec.runTest(UserServiceSpec.scala:14)
    at org.scalatest.WordSpecLike$$anonfun$runTests$1.apply(WordSpecLike.scala:1021)
    at org.scalatest.WordSpecLike$$anonfun$runTests$1.apply(WordSpecLike.scala:1021)
    at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:413)
    at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:401)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:401)
    at org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:390)
    at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:427)
    at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:401)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:401)
    at org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:396)
    at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:483)
    at org.scalatest.WordSpecLike$class.runTests(WordSpecLike.scala:1021)
    at org.scalatest.WordSpec.runTests(WordSpec.scala:1881)
    at org.scalatest.Suite$class.run(Suite.scala:1424)
    at org.scalatest.WordSpec.org$scalatest$WordSpecLike$$super$run(WordSpec.scala:1881)
    at org.scalatest.WordSpecLike$$anonfun$run$1.apply(WordSpecLike.scala:1067)
    at org.scalatest.WordSpecLike$$anonfun$run$1.apply(WordSpecLike.scala:1067)
    at org.scalatest.SuperEngine.runImpl(Engine.scala:545)
    at org.scalatest.WordSpecLike$class.run(WordSpecLike.scala:1067)
    at services.UserServiceSpec.org$scalatestplus$play$OneAppPerSuite$$super$run(UserServiceSpec.scala:14)
    at org.scalatestplus.play.OneAppPerSuite$class.run(OneAppPerSuite.scala:143)
    at services.UserServiceSpec.org$scalatest$BeforeAndAfter$$super$run(UserServiceSpec.scala:14)
    at org.scalatest.BeforeAndAfter$class.run(BeforeAndAfter.scala:241)
    at services.UserServiceSpec.run(UserServiceSpec.scala:14)
    at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:55)
    at org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$3.apply(Runner.scala:2563)
    at org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$3.apply(Runner.scala:2557)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:2557)
    at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1044)
    at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1043)
    at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:2722)
    at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1043)
    at org.scalatest.tools.Runner$.run(Runner.scala:883)
    at org.scalatest.tools.Runner.run(Runner.scala)
    at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:138)
    at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
Caused by: java.lang.ClassNotFoundException: slick.lifted.MappedProjection$
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 54 more

And line 63 that is referencing in the exception is:

 def * = (id,email,inviteToken,userId, createdAt) <> (PendingInvite.tupled, PendingInvite.unapply _)
henrikno commented 7 years ago

Still present in play-slick 3.0.2 and play 2.6.6.

gmethvin commented 7 years ago

You probably have a something that's using Slick 3.2.0, but play-slick is using 3.2.1. Unfortunately a binary incompatible change was introduced in 3.2.1 by removing the MappedProjection object: https://github.com/slick/slick/commit/ddb75a0f96fdde48bbb6885c4636bae204515a69#diff-46e14ef7bc9ed87b5f6fec2283b9f97bL388

fosskers commented 6 years ago

Gross, that should've forced a 4.0.