我如何将我的代码嵌入到 red5 服务器中?

How I can embed my code in red5 server?

我想在我的Red5服务器上使用JWT生成令牌代码application.When我在本地通过JWT生成令牌代码,没有错误。当我在 Red5 服务器应用程序中嵌入我的生成令牌代码时,显示异常如下:

[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

我的代码是这样的:

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);
      }
}

为什么我无法将 api 代码嵌入到 Red5 应用程序中?这就是我这样做的方式 mistake.How 我能做到吗?

我解决了问题。 Ip put the jar in red5 server lib ,my appliction's lib is empty,so I put the JWT lib under the appliction.That's OK now.

确保检查应用程序下存在的 JWT 库。