Resolve] compile error basic Java client

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

Nambew
Posts: 12
Joined: 29 Jan 2009, 20:45

Resolve] compile error basic Java client

Postby Nambew » 11 Jan 2012, 22:01

Hi,

I got this weird error want I try to compile a basic connection example. I include all the lib folder in the last patch of SFS2X (jdom.jar, netty-3.2.2.Final.jar, sfs2x-client-core.jar, slf4j-api-1.6.1.jar, slf4j-simple-1.6.1.jar, SFS2X_API_Java.jar). I use the JDK 1.6, i search on the forum, but don't find this error.

The stack trace.

Exception in thread "main" java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/HierarchicalStreamDriver
at com.smartfoxserver.v2.SmartFoxServer.<init>(SmartFoxServer.java:146)
at com.smartfoxserver.v2.SmartFoxServer.getInstance(SmartFoxServer.java:138)
at com.smartfoxserver.v2.Main.main(Main.java:24)
Caused by: java.lang.ClassNotFoundException: com.thoughtworks.xstream.io.HierarchicalStreamDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more

Code: Select all

package ca.creo.monitor;

import com.smartfoxserver.v2.exceptions.SFSException;

import sfs2x.client.SmartFox;
import sfs2x.client.core.BaseEvent;
import sfs2x.client.core.IEventListener;
import sfs2x.client.core.SFSEvent;

public class Main {

   /**
    * @param args
    */
   public static void main(String[] args) {
      SmartFox sfs = new SmartFox();
      
      
      sfs.addEventListener( SFSEvent.CONNECTION, new IEventListener() {
         
         @Override
         public void dispatch(BaseEvent evt) throws SFSException {
            
            if ((Boolean)evt.getArguments().get("success")) {
               System.out.println( "Connexion établi." );
            } else {
               System.out.println( "Échec connexion." );
            }
            
         }
      } );
      
      
      sfs.connect( "localhost", 9933 );

   }

}
Last edited by Nambew on 12 Jan 2012, 15:15, edited 1 time in total.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 12 Jan 2012, 13:52

This is not clear. The error is not at compile time, it's actually a runtime error and it's referring to the server, not the client. I am puzzled :?:

Please try to better explain what you are trying to do on the server side, it looks like you have removed or messed up the lib/ folder.
Lapo
--
gotoAndPlay()
...addicted to flash games
Nambew
Posts: 12
Joined: 29 Jan 2009, 20:45

Postby Nambew » 12 Jan 2012, 15:15

Eclipse try to compile a buggy JUnit run configuration.

Sorry for taking your time Lapo.

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 43 guests