Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8261867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:33:46+00:00 2026-06-08T03:33:46+00:00

Just had a question about an odd runtime error that I’m having. I’m working

  • 0

Just had a question about an odd runtime error that I’m having. I’m working with a JSON server that responds with a JSON object when prompted by an outside source. As of right now, however, I’m simply trying to get the JSON object up and running before sending it out. My code compiles without specifying any classpath, but when it comes to runtime, it throws a NoClassDefFoundError as seen here:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at ExampleServer.sendData(ExampleServer.java:76)
at ExampleServer.runServer(ExampleServer.java:30)
at ExampleServer.main(ExampleServer.java:15)
   Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 15 more

My code follows here:

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.lang.*;
import net.sf.json.*;

public class ExampleServer{

private DataOutputStream output;
private DataInputStream input;
private ServerSocket server;
private Socket connection;

public static void main(String[] args){
    new ExampleServer().runServer();
}

public void ExampleServer(){
    System.out.println("Server object created");
}

public void runServer(){
    try{
        server = new ServerSocket(12345,100);
        while(true){
            try{
                waitForConnection();
                getStreams();
                processConnection();
                sendData("Text");
            } catch(Exception e){
                System.out.println("Server Terminated Exception.");
            } finally {
                closeConnection();
            }
        }
    } catch(Exception e){
        e.printStackTrace();
    }
}

private void waitForConnection(){
    try{
        System.out.println("Waiting for connection.");
        connection = server.accept();
        System.out.println("Connection received from " + connection.getInetAddress().getHostName());
    } catch (IOException e){
        System.out.println(e);
    }
}

private void getStreams() throws IOException{
    output = new DataOutputStream(connection.getOutputStream());
    input = new DataInputStream(connection.getInputStream());
    System.out.println("Got streams");
}

private void processConnection() throws IOException{
    sendData("This is a test message");
}

private void closeConnection(){
    try{
        if(output != null && connection != null){
            sendData("SEVER>>> TERMINATE");
            output.close();
            connection.close();
        }
    } catch (IOException e){
        e.printStackTrace();
    }
}

private void sendData(String message){
    try{
        JSONObject g = new JSONObject();
        g.put("message", message);
        System.out.println(g.toString());
    } catch (Exception e){
        System.out.println("Error writing object");
    }
}

}

and the JSON folder is in the same directory as ExampleServer.java, with the JSON classes residing in net/sf/json as specified in my imports. Why is it not working until runtime? Is my classpath not right for some reason? What would be the appropriate syntax for including a necessary classpath?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:33:48+00:00Added an answer on June 8, 2026 at 3:33 am

    From json-lib homepage:

    Json-lib requires (at least) the following dependencies in your
    classpath:

    1. jakarta commons-lang 2.5
    2. jakarta commons-beanutils 1.8.0
    3. jakarta commons-collections 3.2.1
    4. jakarta commons-logging 1.1.1
    5. ezmorph 1.0.6

    That your implementation compiles only shows that the compiler can find the right classes and methods. The implementation of those classes and methods may however depend on other libraries.

    More information on project dependencies can be found here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just had a question about aligning two expand-collapse boxes and got an answer
just had a general question about how to approach a certain problem I'm facing.
I just had a quick question about git - how backwards compatible are git
I am new to D3 and just had a quick question about tick labels
I am new to the group and just had a simple question about the
I just had a question about browsing for files on my IPad. I got
I had a question before about implementing datepicker with jqgrid. I think that question
Had a question about a implementation of bind function that I found on Mozilla's
Just have a quick question about the GAC I created an assembly Awesome.DLL. Had
I just asked a question about centering elements, and given what I had to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.