我打算在Windows 2012服务器上查看最新的1.0.7并下载最新的.zip。我将.zip解压缩到我正常的Red5目录(d:\ program files(x86)\ Red5)并尝试运行red5.bat并得到错误,"无法找到或加载主类文件"。但是,RED5_HOME和JAVA_HOME没有改变。我错过了什么?
red5.bat文件的输出:
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 files(x86)\ red5中。这是修改后的red5.bat文件和后续错误:
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%"
更改了上面的行以包含引号
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%
在第一个参数的结尾和第二个参数的开头添加了引号。报价会自动添加到参数的前端和后端。
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,并尝试录制流。我收到了这个错误。
[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)
答案 0 :(得分:2)
好的,原来的问题是固定的。问题出在red5.bat文件和文件路径周围的引号处理中。我不得不把引号括起来:
set TOMCAT_OPTS=-Dcatalina.home="%RED5_HOME%"
RED5_CLASSPATH在开头和结尾的类路径值中添加了自己的引号,但没有将它们添加到各个参数中。所以,我也不得不把内部&#34;内部&#34;以下语句引用了每个参数:
set RED5_CLASSPATH=%RED5_HOME%\red5-service.jar";"%RED5_HOME%\conf;%CLASSPATH%
当我尝试将其作为一项服务运行时,我还不知道这是做什么的,但我希望当1.0.7最终版本发布时,一切都会好的。有一个错误,但这是另一个问题和帖子。