RED5 Server installation on Centos 5 server

i'm going through a big problem. trying to install RED5 on a Centos Sever. i followed all the steps according the the tutorial i found on the internet, as all are same but now I'm facing the problem. as everything should work fine.but

As i try to start RED5 service

 

root@nod19 [/usr/local/red5]# /etc/init.d/red5 start

Starting red5: [ OK ]

Status of the RED5 Service

 root@nod19 [/usr/local/red5]# /etc/init.d/red5 status

red5 dead but pid file exists

when i start RED5 server.

root@nod19 [/usr/local/red5]# ./red5.sh

Starting Red5

Exception in thread “main” java.lang.NoClassDefFoundError: org/red5/server/Bootstrap

Caused by: java.lang.ClassNotFoundException: org.red5.server.Bootstrap

    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:319)

    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:264)

    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)

Could not find the main class: org.red5.server.Bootstrap. Program will exit.

So any solution?

How did you install Red5?

[quote=", post:, topic:"]

How did you install Red5?
[/quote]

Step by step procedure

Installing Red5 on cPanel/WHM CentOS

I don't think anyone can give you much help regarding this issue. It seems to be a simple case of an incomplete or corrupted installation. The error clearly says that it couldn't find the main class, so it doesn't have an entry point. Suggest you try reinstalling (if you haven't already), or try to find another set of installation instructions in case this one missed something.

Although Red5 is probably not in any repository, you can also try the following to see if it works: yum install Red5

doing strace may give more info but as Sah mentioned its essentially an incomplete or corrupted installation.

Are you able to see red5 running in process list after doing './red5.sh &' ?

Try following changes in the tutorial you followed..

>In export variables part use the following instead.

[quote=", post:, topic:"]
export ANT_HOME=/usr/local/ant

export JAVA_HOME=/usr/lib/jvm/java

export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

[/quote]

First two commands are same as in your referenced tutorial.

But last two commands are changed with different classes. I am not sure how the tutorial would have worked for writer but the "/lib/classes.jar" doesn't exist in the source of the openjdk, he used in his tutorial. I searched for the classes.zip in the directory, it's not there.

Be careful of adding (dots) and (colons) accordingly and the $PATH variable should be concatenated with the values already in it

You have to make sure before setting variables above that PATH and CLASSPATH variables must must be as good as they were before your last try... they are the variables used in compilation.. so it's good that you don't loose any required class or classes which need to be included while compilation.

>Leave the echo statements in export part, they are not needed

You can use every thing(jdk, ant, red5 source) as referenced in the tutorial. however I downloaded the ANT package directly from apache website and used that (http://ant.apache.org/bindownload.cgi) but it's the same version as referenced in the tutorial. Following the tutorial about this should work fine.

During the execution of ANT commands, make sure you don't see any error on the console. it may take a few minutes depending on the packages(not found already on the system). With me, It took 7 minutes and some seconds downloading the required packages (on 1mbps connection). Keep your eyes on the console it should not show any error or warning. The "exception" you posted may occur again if the red5 source is not compiled fully at this stage.

Hope it would help...

well actually i did notice problem starts here.

when i execute ant dist

[root@nod19 red5]# ant dist

====================

at the end the following error comes.

BUILD FAILED

/usr/local/red5/build.xml:214: The following error occurred while executing this line:

/usr/local/red5/build.xml:235: Error running /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac compiler

Total time: 1 minute 14 seconds

i'm using centos 5.5. seems like i need to use newer version of java.

@K.A

Can you help me to install RED5 on the server. if i send you the root access login?

^ I can try. But I can't give you surety about that as I am not that expert with Linux. I rarely troubleshooted any problem on Linux.

As you have tried already with exporting variables, that make me doubt if you have set the variables in correct way. I am not sure what previous values were in PATH and CLASSPATH variables before appending the new ones for Red5 compilation. So there will be difficulty for me to fix that thing if it would have gone wrong..

Any ways if want me to try I'd not refuse... If you have VNC access I would want that as well.

email sent. check it.

^ I am sorry buddy I couldn't fix it. But it took a bit longer to reach the root cause.

The error you mentioned in your last post about "ant dist" is not the main problem. Not even the "ant prepare" command was successful as I checked it.

And the reason was your server's memory.

Java programs aren't able to run successfully even with a simple runtime.exec function to list a directory with only 2 files in it on the filesystem . I tried to specify the heap size but the system doesn't let Java avail enough heap size to run the programs successfully. It was just a test using a simple Java program, I needed to make sure. but with Red5 you would probably need to dedicate or preset the swap size to run it all the time as there is Zero swap size available on the system. Unfortunately it didn't let me allocate a bit of a memory to swap. I used "swapon" command for that.

May be a good Linux guy could help you with that. or you might want to check with Hosting provider..

The error during the Red5 build is as quoted following when running "ant prepare" which you would need to look forward from.

Did you see the error on second line of the output? that's the error you would need to fix.

Also, I guess you gave me another machine to set it up. So you might have some other error(s) on the machine you were trying to setup but the error below doesn't mean to be the same on any other machine.

root@pk [/usr/local/red5]# ant prepare

Buildfile: /usr/local/red5/build.xml

[property] java.io.IOException: Cannot run program “/bin/env”: java.io.IOException: error=12, Cannot allocate memory

[property] at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)

[property] at java.lang.Runtime.exec(Runtime.java:610)

[property] at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:827)

[property] at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:445)

[property] at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:459)

[property] at org.apache.tools.ant.taskdefs.Execute.getProcEnvironment(Execute.java:165)

[property] at org.apache.tools.ant.taskdefs.Property.loadEnvironment(Property.java:646)

[property] at org.apache.tools.ant.taskdefs.Property.execute(Property.java:488)

[property] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)

[property] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[property] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

[property] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

[property] at java.lang.reflect.Method.invoke(Method.java:616)

[property] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

[property] at org.apache.tools.ant.Task.perform(Task.java:348)

[property] at org.apache.tools.ant.Target.execute(Target.java:390)

[property] at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:179)

[property] at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:82)

[property] at org.apache.tools.ant.Main.runBuild(Main.java:786)

[property] at org.apache.tools.ant.Main.startAnt(Main.java:218)

[property] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)

[property] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

[property] Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory

[property] at java.lang.UNIXProcess.(UNIXProcess.java:164)

[property] at java.lang.ProcessImpl.start(ProcessImpl.java:81)

[property] at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)

[property] … 21 more

prepare:

[mkdir] Created dir: /usr/local/red5/bin

[mkdir] Created dir: /usr/local/red5/dist

[mkdir] Created dir: /usr/local/red5/log

[mkdir] Created dir: /usr/local/red5/dist/log

[mkdir] Created dir: /usr/local/red5/cluster

[mkdir] Created dir: /usr/local/red5/cluster/origin

[mkdir] Created dir: /usr/local/red5/cluster/edge

[mkdir] Created dir: /usr/local/red5/bin/testcases/classes

[mkdir] Created dir: /usr/local/red5/bin/testcases/testreports

BUILD SUCCESSFUL

Total time: 1 second

Thank you mate for the help, well both machines are almost same., well. anyways thanks for the help :)

^Please do post when it gets fixed by any way... Thanks.

I just found till now that the Virtual Environment you have been on, will perhaps not let you have Red5 on it.

The VPS you are having is on OpenVZ/Virtuozzo, which is an operating system-level virtualization platform and will not let you use the core of the kernel as it is required for most of the Java Applications or any other tasks which require high memory, Swap space is a requirement.

For using Java applications or performing specifically video encoding tasks or any thing which have high memory overhead, you would need to use a VPS on a VMware or Xen. Following articles might be useful for information.

COMPARE VPS HOSTING PLATFORMS: OPENVZ VS XEN

The Truth About Hosting Virtual Servers on VMware vs Virtuozzo

I would still request you to post any thing you find to solve the issue on the same platform with/without any changes.

It should work fine on Virtouzzo/OpenVZ , the main bottle neck is memory , if the VPS has enough Ram it will work.

how much ram do you have on your vps ? guaranteed and burst ?

Yes! exactly I mentioned about the memory limitations being the main problem.

Why I mentioned about VE? Frankly speaking, I don't have any idea about Virtouzzo/OpenVZ that what they offer and what they don't or what they can or cannot offer. but I pointed this fact as it was needed because these have been discussed a lot on forums that are causing trouble when working with memory hefty applications like Java ones and if there is no available memory to perform that task, because you can not manage memory according to your desire within the OpenVZ virtual machine. But may be the hosting provider or the one who is managing the host, can fix it in any way...

I am also having a new thought that it might not be the low memory problem but a restriction to allocate specific memory on Linux externally from programs. And during the Red5 installation it needs to execute the external command "/bin/env" to fetch environment variables, where it fails. But the Runtime.getRunTime().exec(command) would probably need a memory allocation on runtime.

Why I think so? As I mentioned already, I do have the same Red5 running on CentOS>VMware with total memory of 768MB and only 150MB available, with 1.5GB Swap Space. Considering the difference of "Swap Space" from the slave's machine, I tested, on my machine, after unallocating the swap partition from my machine. So then after having NO Swap Space available and only 150MB of available memory, every thing still worked great on my virtual machine without any error. Unlike that, the available free memory on slave's machine was around 800MB and some thing.

I really think the problem is due to the Virtual Machine configuration. It may also be intentional or also be problem of limited resources given to Virtual Machines. So I think it has to be with fixing the problem on Host....

edit: spelling corrected..

Well if his vps has like 800Mb free then I guess the total guaranteed ram must be above 1G , right ? . If that is the case then yes it should work and memory should not be an issue, also I have installed it on virtouzzo/openvz platforms few times and I can confirm it works, but yes it do give tough time in most cases on virtual environments. Also if the assigned memory to VPS is 1G but there is no burst ram available or the memory is heavily oversold on the node, then actual memory allocation can be issue.

btw how you checked the memory , using 'free -m' ? If yes then it shows the burst ram and not guaranteed.

I don't have access to his machine now nor I have any thing to do on it any more, so let's hope what he discovers about that..... Hope he would want to share :P

And yes! the memories on both machines,I mentioned above, were taken from "free -m" or "/proc/meminfo".

Ya lets see when slave comes back and reports some thing :)