[Red5] Method not found error..
Jonathan Valliere
sybersnake at gmail.com
Sun Jun 7 07:46:05 PDT 2009
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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/red5_osflash.org/attachments/20090607/76e8e137/attachment-0001.html>
More information about the Red5
mailing list