[2.1.1-java, maven-play2] NoClassDefFoundError in Tomcat after deploying .war

73 views
Skip to first unread message

kreich

unread,
Jul 29, 2013, 2:11:24 PM7/29/13
to play-fr...@googlegroups.com
I've integrated the maven-play2 plugin with my application and everything seems to be working fine until I attempt deployment.  I am getting the following error in my Tomcat logs after starting up Tomcat with the application deployed:

Jul 29, 2013 1:49:42 PM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: scala/Right
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:2308)
        at java.lang.Class.getDeclaredFields(Class.java:1760)
        at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:87)
        at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
        at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 11 more
Caused by: java.lang.ClassNotFoundException: scala.Right
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
        ... 25 more

Up unto this point I've been using the play2-war plugin without issue.  So I disabled the automatic .war production within the plugin configuration (pom.xml), re-compiled and then used the play2-war plugin to generate the .war and that works flawlessly.  I've been up and down the information for the maven plugin and haven't seen mention of this issue. Has anyone else run into this and if so, what was the resolution?

kreich

unread,
Jul 30, 2013, 2:02:53 PM7/30/13
to play-fr...@googlegroups.com
I believe I have found the answer to this issue.  The missing class is scala.Right which doesn't exist in Scala v2.10.  The fact that it's being referenced means that there is a transitive dependency during compilation to an older version of the scala-library.jar (v2.9.1 to be exact).  After looking over the maven-play2-plugin source, the pom.xml is still referencing the older version of the play2-war plugin (v0.8.1) which doesn't work with Play v2.1.0+.  It appears that someone fixed it (although it would have broken WAR builds for older users of Play 2.0), but the merge was unsuccessful.  I've left a few comments on the Github page to see if this can be resolved (https://github.com/nanoko-project/maven-play2-plugin).

Kyle
Reply all
Reply to author
Forward
0 new messages