0

在一个更大的 playframework 2.1.3 应用程序中,我开始使用 JClouds blobstorage。我添加了依赖项

"org.apache.jclouds" % "jclouds-allblobstore" % "1.6.1-incubating",
"com.google.code.findbugs" % "jsr305" % "1.3.+"

并添加了一个运行以下代码的操作

val action = Action {
  val context = ContextBuilder.newBuilder("s3")
    .endpoint("https://cs.hosteurope.de")
    .credentials(username, password)
    .buildView(classOf[BlobStoreContext])
  Ok("success")
}

当我运行此操作时,我得到:

java.lang.IllegalArgumentException: Can not set javax.inject.Provider field 

更详细地说,我得到

[CreationException: Guice creation errors: 1) Error in custom provider, java.lang.IllegalArgumentException: Can not set javax.inject.Provider field org.jclouds.blobstore.config.BlobStoreMapModule$BlobMapFactory.blobBuilders to com.google.inject.internal.InjectorImpl$4 at org.jclouds.blobstore.config.BlobStoreMapModule.configure(BlobStoreMapModule.java:50) while locating org.jclouds.blobstore.BlobMap$Factory Caused by: java.lang.IllegalArgumentException: Can not set javax.inject.Provider field org.jclouds.blobstore.config.BlobStoreMapModule$BlobMapFactory.blobBuilders to com.google.inject.internal.InjectorImpl$4 at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168) at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) at java.lang.reflect.Field.set(Field.java:680) at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54) at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:110) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:94) at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254) at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54) at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031) at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at com.google.inject.Scopes$1$1.get(Scopes.java:65) at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40) at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:204) at com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:198) at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024) at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:198) at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:179) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109) at com.google.inject.Guice.createInjector(Guice.java:95) at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:405) at org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:329) at org.jclouds.ContextBuilder.buildView(ContextBuilder.java:620) at org.jclouds.ContextBuilder.buildView(ContextBuilder.java:600) at controllers.admin.OtherController$$anonfun$7$$anonfun$apply$2.apply(OtherController.scala:40) at controllers.admin.OtherController$$anonfun$7$$anonfun$apply$2.apply(OtherController.scala:36) at controllers.admin.utils.MenuController$MenuAction.apply(Menu.scala:51) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$2$$anonfun$apply$5$$anonfun$apply$6.apply(Action.scala:109) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$2$$anonfun$apply$5$$anonfun$apply$6.apply(Action.scala:109) at play.utils.Threads$.withContextClassLoader(Threads.scala:18) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$2$$anonfun$apply$5.apply(Action.scala:108) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$2$$anonfun$apply$5.apply(Action.scala:106) at scala.Option.map(Option.scala:145) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$2.apply(Action.scala:106) at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$2.apply(Action.scala:99) at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:137) at scala.concurrent.forkjoin.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1417) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478) at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) 

为了跟踪问题,我创建了一个具有相同库依赖项的全新播放应用程序,然后用上面的代码替换了主要操作。这工作得很好。而且由于我添加了大型游戏应用程序的所有库依赖项,我不知道大型应用程序中还有什么可以破坏它。

什么可能导致这个问题?

编辑:大型应用程序的依赖项:

"mysql" % "mysql-connector-java" % "5.1.25",
"org.squeryl" %% "squeryl" % "0.9.5-6",
"net.sf.jasperreports" % "jasperreports"  % "4.7.1",
"com.typesafe" %% "play-plugins-mailer" % "2.1.0",
"org.scalatest" %% "scalatest" % "2.0.M5b" % "test",
"jp.t2v" %% "play2.auth"      % "0.9",
"jp.t2v" %% "play2.auth.test" % "0.9" % "test",
"org.scala-lang" % "scala-actors" % "2.10.0"    % "test",
"com.unboundid" % "unboundid-ldapsdk" % "2.3.1",
"net.sf.uadetector" % "uadetector-resources" % "2013.06",
"org.apache.commons" % "commons-email" % "1.3.1",
"org.apache.jclouds" % "jclouds-allblobstore" % "1.6.1-incubating",
"com.google.code.findbugs" % "jsr305" % "1.3.+"
4

1 回答 1

0

很奇怪,当我移动两个依赖时它起作用了

"org.apache.jclouds" % "jclouds-allblobstore" % "1.6.1-incubating",
"com.google.code.findbugs" % "jsr305" % "1.3.+"

到列表的顶部。当它们处于底部时,它不起作用。所以

"mysql" % "mysql-connector-java" % "5.1.25",
"org.squeryl" %% "squeryl" % "0.9.5-6",
"net.sf.jasperreports" % "jasperreports"  % "4.7.1",
"com.typesafe" %% "play-plugins-mailer" % "2.1.0",
"org.scalatest" %% "scalatest" % "2.0.M5b" % "test",
"jp.t2v" %% "play2.auth"      % "0.9",
"jp.t2v" %% "play2.auth.test" % "0.9" % "test",
"org.scala-lang" % "scala-actors" % "2.10.0"    % "test",
"com.unboundid" % "unboundid-ldapsdk" % "2.3.1",
"net.sf.uadetector" % "uadetector-resources" % "2013.06",
"org.apache.commons" % "commons-email" % "1.3.1",
"org.apache.jclouds" % "jclouds-allblobstore" % "1.6.1-incubating",
"com.google.code.findbugs" % "jsr305" % "1.3.+"

休息,但是

"org.apache.jclouds" % "jclouds-allblobstore" % "1.6.1-incubating",
"com.google.code.findbugs" % "jsr305" % "1.3.+",
"mysql" % "mysql-connector-java" % "5.1.25",
"org.squeryl" %% "squeryl" % "0.9.5-6",
"net.sf.jasperreports" % "jasperreports"  % "4.7.1",
"com.typesafe" %% "play-plugins-mailer" % "2.1.0",
"org.scalatest" %% "scalatest" % "2.0.M5b" % "test",
"jp.t2v" %% "play2.auth"      % "0.9",
"jp.t2v" %% "play2.auth.test" % "0.9" % "test",
"org.scala-lang" % "scala-actors" % "2.10.0"    % "test",
"com.unboundid" % "unboundid-ldapsdk" % "2.3.1",
"net.sf.uadetector" % "uadetector-resources" % "2013.06",
"org.apache.commons" % "commons-email" % "1.3.1"

作品。

问题现在为我解决了。如果有人知道为什么顺序可能很重要,我会很好奇。

于 2013-08-27T01:04:13.887 回答