2017-05-21 7 views
0

私はEBeansでJava Play 2.5を使用しており、EclipseでUnitTestを実行したいと考えています。私が使用している場合はsbt testコマンドすべてが正常に動作しますが、日食では、私は私の設定が間違っているかを把握can'tまたは私は私のクラスパスに適切にEntityBeanのを追加する方法eclipse:Java PlayでのJUnitテストEVEANS

Configuration error: Configuration error[Cannot register class [models.persistent.User] in Ebean server] 
    at play.api.Configuration$.configError(Configuration.scala:155) 
    at play.api.Configuration.reportError(Configuration.scala:808) 
    at play.Configuration.reportError(Configuration.java:368) 
    at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.addModelClassesToServerConfig(DefaultEbeanConfig.java:107) 
    at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.parse(DefaultEbeanConfig.java:82) 
    at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.get(DefaultEbeanConfig.java:56) 
    at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.get(DefaultEbeanConfig.java:40) 
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81) 
    at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72) 
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61) 
    at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62) 
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) 
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103) 
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) 
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145) 
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41) 
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38) 
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62) 
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:104) 
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85) 
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267) 
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) 
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103) 
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) 
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145) 
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41) 
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56) 
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) 
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103) 
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) 
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145) 
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41) 
    at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016) 
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103) 
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012) 
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051) 
    at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:405) 
    at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:400) 
    at play.api.db.evolutions.ApplicationEvolutionsProvider.get$lzycompute(EvolutionsModule.scala:53) 
    at play.api.db.evolutions.ApplicationEvolutionsProvider.get(EvolutionsModule.scala:53) 
    at play.api.db.evolutions.ApplicationEvolutionsProvider.get(EvolutionsModule.scala:44) 
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81) 
    at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:72) 
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:61) 
    at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:62) 
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) 
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1103) 
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) 
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:145) 
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41) 
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:205) 
    at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:199) 
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092) 
    at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:199) 
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:180) 
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:110) 
    at com.google.inject.Guice.createInjector(Guice.java:96) 
    at com.google.inject.Guice.createInjector(Guice.java:84) 
    at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:181) 
    at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:123) 
    at play.api.test.FakeApplication.<init>(Fakes.scala:209) 
    at play.test.FakeApplication.<init>(FakeApplication.java:51) 
    at play.test.FakeApplication.<init>(FakeApplication.java:69) 
    at play.test.Helpers.fakeApplication(Helpers.java:172) 
    at controllers.UserControllerTest.provideFakeApplication(UserControllerTest.java:34) 
    at play.test.WithApplication.provideApplication(WithApplication.java:33) 
    at play.test.WithApplication.startPlay(WithApplication.java:51) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) 
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) 
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) 
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) 
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) 
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) 
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) 
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 
Caused by: java.lang.NoClassDefFoundError: io/ebean/bean/EntityBean 
    at java.lang.ClassLoader.defineClass1(Native Method) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763) 
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) 
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    at java.lang.Class.forName0(Native Method) 
    at java.lang.Class.forName(Class.java:348) 
    at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.addModelClassesToServerConfig(DefaultEbeanConfig.java:105) 
    ... 87 more 
Caused by: java.lang.ClassNotFoundException: io.ebean.bean.EntityBean 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    ... 102 more 

を取得します。プロジェクトはEBeanEnhancer 10.xので構成されており、私のsbtプラグインは次のようになります。

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.14") 
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.1.0") 
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "3.0.0") 
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0") 

私はあなたの助けのために...日食に感謝し、これを設定するための手順を見つけることができませんでした!

答えて

0

多分それは要約したように私https://stackoverflow.com/a/46019157/4391948

のために働くものをここにされて後半にあるが、私は同じ問題を抱えていたと、あなたが差し込むプレイebeanのバージョンを確認する必要があり、それができた(適切なプラグインをインストールebean 4.xから7.xまたは10.xの場合)。インストールした後、プロジェクトを右クリックし、「設定」に移動してeBean Enhancerを有効にする必要があります。

これが役に立ちます。