Red5 Eclipse plug-in: The next issue after the JAVA_HOME issue…

By robsilverton

You’ll see in this previous post that I ran into a fair few issues trying to get the Red5 Eclipse plug-in working, as have a several others it seems including fellow FlashBrightonian and Flash expert Iestyn Lloyd. Due to time constraints I unfortunately had to admit defeat with only an inkling of a problem with the JAVA_HOME environment variable.

Then I received a very helpful comment from a nice man named Paul Tondeur informing me I should point my JAVA_HOME variable at the root folder of my Java installation rather than the java.exe file I’d targeted. After a machine restart I attempted to restart the Red5 server within Eclipse, and was happy to see that this problem had been overcome. Although… I was pretty unhappy to then be met with the following error:

FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
Press any key to continue . . .

After a bit of Googling I came across this thread on the Red5 mailing list. The suggestion most relevant to my problem seemed to be that port 8787 might already be in use causing the launch of the server to fail, and I should check what’s using that port with the TCPView tool from Microsoft. As it turns out that port was being used by the java.exe process.

Following Dominick Accattato’s advice on this thread I opened up Windows Task Manager and ended the java.exe process, then restarted the server from within Eclipse. I then saw this message…

Listening for transport dt_socket at address: 8787

…and nothing else until the process timed out 120 seconds later, when this appears:

Attempting to connect to RMI port: 9999
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.1.31; nested exception is:
    java.net.ConnectException: Connection refused: connect]
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:323)
    at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
    at org.red5.server.Shutdown.main(Shutdown.java:70)
Caused by: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: 192.168.1.31; nested exception is:
    java.net.ConnectException: Connection refused: connect]
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:101)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:185)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1871)
    at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1841)
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:257)
    ... 2 more
Caused by: java.rmi.ConnectException: Connection refused to host: 192.168.1.31; nested exception is:
    java.net.ConnectException: Connection refused: connect
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:97)
    ... 7 more
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:519)
    at java.net.Socket.connect(Socket.java:469)
    at java.net.Socket.<init>(Socket.java:366)
    at java.net.Socket.<init>(Socket.java:180)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
    ... 12 more

Has anyone else experienced this and found a solution? I notice a chap by the name G is already one step ahead of me judging by his last comment. Any luck G?

I had my doubts about using an Open Source project rather than a commercial product like Flash Media Server as I had a feeling it could lead to a world of pain, and unfortunately so far this has more or less been my experience. I think maybe I should’ve taken my own advice and held off until the version 1 release, as undoubtedly there will be issues with a Beta release and you may need a bit of specialist knowledge to steer you through the hazards. Hopefully my posting this will save a few others a few hours here and there in the meantime.

As always, all credit to the Red5 team for making something that is all set to be amazing at the version 1 launch, I just wish I could start playing with it before that point… ;-)


5 Responses to “Red5 Eclipse plug-in: The next issue after the JAVA_HOME issue…”

  1. G Says:

    Hi rob

    I have exactly the same errors within eclipse console after the line “Listening for transport dt_socket at address: 8787″

    What i’ve done :
    * run red5 wrapper (red5.bat) from start / prog / Red5 / start red5
    * run client.mxml from eclipse
    => but i get an unsuccessful connection
    then i’ve followed Matthew’s excellent tutorial http://flashalisious.com/2008/09/30/red5-and-flex-basics-part-1-keep-track-of-users/
    and i used the code of the application.java & red5tutclient.mxml, i get a successful connection !

    give it a try !

    Jérôme

  2. Red5 Eclipse Plug-in v0.2 PC User Feedback: Hello World! (of Pain) « Rob Silverton Says:

    [...] Eclipse Plug-in v0.2 PC User Feedback: Hello World! (of Pain) Thanks to a nice fellow named Jérôme I’ve finally got a Hello World example app running from Eclipse, though not the server [...]

  3. Red5 v0.8, Red5 Plugin v0.2. IT WORKS!!!! :D :D :D « Rob Silverton Says:

    [...] the first few lines of the error again, only to be confronted with 5 results, two of which were my own blog. So it appears I’m back to the point I’d reached before when I gave up on publishing [...]

  4. Leonardo Diaz Says:

    A little late for a comment but maybe someone else could have this problem so here is what I understand:

    - the “Listening for transport dt_socket at address: 8787″ is because the red5 is being executed for remote debug, so what it needs to continue is to get some client to access to that socket (on port 8787) and ask for a some debug info. So one solution is to remove some params from the .bat if that file have this “JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y” since version 0.8 those params are in the red5-debug.bat file, so just configure red5plugin to start the server using red5.bat.

    If you need debug info, then you start the server (using red5-debug.bat) from a console so you get “Listening for transport dt_socket at address: 8787″ then in eclipse you execute your application (it must have been previosly deployed on red5 server) in debug mode (but creating a new debug profile) right click the Aplication.java file, for example, and then “debug as” -> “debug configurations” -> select the “remote java aplication” option with double click -> and there just change the port to 8787 or the apropiate one. then just “apply” and “debug” in your console you’ll se that the red5 server continues starting and you can add breakpoints on your java file and they will work using the eclipse debug perspective as any normal debug session.

  5. roshni Says:

    Thanks Leonardo Diaz for your valuable information. It could help me in using red5 plug in with eclipse.

Leave a Reply