英文:
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 "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 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论