Как настроить Spring Boot с сервером RED5? - PullRequest
0 голосов
/ 14 марта 2019

Я хочу инициализировать свое приложение, чтобы разработать функцию, которая позволит пользователям обмениваться видео и передавать их на стену. Мне сказали, что RED5 является хорошим решением с открытым исходным кодом для такого рода потребностей, поэтому я хочу интегрировать его в свое приложение, но у меня возникли проблемы. Очевидно, есть много проектов с RED5 и Spring MVC, но я использую Spring Boot. Как это адаптировать, спасибо за помощь.

Это мой основной класс.

import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IConnection;
import org.red5.server.api.scope.IScope;
import org.red5.server.api.stream.IServerStream;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoRedApplication extends ApplicationAdapter {

    private IScope appScope;
    private IServerStream serverStream;

    public static void main(String[] args) {
        SpringApplication.run(DemoRedApplication.class, args);
    }

    @Override
    public boolean appStart(IScope app) {
        super.appStart(app);
        log.info("oflaDemo appStart");
        System.out.println("oflaDemo appStart");
        appScope = app;
        return true;
    }

    @Override
    public void appDisconnect(IConnection conn) {
        log.info("oflaDemo appDisconnect");
        if (appScope == conn.getScope() && serverStream != null) {
            serverStream.close();
        }
        super.appDisconnect(conn);
    }

}

my pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo_red</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo_red</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <red5.version>1.0.10</red5.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.red5</groupId>
                <artifactId>red5-parent</artifactId>
                <version>${red5.version}</version>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.red5</groupId>
            <artifactId>red5-server</artifactId>
            <version>${red5.version}</version>
            <type>jar</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

ошибка

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.3.RELEASE)

2019-03-14 09:43:41.031  INFO 2032 --- [  restartedMain] com.example.demo_red.DemoRedApplication  : Starting DemoRedApplication on DESKTOP-BUDEV02 with PID 2032 (C:\Users\s.nouebissi\Desktop\projects\demo_red\target\classes started by s.nouebissi in C:\Users\s.nouebissi\Desktop\projects\demo_red)
2019-03-14 09:43:41.036  INFO 2032 --- [  restartedMain] com.example.demo_red.DemoRedApplication  : No active profile set, falling back to default profiles: default
2019-03-14 09:43:41.120  INFO 2032 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-03-14 09:43:41.121  INFO 2032 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2019-03-14 09:43:43.587  INFO 2032 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-03-14 09:43:43.634  INFO 2032 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-03-14 09:43:43.634  INFO 2032 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.16]
2019-03-14 09:43:43.649  INFO 2032 --- [  restartedMain] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_171\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0_171\bin;E:\softs\apache-maven\bin;C:\Program Files\nodejs\;C:\Program Files\Git\bin;C:\Program Files\Git\cmd;C:\Users\s.nouebissi\AppData\Roaming\npm;C:\Program Files (x86)\Cuminas\Document Express DjVu Plug-in\;C:\Program Files\Docker\Docker\Resources\bin;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Yarn\bin\;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft Emulator Manager\1.0\;C:\WINDOWS\system32;C:\PostgreSQL\pg10\bin;00C:\Users\s.nouebissi\AppData\Local\Programs\Python\Python36-32;00C:\Users\s.nouebissi\AppData\Local\Programs\Python\Python36-32\Scripts;C:\Python27;C:\Python27\Scripts;C:\WINDOWS\System32\OpenSSH\;C:\Users\s.nouebissi\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\s.nouebissi\AppData\Local\Programs\Python\Python36-32\;C:\Users\s.nouebissi\AppData\Local\Programs\Python\Python37-32\Scripts\;C:\Users\s.nouebissi\AppData\Local\Programs\Python\Python37-32\;C:\Users\s.nouebissi\AppData\Local\Microsoft\WindowsApps;;C:\Users\s.nouebissi\AppData\Local\Programs\Microsoft VS Code\bin;.]
2019-03-14 09:43:43.850  INFO 2032 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-03-14 09:43:43.850  INFO 2032 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2729 ms
2019-03-14 09:43:44.119  INFO 2032 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-03-14 09:43:44.320  INFO 2032 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2019-03-14 09:43:44.373  INFO 2032 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-03-14 09:43:44.389  INFO 2032 --- [  restartedMain] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-03-14 09:43:44.404 ERROR 2032 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [com.example.demo_red.DemoRedApplication$$EnhancerBySpringCGLIB$$63893cbe@1b4250e0] with key 'demoRedApplication'; nested exception is javax.management.NotCompliantMBeanException: MBean class com.example.demo_red.DemoRedApplication$$EnhancerBySpringCGLIB$$63893cbe does not implement DynamicMBean, and neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class com.example.demo_red.DemoRedApplication$$EnhancerBySpringCGLIB$$63893cbe is not a JMX compliant Standard MBean) nor the MXBean conventions (javax.management.NotCompliantMBeanException: com.example.demo_red.DemoRedApplication$$EnhancerBySpringCGLIB$$63893cbe: Class com.example.demo_red.DemoRedApplication$$EnhancerBySpringCGLIB$$63893cbe implements more than one MXBean interface: [interface org.red5.server.jmx.mxbeans.ApplicationMXBean, interface org.red5.server.jmx.mxbeans.AttributeStoreMXBean])
    at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:625) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.jmx.export.MBeanExporter.lambda$registerBeans$2(MBeanExporter.java:551) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at java.util.HashMap.forEach(HashMap.java:1289) ~[na:1.8.0_171]
    at org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:551) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.jmx.export.MBeanExporter.afterSingletonsInstantiated(MBeanExporter.java:434) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
    at com.example.demo_red.DemoRedApplication.main(DemoRedApplication.java:17) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_171]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_171]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_171]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.3.RELEASE.jar:2.1.3.RELEASE]
Caused by: javax.management.NotCompliantMBeanException: MBean class com.example.demo_red.DemoRedApplication$$EnhancerBySpringCGLIB$$63893cbe does not implement DynamicMBean, and neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class com.example.demo_red.DemoRedApplication$$EnhancerBySpringCGLIB$$63893cbe is not a JMX compliant Standard MBean) nor the MXBean conventions (javax.management.NotCompliantMBeanException: com.example.demo_red.DemoRedApplication$$EnhancerBySpringCGLIB$$63893cbe: Class com.example.demo_red.DemoRedApplication$$EnhancerBySpringCGLIB$$63893cbe implements more than one MXBean interface: [interface org.red5.server.jmx.mxbeans.ApplicationMXBean, interface org.red5.server.jmx.mxbeans.AttributeStoreMXBean])
    at com.sun.jmx.mbeanserver.Introspector.checkCompliance(Introspector.java:176) ~[na:1.8.0_171]
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:317) ~[na:1.8.0_171]
    at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522) ~[na:1.8.0_171]
    at org.springframework.jmx.support.MBeanRegistrationSupport.doRegister(MBeanRegistrationSupport.java:137) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.jmx.export.MBeanExporter.registerBeanInstance(MBeanExporter.java:671) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:615) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
    ... 19 common frames omitted

2019-03-14 09:43:44.404  INFO 2032 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

Process finished with exit code 0
...