Open schneiderbruno opened 3 weeks ago
Hey @schneiderbruno,
Is this issue related to https://github.com/ably/ably-java/issues/1037? If you look at the error message, it says that your ClassLoader
can’t find a runtime dependency.
I reviewed the Gradle file you provided in https://github.com/ably/ably-java/issues/1037, and it contains a logical problem. When you try to build a ‘fat’ JAR, you are adding compile dependencies. Compile dependencies are only used during the compilation phase, but to run your JAR file, you need to include runtime dependencies. So instead of:
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
you should have:
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
I have a very strange error. When trying to run AblyRealtime realtime = new AblyRealtime(options);
If I run my project by importing the jar manually, I get the error below. If I run it via Gradle, the error does not occur. However, when I export the jar via Gradle and run the app.jar, the error also occurs...
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: org/java_websocket/exceptions/WebsocketNotConnectedException at io.ably.lib.transport.WebSocketTransport$Factory.getTransport(WebSocketTransport.java:39) at io.ably.lib.transport.WebSocketTransport$Factory.getTransport(WebSocketTransport.java:36) at io.ably.lib.transport.ConnectionManager.connectImpl(ConnectionManager.java:1518) at io.ably.lib.transport.ConnectionManager.access$400(ConnectionManager.java:38) at io.ably.lib.transport.ConnectionManager$Connecting.enact(ConnectionManager.java:227) at io.ably.lib.transport.ConnectionManager$StateChangeAction.enactState(ConnectionManager.java:572) at io.ably.lib.transport.ConnectionManager$AsynchronousStateChangeAction.run(ConnectionManager.java:616) at io.ably.lib.transport.ConnectionManager$ActionHandler.run(ConnectionManager.java:726) at java.base/java.lang.Thread.run(Thread.java:835) Caused by: java.lang.ClassNotFoundException: org.java_websocket.exceptions.WebsocketNotConnectedException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 9 more
Source code ClientOptions options = new ClientOptions(XXXX); AblyRealtime realtime = new AblyRealtime(options);