Guava在启动Asterisk-Java时出现问题。

huangapple go评论99阅读模式
英文:

Guava issue when starting Asterisk-Java

问题

I'm trying to compile a project and it uses guava. The project is Asterisk-Java (https://github.com/asterisk-java/asterisk-java) and when I'm trying to run the .jar with the command java -cp asterisk-java.jar org.asteriskjava.fastagi.DefaultAgiServer, the following error appears:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/util/concurrent/RateLimiter at org.asteriskjava.lock.Lockable.<init>(Lockable.java:23) at org.asteriskjava.fastagi.AbstractMappingStrategy.<init>(AbstractMappingStrategy.java:38) at org.asteriskjava.fastagi.ResourceBundleMappingStrategy.<init>(ResourceBundleMappingStrategy.java:93) at org.asteriskjava.fastagi.ResourceBundleMappingStrategy.<init>(ResourceBundleMappingStrategy.java:67) at org.asteriskjava.fastagi.ResourceBundleMappingStrategy.<init>(ResourceBundleMappingStrategy.java:57) at org.asteriskjava.fastagi.DefaultAgiServer.<init>(DefaultAgiServer.java:158) at org.asteriskjava.fastagi.DefaultAgiServer.<init>(DefaultAgiServer.java:136) at org.asteriskjava.fastagi.DefaultAgiServer.<init>(DefaultAgiServer.java:76) at org.asteriskjava.fastagi.DefaultAgiServer.main(DefaultAgiServer.java:394) Caused by: java.lang.ClassNotFoundException: com.google.common.util.concurrent.RateLimiter at java.net.URLClassLoader.findClass(URLClassLoader.java:387) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 9 more

Here's the dependencies used that make crash:

<dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>32.0.1-jre</version> </dependency>

I tried to change the guava version in pom.xml but it still not working :/

I tried to change guava version to make the rate limiter work but nothing changed.

英文:

I'm trying to compile a project and it uses guava. The project is Asterisk-Java (https://github.com/asterisk-java/asterisk-java) and when I'm trying to run the .jar with the command java -cp asterisk-java.jar org.asteriskjava.fastagi.DefaultAgiServer, the following error appear :


Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: com/google/common/util/concurrent/RateLimiter at org.asteriskjava.lock.Lockable.&lt;init&gt;(Lockable.java:23) at org.asteriskjava.fastagi.AbstractMappingStrategy.&lt;init&gt;(AbstractMappingStrategy.java:38) at org.asteriskjava.fastagi.ResourceBundleMappingStrategy.&lt;init&gt;(ResourceBundleMappingStrategy.java:93) at org.asteriskjava.fastagi.ResourceBundleMappingStrategy.&lt;init&gt;(ResourceBundleMappingStrategy.java:67) at org.asteriskjava.fastagi.ResourceBundleMappingStrategy.&lt;init&gt;(ResourceBundleMappingStrategy.java:57) at org.asteriskjava.fastagi.DefaultAgiServer.&lt;init&gt;(DefaultAgiServer.java:158) at org.asteriskjava.fastagi.DefaultAgiServer.&lt;init&gt;(DefaultAgiServer.java:136) at org.asteriskjava.fastagi.DefaultAgiServer.&lt;init&gt;(DefaultAgiServer.java:76) at org.asteriskjava.fastagi.DefaultAgiServer.main(DefaultAgiServer.java:394) Caused by: java.lang.ClassNotFoundException: com.google.common.util.concurrent.RateLimiter at java.net.URLClassLoader.findClass(URLClassLoader.java:387) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 9 more

Here's the dependencies used that make crash:

&lt;dependency&gt; &lt;groupId&gt;com.google.guava&lt;/groupId&gt; &lt;artifactId&gt;guava&lt;/artifactId&gt; &lt;version&gt;32.0.1-jre&lt;/version&gt; &lt;/dependency&gt;

I tryied to change the guava version in pom.xml but it still not working :/

I tryied to change guava version to make the rate limiter work but nothing changed.

答案1

得分: -1

已解决:确实,为了解决这个问题,我不得不下载guava .jar(jre)(在此处:https://github.com/google/guava/releases),然后通过运行以下命令将其添加到类路径中:java -cp asterisk-java.jar:guava-32.1.1-jre.jar org.asteriskjava.fastagi.DefaultAgiServer

然后它完美地工作了。感谢帮助者。

英文:

SOLVED: Indeed, to fix this issues, I had to download the guava .jar (jre) (here: https://github.com/google/guava/releases) and add it in the cp by running this command : java -cp asterisk-java.jar:guava-32.1.1-jre.jar org.asteriskjava.fastagi.DefaultAgiServer

And it worked perfeclty. Thanks to helpers.

huangapple
  • 本文由 发表于 2023年7月6日 16:03:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76626716.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定