fwbrasil / activate

Abandoned: Pluggable persistence in Scala
GNU Lesser General Public License v2.1
299 stars 46 forks source link

ClassNotFoundException when Enumeration embedded as inner object #143

Open adalbertwysocki opened 10 years ago

adalbertwysocki commented 10 years ago

The Enum class is not found when the Enum object is defined as an inner object:

package test

object Definitions {

object PartyTypes extends Enumeration {
    case class PartyTypes(value: String) extends Val(value)
    val Party = PartyTypes("Foo")
    val Individual = PartyTypes("Bar")
}

class TestBaseEntity extends Entity

abstract class NamedEntity(theName: String) extends TestBaseEntity { val name: String = theName }

case class Party(override val name: String, @Alias("party_type") var partyType : PartyTypes.PartyTypes) extends NamedEntity(name)

}

play.api.Application$$anon$1: Execution exception[[ClassNotFoundException: test.Definitions$PartyTypes$$]] at play.api.Application$class.handleError(Application.scala:287) ~[play_2.10-2.1.5.jar:2.1.5] at play.api.DefaultApplication.handleError(Application.scala:381) [play_2.10-2.1.5.jar:2.1.5] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$play$core$server$netty$PlayDefaultUpstreamHandler$$handle$1$1.apply(PlayDefaultUpstreamHandler.scala:143) [play_2.10-2.1.5.jar:2.1.5] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$play$core$server$netty$PlayDefaultUpstreamHandler$$handle$1$1.apply(PlayDefaultUpstreamHandler.scala:139) [play_2.10-2.1.5.jar:2.1.5] at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10-2.1.5.jar:2.1.5] Caused by: java.lang.ClassNotFoundException: test.Definitions$PartyTypes$$ at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0_15] at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_15] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_15] at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_15] at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[na:1.7.0_15] [error] application - HTTP 500 Internal Server Error: request was GET /party/foo exception was @6ig31mk2e: Execution exception in null:null stack trace: play.api.Application$class.handleError(Application.scala:287) play.api.DefaultApplication.handleError(Application.scala:381) play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$play$core$server$netty$PlayDefaultUpstreamHandler$$handle$1$1.apply(PlayDefaultUpstreamHandler.scala:143) play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$play$core$server$netty$PlayDefaultUpstreamHandler$$handle$1$1.apply(PlayDefaultUpstreamHandler.scala:139) play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) play.api.libs.concurrent.PlayPromise$$anonfun$extend$1$$anonfun$apply$1.apply(Promise.scala:104) scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) java.lang.Thread.run(Thread.java:722)