本文介绍了Red5 1.0.7M10:找不到或加载主类文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算看一看Windows 2012服务器上的最新1.0.7,并下载了最新的.zip.我将.zip解压缩到正常的Red5目录(d:\ program files(x86)\ Red5)中,并尝试运行red5.bat并收到错误消息找不到或加载主类文件".但是,RED5_HOME和JAVA_HOME尚未更改.我想念什么?

I was going to take a look at the latest 1.0.7 on a Windows 2012 server and downloaded the latest .zip. I extracted the .zip into my normal Red5 directory (d:\program files (x86)\Red5) and tried to run red5.bat and got the error, "Could not find or load main class Files". However, RED5_HOME and JAVA_HOME have not changed. What did I miss?

red5.bat文件的输出:

Output of the red5.bat file:

    D:\Program Files (x86)\Red5>if NOT DEFINED RED5_MAINCLASS set RED5_MAINCLASS=org
    .red5.server.Bootstrap

    D:\Program Files (x86)\Red5>if NOT DEFINED JAVA_HOME goto err

    D:\Program Files (x86)\Red5>REM JAVA options

    D:\Program Files (x86)\Red5>REM You can set JVM additional options here if you w
    ant

    D:\Program Files (x86)\Red5>if NOT DEFINED JVM_OPTS set JVM_OPTS=-Xverify:none -
    XX:+TieredCompilation -XX:+UseBiasedLocking -XX:+UseParNewGC -XX:InitialCodeCach
    eSize=8m -XX:ReservedCodeCacheSize=32m -Dorg.terracotta.quartz.skipUpdateCheck=t
    rue

    D:\Program Files (x86)\Red5>REM Set up logging options

    D:\Program Files (x86)\Red5>set LOGGING_OPTS=-Dlogback.ContextSelector=org.red5.
    logging.LoggingContextSelector -Dcatalina.useNaming=true

    D:\Program Files (x86)\Red5>REM Set up security options

    D:\Program Files (x86)\Red5>REM set SECURITY_OPTS=-Djava.security.debug=failure
    -Djava.security.manager -Djava.security.policy="D:\Program Files (x86)\Red5/conf
    /red5.policy"

    D:\Program Files (x86)\Red5>set SECURITY_OPTS=-Djava.security.debug=failure

    D:\Program Files (x86)\Red5>REM Set up tomcat options

    D:\Program Files (x86)\Red5>set TOMCAT_OPTS=-Dcatalina.home=D:\Program Files (x8
    6)\Red5

    D:\Program Files (x86)\Red5>REM Setup python/jython path

    D:\Program Files (x86)\Red5>set JYTHON_OPTS=-Dpython.home=lib

    D:\Program Files (x86)\Red5>REM Combined java options

    D:\Program Files (x86)\Red5>set JAVA_OPTS=-Dlogback.ContextSelector=org.red5.log
    ging.LoggingContextSelector -Dcatalina.useNaming=true -Djava.security.debug=fail
    ure  -Xverify:none -XX:+TieredCompilation -XX:+UseBiasedLocking -XX:+UseParNewGC
     -XX:InitialCodeCacheSize=8m -XX:ReservedCodeCacheSize=32m -Dorg.terracotta.quar
    tz.skipUpdateCheck=true -Dcatalina.home=D:\Program Files (x86)\Red5 -Dpython.hom
    e=lib

    D:\Program Files (x86)\Red5>set RED5_CLASSPATH=D:\Program Files (x86)\Red5\red5-
    service.jar;D:\Program Files (x86)\Red5\conf;

    D:\Program Files (x86)\Red5>if NOT DEFINED RED5_OPTS set RED5_OPTS=

    D:\Program Files (x86)\Red5>goto launchRed5

    D:\Program Files (x86)\Red5>echo Starting Red5
    Starting Red5

    D:\Program Files (x86)\Red5>"D:\Program Files\Java\jdk8\bin\java" -Dlogback.Cont
    extSelector=org.red5.logging.LoggingContextSelector -Dcatalina.useNaming=true -D
    java.security.debug=failure  -Xverify:none -XX:+TieredCompilation -XX:+UseBiased
    Locking -XX:+UseParNewGC -XX:InitialCodeCacheSize=8m -XX:ReservedCodeCacheSize=3
    2m -Dorg.terracotta.quartz.skipUpdateCheck=true -Dcatalina.home=D:\Program Files
     (x86)\Red5 -Dpython.home=lib -cp "D:\Program Files (x86)\Red5\red5-service.jar;
    D:\Program Files (x86)\Red5\conf;" org.red5.server.Bootstrap
    Java HotSpot(TM) 64-Bit Server VM warning: Using the ParNew young collector with
     the Serial old collector is deprecated and will likely be removed in a future r
    elease
    Error: Could not find or load main class Files

我终于能够通过更改red5.bat文件并弄乱一些参数的引号来启动Red5.这是Windows服务器,因此red5在c:\ program文件(x86)\ red5中.这是修改后的red5.bat文件和随后的错误:

I was finally able to get Red5 started by changing the red5.bat file and messing with the quotes around some of the parameters. It's a Windows server so red5 is in c:\program files (x86)\red5. Here is the modified red5.bat file and subsequent error:

if NOT DEFINED RED5_HOME set RED5_HOME=%~dp0

if NOT DEFINED RED5_MAINCLASS set RED5_MAINCLASS=org.red5.server.Bootstrap

if NOT DEFINED JAVA_HOME goto err

if NOT DEFINED JVM_OPTS set JVM_OPTS=-Xverify:none -XX:+TieredCompilation -XX:+UseBiasedLocking -XX:+UseParNewGC -XX:InitialCodeCacheSize=8m -XX:ReservedCodeCacheSize=32m -Dorg.terracotta.quartz.skipUpdateCheck=true

set LOGGING_OPTS=-Dlogback.ContextSelector=org.red5.logging.LoggingContextSelector -Dcatalina.useNaming=true

set SECURITY_OPTS=-Djava.security.debug=failure

set TOMCAT_OPTS=-Dcatalina.home="%RED5_HOME%"

在行上方更改为包含引号

changed above line to include quotes

set JYTHON_OPTS=-Dpython.home=lib

set JAVA_OPTS=%LOGGING_OPTS% %SECURITY_OPTS% %JAVA_OPTS% %JVM_OPTS% %TOMCAT_OPTS% %JYTHON_OPTS%

set RED5_CLASSPATH=%RED5_HOME%\red5-service.jar";"%RED5_HOME%\conf;%CLASSPATH%

在第一个参数的结尾和第二个参数的开头添加了引号.引号会自动添加到参数的开头和结尾.

Added quotes to end of first param and beginning of second. Quotes are automatically added to front and end of parameter.

if NOT DEFINED RED5_OPTS set RED5_OPTS= 

goto launchRed5

:launchRed5
echo Starting Red5
"%JAVA_HOME%\bin\java" %JAVA_OPTS% -cp "%RED5_CLASSPATH%" %RED5_MAINCLASS% %RED5_OPTS%

但是,在能够运行Red5之后,我添加了我的应用程序eTutor,并尝试记录流.我得到了这个错误.

However, after I was able to get Red5 running, I added my app, eTutor, and tried to record a stream. I got this error.

