Question

I have understand that TJWS is simple to embed but I have no luck with this code

public class Test {

 public static void main(String[] args) {

        final Serve serve = new Serve();

        new Thread(new Runnable() {
            @Override
            public void run() {
                serve.serve();
            }
        }).start();
    }
}

[Thu Jan 10 17:59:38 CET 2013] Unhandled exception: java.lang.NullPointerException, server is terminating.
java.lang.NullPointerException
    at Acme.Serve.Serve.serve(Serve.java:720)
    at Test.main(Test.java:17)

Java7/TJWS 2.3.2 Final

Was it helpful?

Solution

Have you checked the Serve source code ? Line 720 looks like:

   Socket socket = acceptor.accept();

and I suspect you need to call init() prior to serve()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top