red5

How I can embed my code in red5 server?


I want to use JWT for generate token code in my Red5 server application.When I generate token code by JWT on local ,there is no mistake. When I embed my generate token code in Red5 server application,that show exception as follow:

[ERROR] [RTMPConnectionExecutor-1] org.red5.server.net.rtmp.BaseRTMPHandler - Exception
java.lang.NoClassDefFoundError: com/auth0/jwt/JWTSigner
    at org.red5.jwt.util.JWTUtil.<clinit>(JWTUtil.java:23)
    at org.red5.core.Application.connect(Application.java:68)
    at org.red5.server.scope.Scope.connect(Scope.java:248)
    at org.red5.server.BaseConnection.connect(BaseConnection.java:366)
    at org.red5.server.net.rtmp.RTMPConnection.connect(RTMPConnection.java:486)
    at org.red5.server.net.rtmp.RTMPMinaConnection.connect(RTMPMinaConnection.java:93)
    at org.red5.server.net.rtmp.RTMPHandler.onCommand(RTMPHandler.java:337)
    at org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:116)
    at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:72)
    at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:38)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.auth0.jwt.JWTSigner
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
    ... 16 common frames omitted

My code is like this:

public class Application extends MultiThreadedApplicationAdapter {

    @Override
    public boolean connect(IConnection conn, IScope scope, Object[] params) {


        String token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9";

        PayLoadMapper userValid = JWTUtil.unsign(token, PayLoadMapper.class);

        System.out.println(userValid);
      }
}

Why I can not embed my api code into Red5 application? It's the way which I do this make mistake.How I can do this?


Solution

  • Ensure Check the JWT lib exsited under you app.