在Play应用程序中使用Gephi

时间:2016-09-25 09:30:05

标签: scala playframework playframework-2.0 sbt gephi

我目前正在Scala中构建一个需要使用Gephi Java库的Play Framework应用程序。

我尝试将Gephi添加为SBT中的托管依赖项,但SBT无法解析所有Gephi的依赖项。这是known issue。然后我只是尝试在我的lib/文件夹中添加整个Gephi JAR作为非托管依赖项。 IntelliJ检测到库很好,我可以很好地编译我的应用程序。问题是在启动应用程序时立即发生异常,它似乎与依赖注入有关:

    play.api.UnexpectedException: Unexpected exception[NoSuchMethodError: com.google.common.base.Objects.firstNonNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;]
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:174)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:126)
    at scala.Option.map(Option.scala:146)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:126)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:124)
    at scala.util.Success.flatMap(Try.scala:231)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:124)
    at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:116)
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
Caused by: java.lang.NoSuchMethodError: com.google.common.base.Objects.firstNonNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    at com.google.common.cache.CacheBuilder.getKeyStrength(CacheBuilder.java:529)
    at com.google.common.cache.LocalCache.<init>(LocalCache.java:242)
    at com.google.common.cache.LocalCache$LocalManualCache.<init>(LocalCache.java:4718)
    at com.google.common.cache.CacheBuilder.build(CacheBuilder.java:807)
    at com.google.inject.internal.WeakKeySet.<init>(WeakKeySet.java:55)
    at com.google.inject.internal.InheritingState.<init>(InheritingState.java:67)
    at com.google.inject.internal.InjectorShell$Builder.getState(InjectorShell.java:209)
    at com.google.inject.internal.InjectorShell$Builder.lock(InjectorShell.java:115)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
    at com.google.inject.Guice.createInjector(Guice.java:96)

我尝试在代码中删除所有提到的Gephi,同时仍然将JAR放在我的lib/文件夹中,但它会导致相同的异常。

Gephi对于这​​个项目非常重要,所以我不能继续使用另一个库。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

删除那个jar lib,添加另外两个解析器(build.sbt

resolvers += "NetBeans" at "http://bits.netbeans.org/nexus/content/groups/netbeans/"

resolvers += "gephi" at "https://raw.github.com/gephi/gephi/mvn-thirdparty-repo/"

并运行activator update