[Red5] Method not found error..

Paulo henrique França Silva phmasters at hotmail.com
Sun Jun 7 08:01:22 PDT 2009


ops, I forget one thing, To call the method you must specify the className.Method in your con.callMethod();
con.callMethod("yourClassName.yourMethod",this, "pankaj")

From: phmasters at hotmail.com
To: red5 at osflash.org
Date: Sun, 7 Jun 2009 14:56:09 +0000
Subject: Re: [Red5] Method not found error..








Helo, to use methods from Red5 server you must register thouse methods.
You must create a Class that contain the method.
In appStart() put the code 
public boolean appStart(IScope app) {
    if (!super.appStart(scope))
        return false;
    
    Object handler = new your.Class.Path();
    app.registerServiceHandler("yourMethodinTheClass", handler);
    return true;
}

 

Date: Sun, 7 Jun 2009 10:46:05 -0400
From: sybersnake at gmail.com
To: red5 at osflash.org
Subject: Re: [Red5] Method not found error..

For starters  con.callMethod("Login",this,"pankaj");

'this' is not a string.  I think your sending red5 an object it doesn't know what to do with and no version of Login is set to accept that data type.

Paul,Don't we normally abstract the service method implementation to a service controller or something?
On Sat, Jun 6, 2009 at 11:42 PM, pankaj anand <pankajanand18 at gmail.com> wrote:


hi can anyone tell ,, what is the problem with following code .. 
I m using OpenLaszlo generated flash code to call the "Login" Method 


usign this cammand

button text="start" x="100" y="100">

                <handler name="onclick">
                        con.callMethod("Login",this,"pankaj");
                </handler>
        </button>

where the "con" is the  rtmpconnection object in the openlaszlo..



it gives the follwoing error :

[ERROR] [pool-4-thread-16] org.red5.server.service.ServiceInvoker - Method Login with parameters [pankaj] not found in org.collabration.connection.ScopeApplicationAdapter at 8917a2





package org.collabration.connection;


import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Set;

import org.collabration.Client.ClientManager;


import org.collabration.Client.RoomClient;
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.adapter.IApplication;
import org.red5.server.adapter.MultiThreadedApplicationAdapter;
import org.red5.logging.Red5LoggerFactory;




import org.red5.server.api.IClient;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
import org.red5.server.api.Red5;
import org.red5.server.api.service.IPendingServiceCall;


import org.red5.server.api.service.IPendingServiceCallback;
import org.red5.server.api.service.IServiceCapableConnection;
import org.red5.server.api.stream.IBroadcastStream;
import org.red5.server.api.stream.IStreamAwareScopeHandler;


import org.red5.server.stream.ClientBroadcastStream;
import org.slf4j.Logger;


