[Red5] Method not found error..
cem sonmez
cemosonmez at gmail.com
Sat Dec 12 13:27:02 PST 2009
the previous exception is thrown bec. of the null IConnection. So i moved
the lines
userService= new UserService();
appScope.registerServiceHandler("sendUsername",userService);
appScope.registerServiceHandler("deleteUsername",userService);
to the connect method in Application.java.
But still i m getting the first message
[WARN] [NioProcessor-2] org.red5.server.service.ServiceInvoker - Service not
found: userService.
Any idea ?
Regards.
2009/12/12 cem sonmez <cemosonmez at gmail.com>
> bean id is "userservice". Now i m getting another during starting red5 with
> creating the bean :
>
> org.springframework.beans.BeanInstantiationException: Could not instantiate
> bean class [org.red5.core.UserService]: Constructor threw exception; nested
> exception is java.lang.NullPointerException
>
> UserService.java
> ______________
> package org.red5.core;
>
> import java.util.ArrayList;
> import java.util.Iterator;
>
> import org.red5.server.adapter.MultiThreadedApplicationAdapter;
> import org.red5.server.api.IConnection;
> import org.red5.server.api.IScope;
> import org.red5.server.api.Red5;
> import org.red5.server.api.so.ISharedObject
>
> public class UserService extends MultiThreadedApplicationAdapter {
>
>
> ArrayList<String> usernameArraylist;
> IScope appScope;
> public UserService() {
> /*Arraylist to store the connected client's usernames's*/
> usernameArraylist= new ArrayList<String>();
> IConnection conn= Red5.getConnectionLocal();
> appScope= conn.getScope();
> }
>
>
> /*sends the connected usernames to the client method*/
> public void sendUsername(String param) {
> System.out.println("send username method ");
> usernameArraylist.add(param);
> ISharedObject so = getSharedObject(appScope, "chat");
> so.sendMessage("receiveUsername",usernameArraylist);
> Iterator<String> iterator= usernameArraylist.iterator();
>
> while( iterator. hasNext() ) {
> System.out.println("param : "+iterator.next());
> }
> }
>
>
> and the bean declaration in red5-web.xml
> __________________________________
>
> <bean id="web.userservice"
> class="org.red5.core.UserService"
> singleton="true" />
>
> and i m calling the method sendUsername from the client side with :
>
> _conn.call("userService.sendUsername",responder,username); //userService is
> the name of UserService object in Application .java.
>
> I have no idea about where i m am doing the mistake. I m new to Red5,
> couldnT find the solution for hours, waiting for your replies. Thanks.
>
> 2009/12/12 Richard Alam <ritzalam at gmail.com>
>
> your bean id id all lowercase (userservice).
>>
>> On Sat, Dec 12, 2009 at 2:55 PM, cem sonmez <cemosonmez at gmail.com> wrote:
>> >
>> > hi
>> > i m having the same problem, but couldnT work out the problem.
>> >
>> > the class name is "UserService" which has the method that is going to
>> called
>> > by the client. I have added these line to the red5-web.xml
>> >
>> > <bean id="web.userservice"
>> > class="org.red5.core.UserService"
>> > singleton="true" />
>> > then i added these lines to the appStart(IScope scope) method in
>> Application
>> > class
>> >
>> > UserService userService= new UserService();
>> > scope.registerServiceHandler("sendUsername",userService); //sendUsername
>> > method is in the UserService.java
>> > scope.registerServiceHandler("deleteUsername",userService);
>> //deleteUsername
>> > method is in the UserService.java
>> >
>> > When i try to call the relevant method from the client like :
>> > _conn.call("userService.sendUsername",responder,username);
>> >
>> > message in the console is :
>> > [WARN] [NioProcessor-1] org.red5.server.service.ServiceInvoker - Service
>> not
>> > found: userService
>> >
>> > can anyone have help about this issue?
>> >
>> > Kind regards
>> >
>> > 2009/6/8 Paulo henrique França Silva <phmasters at hotmail.com>
>> >>
>> >> I guess yes, but try this
>> >>
>> http://www.hernandezgomez.com/index.php/calling-java-methods-from-flex-using-mxremoteobject-and-red5/
>> >>
>> >> Best Regards
>> >> Paulo Henrique / Brazil
>> >>
>> >> ________________________________
>> >> Date: Sun, 7 Jun 2009 14:17:23 -0400
>> >> From: sybersnake at gmail.com
>> >> To: red5 at osflash.org
>> >> Subject: Re: [Red5] Method not found error..
>> >>
>> >> Is this still the valid way of defining the service handler?
>> >> <bean id="flexMessaging.service"
>> >> class="org.red5.server.net.remoting.FlexMessagingService"
>> >> singleton="true">
>> >> <property name="serviceInvoker" ref="global.serviceInvoker" />
>> >> <!-- add an entry for all possible "destination" attributes of your
>> >> mx:RemoteObject sources -->
>> >> <property name="endpoints">
>> >> <map>
>> >> <entry key="Red5">
>> >> <!-- object that handles requests sent to this endpoint -->
>> >> <ref bean="something.service" />
>> >> </entry>
>> >> </map>
>> >> </property>
>> >> </bean>
>> >> 2009/6/7 Paulo henrique França Silva <phmasters at hotmail.com>
>> >>
>> >> 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
>> >> ________________________________
>> >> Conheça os novos produtos Windows Live. Clique aqui!
>> >> _______________________________________________
>> >> Red5 mailing list
>> >> Red5 at osflash.org
>> >> http://osflash.org/mailman/listinfo/red5_osflash.org
>> >>
>> >>
>> >>
>> >> ________________________________
>> >> Novo Internet Explorer 8: mais rápido e muito mais seguro. Baixe agora,
>> é
>> >> grátis!
>> >> _______________________________________________
>> >> Red5 mailing list
>> >> Red5 at osflash.org
>> >> http://osflash.org/mailman/listinfo/red5_osflash.org
>> >>
>> >
>> >
>> >
>> > --
>> > Cem SONMEZ
>> >
>> > _______________________________________________
>> > Red5 mailing list
>> > Red5 at osflash.org
>> > http://osflash.org/mailman/listinfo/red5_osflash.org
>> >
>> >
>>
>>
>>
>> --
>> ---
>> BigBlueButton
>> http://www.bigbluebutton.org
>> http://code.google.com/p/bigbluebutton
>>
>> _______________________________________________
>> Red5 mailing list
>> Red5 at osflash.org
>> http://osflash.org/mailman/listinfo/red5_osflash.org
>>
>
>
>
> --
> Cem SONMEZ
>
--
Cem SONMEZ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/red5_osflash.org/attachments/20091212/d234f113/attachment-0001.html>
More information about the Red5
mailing list