GetStream / stream-chat-java

Stream Chat official Java API Client

Home Page:https://getstream.io/chat/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calling create token throws class not found

TomBeckett opened this issue · comments

Calling the static io.getstream.chat.java.models.User.createToken method outside of the SDK throws a ClassNotFound error. For example:

java.lang.ClassNotFoundException: io.jsonwebtoken.SignatureAlgorithm
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636) ~[na:na]
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182) ~[na:na]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[na:na]
	at io.getstream.chat.java.models.User.createToken(User.java:1332) ~[stream-chat-java-1.2.0.jar:na]
	at app.squaddy.api.service.external.GetStreamService.createTokenForUser(GetStreamService.java:218) ~[classes/:na]

Example usage:

createToken(chatId, null, null);

Adding the dependency to our POM.xml does fix the issue for now:

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.9.1</version>
        </dependency>

SDK Version: 1.2.0

Facing the same issue

Thanks for the report and confirmation! Will address it today!

@TomBeckett @akul1994 I can't reproduce this issue. Could you please give some context how you package and run your application? If you could publish demo project with the issue it would be the best.

@driver-devel Sorry for the late reply.. for some reason I didn't get a notification!

This occurs are runtime (not running locally via say, IntelliJ or Eclipse).

This is not resolved, a related issue is here: #38

Why are you recommending to add the io.jsonwebtoken jjwt dependency when actually stream-java depends on the com.auth0 jwt implementation? In such a case the solution would be to remove io.jsonwebtoken, not to add it. You can see this dependency here https://mvnrepository.com/artifact/io.getstream.client/stream-java/3.2.4

stream-java isn't this SDK/repo, It's this one, https://github.com/getstream/stream-java for feed client.