public class ScopeApplicationAdapter extends ApplicationAdapter implements
IPendingServiceCallback, IStreamAwareScopeHandler  {


    private static final Logger log =
        Red5LoggerFactory.getLogger(ScopeApplicationAdapter.class, "collaborationtool");
    
    private static ScopeApplicationAdapter instance=null;
    /*


     * Function to get the ingstance of the class , which is singelton class 
     */
    public static ScopeApplicationAdapter getInstance()
    {
        if(instance == null)
            instance=new ScopeApplicationAdapter();


        return instance ;
    }
    
    /*
     * (non-Javadoc)
     * @see org.red5.server.adapter.MultiThreadedApplicationAdapter#appStart(org.red5.server.api.IScope)
     * 
     * function which is called when the application is started at the server 


     */
    
    @Override
    public boolean appStart(IScope scope) {
    log.debug("Application started with the scope ");
    instance=this ;
        return true ;
        
    }
    


     
        
    /*
     * (non-Javadoc)
     * @see org.red5.server.adapter.MultiThreadedApplicationAdapter#roomJoin(org.red5.server.api.IClient, org.red5.server.api.IScope)
     * 
     * this metthod gets called when a client connect to the server using rtmp protocol


     */
    @Override 
    public boolean roomJoin(IClient client,IScope room)
    {
        try
        {
            log.debug("New Connection ");
            IConnection con=Red5.getConnectionLocal();


            log.debug("From "+con.getRemoteAddress());
            
            RoomClient rcm=ClientManager.getInstance().addClientListItem(client.getId(), null, con.getRemoteAddress());
            


                if(rcm == null)
                {
                     log.debug("Client Couldn't be added");
                }
        }catch(Exception e)
        {
            log.error("Error at roomJoin"+ e);


        }
        return true;
    }
    
    /*
     * (non-Javadoc)
     * @see org.red5.server.adapter.MultiThreadedApplicationAdapter#roomLeave(org.red5.server.api.IClient, org.red5.server.api.IScope)


     * 
     * method gets called when the clients disconnect from the scope or exits from the server
     */
        
    @Override 
    public void roomLeave(IClient client, IScope room) {
        try {


            
            log.debug("roomLeave " + client.getId() + " "+ room.getClients().size() + " " + room.getContextPath() + " "+ room.getName());
            
                    


            if(ClientManager.getInstance().removeClient(client.getId())) {
                log.debug("client removed from the list");
            }
            else {
                log.debug("client couldn't be removed from the list");


            }
                    
            
        } catch (Exception err){
            log.error("[roomLeave]",err);
        }        
    }
    
    /*
     * Function to login to the application 


     * @param villageName
     *  
     */
    public String Login(String  villageName) {
                try{
                
            
            IConnection current=Red5.getConnectionLocal();


            IClient client=current.getClient();
            
            RoomClient roomClient=ClientManager.getInstance().getRoomClientById(client.getId());
            roomClient.setVillageName((String)villageName);


            if(((String) villageName).equalsIgnoreCase("bahenji"))
                            roomClient.setBahenji(true);
            log.info("Cliend updated for the values "+ roomClient.getVillageName()+" " + roomClient.isBahenji());


            
            ClientManager.getInstance().updateClient(client.getId(), roomClient);
            log.debug("Cliend updated for the values "+ roomClient.getVillageName()+" " + roomClient.isBahenji());


            }catch(Exception e) {
                    log.debug("Exception occured during updating " + e);
                }
            
            return "Got the mssg";
            }


    
    public void getSign()
    {
        log.debug("Got the msg");
    }
     
    /*
     * Method to get the list of all the connected clients from the server
     * it returns different type of list depends on the variable , if the moderator ( bahenji) 


     * is logged in to the system, a complete list of the clients will be provided in that case
     * 
     *  @param villageName
     *  @param isBahenji
     * 
     */
    public LinkedList<RoomClient> getClientList(String villageName,boolean isBahenji){


    
        log.debug("getClientList Called with village name "+ villageName+" isBahenji "+isBahenji);
            if(!isBahenji)
            {
                return getDetailsOfBahenji();


            }
            
    LinkedList<RoomClient> roomClientList=new LinkedList<RoomClient>();
    HashMap<String,RoomClient> clientList=ClientManager.getInstance().getClientList();
    


        Set<String> keys= clientList.keySet();
        Iterator<String> itr=keys.iterator();
        
        while(itr.hasNext())
        {
            RoomClient roomClient=clientList.get(itr.next());


            if(!roomClient.isBahenji())
                    roomClientList.add(roomClient);            
        }
        
        return roomClientList;
    } // End of function 
    

/*
 * function to get the details of the client which is used by the bahenji 


 */
    
    public LinkedList<RoomClient> getDetailsOfBahenji() {
        LinkedList<RoomClient> bahenji= ClientManager.getInstance().getBahenJiDetails();
        
        return bahenji;
    }


    
    
    public void Logout(String villageName,boolean isBahenJi) {
        try {
        IConnection conn=Red5.getConnectionLocal();
        IScope scope=conn.getScope();
        IClient currentClient=conn.getClient();


        Iterator<Set<IConnection>> connectionPool = scope.getConnections().iterator();
        
            while(connectionPool.hasNext()) {
                    Set<IConnection> connectionList= connectionPool.next();


                    Iterator<IConnection> currentList=connectionList.iterator();
                    
                        while(currentList.hasNext()){
                            IConnection con=currentList.next();


                            IServiceCapableConnection service = (IServiceCapableConnection) con;
                            service.invoke("logOutRemoteUser", new Object[] { villageName });

                        }


            }
            ClientManager.getInstance().removeClient(villageName)    ;
            roomLeave(currentClient,scope);
            
        }catch(Exception e )
        {
            log.error("Error while logged out exception is " + e);


        }
    }

    @Override
    public void resultReceived(IPendingServiceCall arg0) {
        // TODO Auto-generated method stub
        
    }
    
    
    
    
    
    

            

            
    }




    

    


_______________________________________________

Red5 mailing list

Red5 at osflash.org

http://osflash.org/mailman/listinfo/red5_osflash.org




Instale o novo Internet Explorer 8 otimizado para o MSN. Download aqui
_________________________________________________________________
Descubra todas as novidades do novo Internet Explorer 8
http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/red5_osflash.org/attachments/20090607/2b542bc7/attachment-0001.html>


More information about the Red5 mailing list