Results 1 to 9 of 9

Thread: Flex / Wowza 3.1.2 RMI, missing method

  1. #1
    Join Date
    Oct 2012
    Posts
    5

    Default Flex / Wowza 3.1.2 RMI, missing method

    Howdy!

    I am on Windows 7, environment is:

    INFO server server-start Wowza Media Server 3 Trial Edition (Expires: xxx) 3.1.2 build1624 -
    INFO server comment - Hardware Available Processors: 2
    INFO server comment - Hardware Physical Memory: 794MB/3957MB
    INFO server comment - Hardware Swap Space: 2536MB/4095MB
    INFO server comment - Max File Descriptor Count: Unlimited
    INFO server comment - OS Name: Windows 7
    INFO server comment - OS Version: 6.1
    INFO server comment - OS Architecture: x86
    INFO server comment - OS CPU: pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
    INFO server comment - Java Name: Java HotSpot(TM) Client VM
    INFO server comment - Java Vendor: Sun Microsystems Inc.
    INFO server comment - Java Version: 1.6.0_31
    INFO server comment - Java VM Version: 20.6-b01
    I have simply extended the provided videochat example, by adding this in the Application.xml:

    <Module>
    	<Name>yschat</Name>
    	<Description>YSChat</Description>
    	<Class>com.wowza.wms.example.module.YSChat</Class>
    </Module>
    At the end of the <Modules> section. So far, so good, but - nope: the YSChat module, while it sits in the proper [install-dirb]/lib folder, is just not loaded.

    I am beginning to think that the problem is the way I reference it. Any help about it would be greatly appreciated, in advance thank you.
    Last edited by Argo Navis; 10-22-2012 at 06:14 PM.

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Is that the class path of a custom module you are developing? If so, is the .jar file being written to the current Wowza install location /lib folder, or perhaps an old location?

    Or did you get it from somewhere else? If so, did you copy the .jar file to /lib, and did you restart Wowza?

    Richard

  3. #3
    Join Date
    Oct 2012
    Posts
    5

    Default

    It's a custom module I am developing.

    The location is correct, and yes, thank you Richard, I have restarted the Wowza server - the module is there. But it doesn't load at runtime.

    My problem I guess resides with the class path.
    However, I have tried all possible variants of the class path:

    com.wowza.wms.example.module.ys.YSChat
    com.wowza.wms.module.YSChat
    com.wowza.wms.module.ys.YSChat
    ys.YSChat
    To no avail. I would expect to see log entries for each of the events I listen to, but - nope. Nothing.


    Hereafter the source code of the module, it's basic so far:
    package ys;
    
    import com.wowza.wms.application.*;
    import com.wowza.wms.amf.*;
    import com.wowza.wms.client.*;
    import com.wowza.wms.module.*;
    import com.wowza.wms.request.*;
    import com.wowza.wms.module.*;
    import com.wowza.wms.client.*;
    import com.wowza.wms.application.*;
    import com.wowza.wms.sharedobject.*;
    import com.wowza.wms.stream.IMediaStream;
    import com.wowza.wms.stream.IMediaStreamActionNotify;
    
    public class YSChat extends ModuleBase {
    	static public final String CONNECTEDUSERS_SONAME = "connectedUsersSO";
    	static public final String STREAMS_SONAME = "streamsSO";
    
    	public void onAppStart(IApplicationInstance appInstance) {
    		String fullname = appInstance.getApplication().getName() + "/"
    				+ appInstance.getName();
    		getLogger().info("onAppStart: " + fullname);
    		
    		// Create a shared object to keep track of the connected users
    		ISharedObjects sharedObjects = appInstance.getSharedObjects(false);
    		ISharedObject connectedUsersSO = new SharedObject(CONNECTEDUSERS_SONAME);
    		sharedObjects.put(CONNECTEDUSERS_SONAME, connectedUsersSO);
    		
    		connectedUsersSO.lock();
    		try
    		{
    			connectedUsersSO.acquire();
    		}
    		catch (Exception e)
    		{
    			
    		}
    		finally
    		{
    			connectedUsersSO.unlock();
    		}
    		getLogger().info("onAppStart: create shared object: "+CONNECTEDUSERS_SONAME);
    		
    		ISharedObject streamsSO = new SharedObject(STREAMS_SONAME);
    		sharedObjects.put(STREAMS_SONAME, streamsSO);
    		
    		streamsSO.lock();
    		try
    		{
    			streamsSO.acquire();
    		}
    		catch (Exception e)
    		{
    			
    		}
    		finally
    		{
    			streamsSO.unlock();
    		}
    		getLogger().info("onAppStart: create shared object: "+STREAMS_SONAME);
    				
    	}
    
    	public void onAppStop(IApplicationInstance appInstance) {
    		String fullname = appInstance.getApplication().getName() + "/"
    				+ appInstance.getName();
    		getLogger().info("onAppStop: " + fullname);
    		// release the shared object when the application stops
    		ISharedObjects sharedObjects = appInstance.getSharedObjects(false);
    		ISharedObject connectedUsersSO = sharedObjects.get(CONNECTEDUSERS_SONAME);
    		if (connectedUsersSO != null)
    		{
    			getLogger().info("onAppStart: release shared object: "+CONNECTEDUSERS_SONAME);
    			connectedUsersSO.lock();
    			try
    			{
    				connectedUsersSO.release();
    			}
    			catch (Exception e)
    			{
    				
    			}
    			finally
    			{
    				connectedUsersSO.unlock();
    			}
    		}
    		ISharedObject streamsSO = sharedObjects.get(STREAMS_SONAME);
    		if (streamsSO != null)
    		{
    			getLogger().info("onAppStart: release shared object: "+STREAMS_SONAME);
    			streamsSO.lock();
    			try
    			{
    				streamsSO.release();
    			}
    			catch (Exception e)
    			{
    				
    			}
    			finally
    			{
    				streamsSO.unlock();
    			}
    		}
    
    	}
    
    	public void onConnect(IClient client, RequestFunction function,
    			AMFDataList params) {
    		getLogger().info("onConnect: " + client.getClientId());
    	}
    
    	public void onConnectAccept(IClient client)
    	{
    		// when a client connection is accepted add a property to the shared object
    		// that notifies all connections of new client
    		getLogger().info("onConnectAccept: "+client.getClientId());
    		ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
    		ISharedObject connectedUsersSO = sharedObjects.get(CONNECTEDUSERS_SONAME);
    		if (connectedUsersSO != null)
    		{
    			connectedUsersSO.lock();
    			try
    			{
    				getLogger().info("onConnectAccept: add property: "+client.getClientId());
    				String propName = "c"+client.getClientId();
    				connectedUsersSO.setProperty(propName, "connected");
    			}
    			catch (Exception e)
    			{
    				
    			}
    			finally
    			{
    				connectedUsersSO.unlock();
    			}
    		}
    	}
    
    	public void onDisconnect(IClient client)
    	{
    		// When the client is disconnected remove the property from the shared object
    		getLogger().info("onDisconnect: "+client.getClientId());
    		ISharedObjects sharedObjects = getAppInstance(client).getSharedObjects(false);
    		ISharedObject connectedUsersSO = sharedObjects.get(CONNECTEDUSERS_SONAME);
    		if (connectedUsersSO != null)
    		{
    			connectedUsersSO.lock();
    			try
    			{
    				getLogger().info("onDisconnect: remove property: "+client.getClientId());
    				String propName = "c"+client.getClientId();
    				connectedUsersSO.deleteSlot(propName);
    				connectedUsersSO.purge(connectedUsersSO.getVersion()-200);
    			}
    			catch (Exception e)
    			{
    				
    			}
    			finally
    			{
    				connectedUsersSO.unlock();
    			}
    		}
    	}
    
    	public void relay(IClient client, RequestFunction function, AMFDataList params)
    	{
    		// make sure we create the shared object server side so we can initialize it properly
    		//String soName = params.getString(PARAM1);
    		getLogger().info("Relay method called");
    		//ISharedObject textchat_so = getChatSharedObject(soName, client.getAppInstance());
    		
    		sendResult(client, params, "");
    	}
    
    	public void onConnectReject(IClient client) {
    		getLogger().info("onConnectReject: " + client.getClientId());
    	}
    
    	public void onStreamCreate(IMediaStream stream)
    	{
    		class StreamListener implements IMediaStreamActionNotify
    		{
    			public void onPlay(IMediaStream stream, String streamName, double playStart, double playLen, int playReset)
    			{
    				getLogger().info("onPlay");
    			}
    			
    			public void onUnPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
    			{
    				//removeStreamSOSlot(stream);
    				getLogger().info("onUnPublish");
    				
    				ISharedObjects sharedObjects = stream.getClient().getAppInstance().getSharedObjects(false);
    				ISharedObject streamsSO = sharedObjects.get(STREAMS_SONAME);
    				if (streamsSO != null)
    				{
    					streamsSO.lock();
    					try
    					{
    						getLogger().info("onStop: remove stream property: "+ stream);
    						
    						streamsSO.deleteSlot("c"+stream.getClientId());
    						streamsSO.purge(streamsSO.getVersion()-200);
    					}
    					catch (Exception e)
    					{
    						
    					}
    					finally
    					{
    						streamsSO.unlock();
    					}
    				}
    			}
    
    			public  void onPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
    			{
    				// addStreamSOSlot(stream, streamName);
    				getLogger().info("onPublish");
    				
    				ISharedObjects sharedObjects = stream.getClient().getAppInstance().getSharedObjects(false);
    				ISharedObject streamsSO = sharedObjects.get(STREAMS_SONAME);
    				if (streamsSO != null)
    				{
    					streamsSO.lock();
    					try
    					{
    						getLogger().info("onPublish: add stream: "+ streamName);						
    						streamsSO.setProperty("c" + stream.getClientId(), streamName);
    					}
    					catch (Exception e)
    					{
    						
    					}
    					finally
    					{
    						streamsSO.unlock();
    					}
    				
    			}
    			}
    
    			public void onPause(IMediaStream stream, boolean isPause, double location)
    			{
    				getLogger().info("onPause");
    			}
    
    			public void onSeek(IMediaStream stream, double location)
    			{
    				getLogger().info("onSeek");
    			}
    
    			public void onStop(IMediaStream stream)
    			{
    				getLogger().info("onStop");				
    			}
    		}
    
    		stream.addClientListener(new StreamListener());
    	}
    
    }

  4. #4
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    For that Module the class should be "ys.YSChat": the package + name of the class.

    Add a more specific getLogger statement, then look in the access log for it

    getLogger().info("YSChat Started");
    Make sure you connect to the application that you have implemented this module so that onAppStart runs.

    Richard

  5. #5
    Join Date
    Oct 2012
    Posts
    5

    Default

    Ok, again thank you very much Richard.

    Did exactly that, but I am out of luck. The connection to rtmp://localhost/videochat is successfully established, but here is what happens when the RMI fails:

    Wowza access logs (from the Wowza IDE console):
    INFO server comment - _defaultVHost_ threads[h/t]:120/80 home:C:/Program Files (x86)/Wowza Media Systems/Wowza Media Server 3.1.2
    INFO vhost comment _defaultVHost_ Bind attempt ([any]:1935:4)
    INFO vhost comment _defaultVHost_ Bind successful ([any]:1935)
    INFO vhost comment _defaultVHost_ Bind attempt ([any]:8086:1)
    INFO vhost comment _defaultVHost_ Bind successful ([any]:8086)
    INFO server comment - Server.startShutdownHook: Start server shutdown hook
    INFO server comment - Wowza Media Server is started!
    INFO application app-start _definst_ videochat/_definst_
    INFO session connect-pending 127.0.0.1 -
    INFO session connect 127.0.0.1 -
    WARN server comment - Missing function: relay
    At that point, the client (Flex) on a netConnection.call("relay", {params}), crashes and reports:
    [Fault] exception, information=ArgumentError: Error #2129: Connection to directConnections failed.
    And the Application.xml is basically the default Application.xml for the videochat example (bundled with Wowza), with the Modules section adjusted this way:
    		<Modules>
    			<Module>
    				<Name>base</Name>
    				<Description>Base</Description>
    				<Class>com.wowza.wms.module.ModuleCore</Class>
    			</Module>
    			<Module>
    				<Name>properties</Name>
    				<Description>Properties</Description>
    				<Class>com.wowza.wms.module.ModuleProperties</Class>
    			</Module>
    			<Module>
    				<Name>logging</Name>
    				<Description>Client Logging</Description>
    				<Class>com.wowza.wms.module.ModuleClientLogging</Class>
    			</Module>
    			<Module>
    				<Name>flvplayback</Name>
    				<Description>FLVPlayback</Description>
    				<Class>com.wowza.wms.module.ModuleFLVPlayback</Class>
    			</Module>
    			<Module>
    				<Name>yschat</Name>
    				<Description>YSChat</Description>
    				<Class>ys.YSChat</Class>
    			</Module> 
    		</Modules>
    The only thing I see is that I have parallel jdk installations, due to my running a 64 bits system (for the sake of testing classes I compile against multiple versions of Java).

    Wowza runs on:
    INFO server comment - Java Vendor: Sun Microsystems Inc.
    INFO server comment - Java Version: 1.6.0_31
    INFO server comment - Java VM Version: 20.6-b01
    INFO server comment - Java Spec Version: 1.6
    INFO server comment - Java Home: C:\Program Files (x86)\Java\jre6
    And the Wowza IDE is set to compile against version 1.6 of Java.

  6. #6
    Join Date
    Oct 2012
    Posts
    5

    Default

    Ok, just tried something wild: I changed the default Wowza Application.xml (in [install-dir]/conf), restarted the server, and now I get:

    INFO server comment - onConnectAccept: 74217306
    INFO server comment - onConnectAccept: add property: 74217306
    INFO server comment - Relay method called
    So: for some reason, the configuration of the default videochat app is not properly loaded - seems there is an issue with that example in the default Wowza bundle.
    For now the workaround lets me develop (happy!) but it would be great if can find out the why, and get it out of the way.

    In advance thank you for your help.

  7. #7
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Is your Application.xml is in the wrong location? This is where it should be:

    [wowza-install-dir]/conf/videochat/Application.xml

    Richard

  8. #8
    Join Date
    Oct 2012
    Posts
    5

    Default

    Omg yes That was the culprit.

    Kinldy note that it was created in an "/applications" folder because of this line in the "install.bat" supplied with the example:

    IF NOT EXIST "%WMSAPP_HOME%\applications\videochat" mkdir "%WMSAPP_HOME%\applications\videochat"
    Anyway, THANK YOU! Bug fixed, and your help is greatly appreciated.

  9. #9
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    That's great, glad it's working. Thanks for the update!

    Richard

Similar Threads

  1. Authentication method is missing
    By catdude in forum Live Streaming and Encoder Discussion
    Replies: 3
    Last Post: 02-13-2012, 06:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •