在Play应用程序中使用Gephi [英] Using Gephi inside a Play Application

查看:196
本文介绍了在Play应用程序中使用Gephi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在Scala中构建一个Play框架应用程序,该应用程序需要使用Gephi Java库.

I am currently building a Play Framework application in Scala that requires the use of the Gephi Java library.

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

I tried adding Gephi as a managed dependency in SBT, but SBT cannot resolve all of Gephi's dependencies. This is a known issue. I then simply tried to add the whole Gephi JAR in my lib/ folder as an unmanaged dependency. IntelliJ detects the library just fine and I can compile my application perfectly fine. The problem is an exception occurs immediately upon starting the application, and it seems to be related to dependency injection:

    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/文件夹中,但是这会导致相同的异常.

I tried removing all mention of Gephi in the code, while still having the JAR sitting in my lib/ folder, but it results in the same exception.

Gephi对于这​​个项目真的很重要,所以我不能只转到另一个库.有什么想法吗?

Gephi is really important for this project, so I can't just move on to another library. Any ideas?

推荐答案

删除该jar fom lib,添加这两个附加的解析器(在build.sbt中)

Remove that jar fom lib, add those two additional resolvers (in 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

这篇关于在Play应用程序中使用Gephi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