Illegal access for handler class

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

aakash447
Posts: 14
Joined: 07 Jan 2020, 06:21

Illegal access for handler class

Postby aakash447 » 10 Jan 2020, 14:11

Code: Select all

package roomcreatepzextension;

import com.smartfoxserver.v2.core.SFSEventType;
import com.smartfoxserver.v2.extensions.SFSExtension;

public class RoomCreatePzExtension extends SFSExtension {

    @Override
    public void init() {
              trace("initialization method started...-----------------------------------------");
              
        addEventHandler(SFSEventType.SERVER_READY,RoomCreationHandler.class);
       
              trace("initialization method started 2222...-----------------------------------------");
    }
   
}



Code: Select all


package roomcreatepzextension;

import com.smartfoxserver.v2.api.CreateRoomSettings;
import com.smartfoxserver.v2.core.ISFSEvent;
import com.smartfoxserver.v2.entities.Room;
import com.smartfoxserver.v2.exceptions.SFSCreateRoomException;
import com.smartfoxserver.v2.exceptions.SFSException;
import com.smartfoxserver.v2.extensions.BaseServerEventHandler;


class RoomCreationHandler extends BaseServerEventHandler {
       
    @Override
    public void handleServerEvent(ISFSEvent isfse) throws SFSException {
        trace("in the handle server event ----------------------------------------------------");
       CreateRoomSettings cfg = new CreateRoomSettings();
 
        cfg.setName("Myroom876");
        cfg.setMaxUsers(50);
        cfg.setDynamic(true);
            trace("above the try method in RoomCreationHandler--------------------------------------");
        try
        {
            Room myNewRoom = getApi().createRoom( getParentExtension().getParentZone(), cfg, null);
                trace("Room Created MyRoom876--------------------------------------------------");
        }
        catch (SFSCreateRoomException ex)
        {
                  trace(ex);
        }
    }
}



errors:
>> Zone: secondZone
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

19:26:03,758 INFO [main] Extensions - {createRoomPz}: initialization method started...-----------------------------------------
19:26:03,758 INFO [main] Extensions - {createRoomPz}: initialization method started 2222...-----------------------------------------
19:26:03,759 INFO [main] managers.SFSZoneManager -

19:26:03,819 WARN [SFSWorker:Ext:2] Extensions - {createRoomPz}: Illegal access for handler class: java.lang.IllegalAccessException: Class com.smartfoxserver.v2.extensions.SFSHandlerFactory can not access a member of class roomcreatepzextension.RoomCreationHandler with modifiers ""

Can someone trace why the error is coming .
User avatar
Lapo
Site Admin
Posts: 21286
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Illegal access for handler class

Postby Lapo » 10 Jan 2020, 15:39

Hi,
I think the problem is that the class RoomCreationHandler is not declared as public.
Add a public modifier to it and redeploy. It should fix the problem.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
aakash447
Posts: 14
Joined: 07 Jan 2020, 06:21

Re: Illegal access for handler class

Postby aakash447 » 13 Jan 2020, 04:19

Thank you sir it's working now by applying public

Return to “SFS2X Questions”

Who is online

Users browsing this forum: DavinVicy, DerikFent, Google [Bot], JerodSa and 6 guests