-1

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.

4
  • 1
    Looks like you should add all your dependencies to the classpath. Commented Jul 6, 2023 at 8:08
  • Exactly. Make sure that you either build a single jar with all dependencies included, or that you add all relevant dependency/library jars to the classpath when running your application. Commented Jul 6, 2023 at 9:13
  • So, even if asterisk-java should work out of the box, I have to download additional software and ad it to java cp ? Commented Jul 11, 2023 at 7:44
  • Ok you were right my bad, I had to download guava jre and add it. Thanks a lot. Commented Jul 11, 2023 at 9:21

1 Answer 1

-1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.