[INFO] [RTMPConnectionExecutor-1] maple.classroom.MapleClassroom - W3C x-category:session x-event:connect c-ip:76.242.102.xxx c-client-id:0
[INFO] [Red5_Scheduler_Worker-31] maple.classroom.MapleClassroom - W3C x-category:stream x-event:play c-ip:76.242.102.xxx x-sname:4fb77abf-56aa-45cd-8907-11aa2a333cb6
[INFO] [Red5_Scheduler_Worker-32] maple.classroom.MapleClassroom - W3C x-category:stream x-event:play c-ip:76.242.102.xxx x-sname:4fb77abf-56aa-45cd-8907-11aa2a333cb6 x-name:CADEaudio/2820/MOB_49_0_2
[INFO] [RTMPConnectionExecutor-1] org.red5.server.stream.StreamService - closeStream  stream id: 1 connection: WAOIKZMBN2YZO
[INFO] [RTMPConnectionExecutor-1] org.red5.server.stream.StreamService - Stream not found - streamId: 1 connection: WAOIKZMBN2YZO
[INFO] [Red5_Scheduler_Worker-17] maple.classroom.MapleClassroom - W3C x-category:stream x-event:stop c-ip:76.242.102.xxx cs-bytes:3953 sc-bytes:4031 x-sname:4fb77abf-56aa-45cd-8907-11aa2a333cb6
[INFO] [RTMPConnectionExecutor-4] org.red5.server.scope.BasicScope - ClientBroadcastStream already exists: org.red5.server.stream.ClientBroadcastStream@60f07d5c new: org.red5.server.stream.ClientBroadcastStream@60f07d5c
[INFO] [RTMPConnectionExecutor-4] org.red5.server.stream.ClientBroadcastStream - Stream start: CADEaudio/2820/MOB_49_0_2
[INFO] [RTMPConnectionExecutor-4] maple.classroom.MapleClassroom - W3C x-category:stream x-event:record-start c-ip:76.242.102.xxx x-sname:22665dc5-26ea-470a-98b5-0cf9b5894d5c x-file-name:MOB_49_0_2.flv
[WARN] [Red5_Scheduler_Worker-24] org.red5.server.stream.RecordingListener - Exception while pushing to consumer
java.nio.BufferUnderflowException: null
        at java.nio.HeapByteBuffer.get(Unknown Source)
        at org.apache.mina.core.buffer.AbstractIoBuffer.get(AbstractIoBuffer.java:625)
        at org.apache.mina.core.buffer.AbstractIoBuffer.get(AbstractIoBuffer.java:1337)
        at org.red5.server.stream.consumer.ImmutableTag.build(ImmutableTag.java:183)
        at org.red5.server.stream.consumer.FileConsumer$QueuedData.<init>(FileConsumer.java:795)
        at org.red5.server.stream.consumer.FileConsumer.pushMessage(FileConsumer.java:256)
        at org.red5.server.stream.RecordingListener.processQueue(RecordingListener.java:319)
        at org.red5.server.stream.RecordingListener.access$300(RecordingListener.java:57)
        at org.red5.server.stream.RecordingListener$EventQueueJob.execute(RecordingListener.java:383)
        at org.red5.server.scheduling.QuartzSchedulingServiceJob.executeInternal(QuartzSchedulingServiceJob.java:89)
        at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)

推荐答案

好,原来的问题已解决.问题出在red5.bat文件和文件路径周围引号的处理中.我不得不把引号放在周围:

Ok, the original problem is fixed. The issue was in the red5.bat file and the handling of quotes around file paths. I had to put quotes around:

set TOMCAT_OPTS=-Dcatalina.home="%RED5_HOME%"

RED5_CLASSPATH在开始和结束处的类路径值中添加了自己的引号,但未将其添加到各个参数中.因此,我还必须将以下语句放入内部",以便引用每个参数:

The RED5_CLASSPATH added its own quotes to the classpath value on the start and end but didn't add them to the individual parameters. So, I also had to put "inside" the following statement so each parameter was quoted:

set RED5_CLASSPATH=%RED5_HOME%\red5-service.jar";"%RED5_HOME%\conf;%CLASSPATH%

当我尝试将其作为服务运行时,我还不知道该怎么办,但是我希望当1.0.7最终版发布时,一切都会很好.有一个错误,但这是另一个问题并发布.

I have no idea yet what this is going to do when I try to run it as a service, but I'm hoping when 1.0.7 final is released, all will be good. There is the one error but that's another issue and post.

这篇关于Red5 1.0.7M10:找不到或加载主类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 18:31