[Red5] ServiceInvoker.invoke(IServiceCall, Object) line: 238 => InvocationTargetException exception

ashoksahu ashoksahu at gmail.com
Sun Dec 14 10:55:43 PST 2008


i have searched the forums, but did not find a similar issue. i am hitting a
InvocationTargetException, in a call to ServiceInvoker.invoke. I am using
Carls' sample code and developing my application. below are my two methods
for recording audio. Everything works fine the first time, i run the
application. but when i try to record a second audio stream, on the same
connection it fails with the above error.

I am new to Red5 and hence maybe doing some trivial mistake somewhere. any
help will go a long way in completing my Thesis. I am using red57.0.

the server errors out in the following line:
		
ClientBroadcastStream stream = (ClientBroadcastStream)
app.getBroadcastStream(
				conn.getScope(), "hostStream");

on my client end, i am starting a new stream object every time i want to
record a new audio stream, on the same connection. this the publish function
on the client end.

	private function publish():void {
		
		if(connection.connected)
		{
			trace("inside publish");
			ns = new NetStream(connection);
			//ns.attachCamera(cam, 20);
                        ns.attachAudio(Microphone.getMicrophone());
                        ns.publish("hostStream", "live");
                        ns.addEventListener(NetStatusEvent.NET_STATUS,
onPublish);
		}
	}
======================================
the below is from the server code:

public void recordShow(IConnection conn) {
		log.info("Recording show for: " + conn.getScope().getContextPath());
		String streamName = String.valueOf(System.currentTimeMillis());
		log.info("connection status " + conn.isConnected());
		// Get a reference to the current broadcast stream.
		String sessionID = conn.getSessionId();
		log.info("sessionId is " + sessionID);
		ClientBroadcastStream stream = (ClientBroadcastStream)
app.getBroadcastStream(
				conn.getScope(), "hostStream");
		try {
			// Save the stream to disk.
			stream.saveAs(streamName, false);
		} catch (Exception e) {
			log.error("Error while saving stream: " + streamName, e);
		}
	}

	/**
	 * Stops recording the publishing stream for the specified
	 * <code>IConnection</code>.
	 *
	 * @param conn
	 */
	public void stopRecordingShow(IConnection conn) {
		log.info("Stop recording show for: " + conn.getScope().getContextPath());
		// Get a reference to the current broadcast stream.
		ClientBroadcastStream stream = (ClientBroadcastStream)
app.getBroadcastStream(
				conn.getScope(), "hostStream");
		// Stop recording.
		stream.stopRecording();
		
		
		IClientBroadcastStreamStatistics IClientBroadcastStreamStatistics =
stream.getStatistics();

		
		log.info("stream details " +
IClientBroadcastStreamStatistics.getSaveFilename() + " " +
		IClientBroadcastStreamStatistics.getBytesReceived());

	}

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

The backtrace from the crash is 

==========================================================
2008-12-14 10:07:45,875 [pool-4-thread-4] ERROR
o.r.server.service.ServiceInvoker - Error executing call: Service:
streamManager Method: recordShow Num Params: 0
2008-12-14 10:07:46,187 [pool-4-thread-4] ERROR
o.r.server.service.ServiceInvoker - Service invocation error
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.red5.server.service.ServiceInvoker.invoke(ServiceInvoker.java:217)
	at org.red5.server.service.ServiceInvoker.invoke(ServiceInvoker.java:123)
	at org.red5.server.net.rtmp.RTMPHandler.invokeCall(RTMPHandler.java:157)
	at org.red5.server.net.rtmp.RTMPHandler.onInvoke(RTMPHandler.java:409)
	at
org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:143)
	at
org.red5.server.net.rtmp.RTMPMinaIoHandler.messageReceived(RTMPMinaIoHandler.java:119)
	at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570)
	at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
	at
org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
	at
org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
	at
org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
	at
org.red5.server.adapter.MultiThreadedApplicationAdapter.getBroadcastStream(MultiThreadedApplicationAdapter.java:779)
	at org.red5.core.StreamManager.recordShow(StreamManager.java:33)
	... 19 common frames omitted
-- 
View this message in context: http://www.nabble.com/ServiceInvoker.invoke%28IServiceCall%2C-Object%29-line%3A-238-%3D%3E-InvocationTargetException-exception-tp21000588p21000588.html
Sent from the Red5 - English mailing list archive at Nabble.com.




More information about the Red5 mailing list