Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2011
    Posts
    117
    Thanks
    27
    Thanked 0 Times in 0 Posts

    Cool Exception Error - Shed Some Light?

    I need help with this problem please I would like to know what this error is telling me. Thank you guys <3

    Problem One:
    Code:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ftpserver/ftplet/FtpException
    Caused by: java.lang.ClassNotFoundException: org.apache.ftpserver.ftplet.FtpException
    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)
    Could not find the main class: com.spilka.server.ChatServer. Program will exit
    Problem Two:
    Code:
    C:\Users\Administrator>java -cp c:\server.zip com.spilka.server.ChatServer
    Exception in thread "main" java.lang.NullPointerException
    at com.spilka.server.ChatServer.q(Unknown Source)
    at com.spilka.server.ChatServer.q(Unknown Source)
    at com.spilka.server.ChatServer.<init>(Unknown Source)
    at com.spilka.server.ChatServer.main(Unknown Source)
    I just would like to know what the error is telling me, I do not need the solution. Thank you

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    The first one appears to be missing the external library. Make sure you add the library on the classpath when invoking it (or as a part of the manifest if its jar'd). It also appears to not be able to invoke the main method on com.spilka.server.ChatServer.

    The second is simply caused by a non-instance of an object which you are attempting to dereference. To what depth, we don't know you'll need to trace the stack to get to the cause. So within the main, you can follow the tack to the q and find that something is being derferenced which is null. Perhaps the argument itself is null. It can be try/caught since its an Exception to prevent the program from terminating, but that only has use if you have a fallback to go on (which chances are would be an error message and then exit anyway).
    Edit:
    Maybe an example of that would help.
    Code:
    Integer myint = null;
    try
    {
        myint = Integer.parseInt("anint");
    }
    catch (NumberFormatException ex)
    {
        // this is guaranteed to get here since 'anint' isn't parseable as an Integer.
    }
    System.out.println(myint.toString()); // throws NullPointerException since toString isn't available on null.
    Last edited by Fou-Lu; 01-28-2013 at 03:36 PM.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •