cannot access net.sf.json.JSONObject (sendResponse)

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

paintbrush
Posts: 19
Joined: 06 Mar 2008, 07:12

cannot access net.sf.json.JSONObject (sendResponse)

Postby paintbrush » 24 Mar 2008, 06:05

Hey all,

I'm trying to write a custom login script using example PixelGame.java as a reference (along with some forum posts and documentation help), and I've gone pretty far only to hit a snag trying to call sendResponse() that sends an ActionscriptObject.

The internal event handler looks like this:

Code: Select all

public void handleInternalEvent(InternalEventObject e){
   
      String eventName = e.getEventName();
      ActionscriptObject res = new ActionscriptObject();
      
      if(eventName.equals("loginRequest")){
         boolean okay = false;
         String username = e.getParam("nick");
         String password = e.getParam("pass");
         SocketChannel chan = (SocketChannel) e.getObject("chan");
         System.out.println("Attempting to login combo:"+username+" "+password);
         try{
            User newUser = helper.canLogin(username,password,chan,currZone.getName());
            res.put("_cmd","logOK");
            res.put("id", String.valueOf(newUser.getUserId()));
            res.put("name", newUser.getName());
            okay = true;
         }catch(LoginException exception){
            System.out.println("something bad happened");
         }
         LinkedList ll = new LinkedList();
         ll.add(chan);
         sendResponse(res,-1,null,ll);
         if(okay)
            helper.sendRoomList(chan);
      }
   }


the error goes:

Code: Select all

MyExtension.java:64: cannot access net.sf.json.JSONObject
class file for net.sf.json.JSONObject not found
sendResponse(res,-1,null,ll);
^


I'm writing my class in Notepad and compiling using commandline. My compile statement is as follows:

Code: Select all

javac -classpath "../../lib/jysfs.jar;../../lib/json.jar;../../json-lib-2.1-jdk15.jar" MyExtension.java


I'm using SFS 1.6.1, so I did include all the required JARs specified by the docs... I'm also somewhat perplexed at why the compiler's looking for JSONObject when I'm passing sendResponse() an ActionscriptObject...

Anyone able to push me in the right direction? Thanks for any insights into this problem! :)

-Jay
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 25 Mar 2008, 07:17

wrong classpath:
"../../lib/jysfs.jar;../../lib/json.jar;../../json-lib-2.1-jdk15.jar"

the last one should be:
../../lib/json-lib-2.1-jdk15.jar"

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 21 guests