PlayFramework 项目适用于 'activator run' 但部署的 dist 不起作用

PlayFramework project works with 'activator run' but deployed dist does not work

我有一个 playFramework2.4 项目,当我 运行 使用 "activator run" 项目时它工作正常。

但是,当我分发 "activator dist",然后 运行 应用程序时,它给出了一个错误。 似乎我有一些相互冲突的依赖关系,但我不知道为什么我 运行 应用程序时没有看到同样的问题。

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyService': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.cxf.jaxws22.spring.JAXWS22SpringEndpointImpl]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/cxf/frontend/MethodDispatcher org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:275) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1139) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1042) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) org.springframework.beans.factory.support.AbstractBeanFactory.getObject(AbstractBeanFactory.java:303) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83) global.Global.onStart(Global.java:89) play.core.j.JavaGlobalSettingsAdapter.onStart(JavaGlobalSettingsAdapter.scala:22) play.api.GlobalPlugin.onStart(GlobalSettings.scala:271) play.api.Play$$anonfun$start$$anonfun$apply$mcV$sp.apply(Play.scala:92) play.api.Play$$anonfun$start$$anonfun$apply$mcV$sp.apply(Play.scala:92) scala.collection.Iterator$class.foreach(Iterator.scala:727) scala.collection.AbstractIterator.foreach(Iterator.scala:1157) scala.collection.IterableLike$class.foreach(IterableLike.scala:72) play.api.Plugins.foreach(Plugins.scala:57) play.api.Play$$anonfun$start.apply$mcV$sp(Play.scala:92) play.api.Play$$anonfun$start.apply(Play.scala:87) play.api.Play$$anonfun$start.apply(Play.scala:87) play.utils.Threads$.withContextClassLoader(Threads.scala:21) play.api.Play$.start(Play.scala:87) play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get$$anonfun$apply$$anonfun.apply(DevServerStart.scala:156) play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get$$anonfun$apply$$anonfun.apply(DevServerStart.scala:121) scala.Option.map(Option.scala:145) play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get$$anonfun$apply.apply(DevServerStart.scala:121) play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get$$anonfun$apply.apply(DevServerStart.scala:119) scala.util.Success.flatMap(Try.scala:200) play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get.apply(DevServerStart.scala:119) play.core.server.DevServerStart$$anonfun$mainDev$$anon$$anonfun$get.apply(DevServerStart.scala:111) scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1(Future.scala:24) scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402) java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

事实证明,当我调用 activator dist 时,我得到了其他几个导致冲突的依赖项。

最后通过反复试验找到所有问题。

我使用 sbt-dependency-graph to see where dependencies are coming from and also used the response 来排除一些相互冲突的依赖项。