-8

an exception in gwt program

java.lang.ExceptionInInitializerError

[ERROR] Unable to bind socket on port 9997 -- is another session active?
java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
    at java.net.ServerSocket.bind(ServerSocket.java:319)
    at java.net.ServerSocket.bind(ServerSocket.java:277)
    at com.google.gwt.dev.shell.BrowserListener.<init>(BrowserListener.java:67)
    at com.google.gwt.dev.DevModeBase.ensureCodeServerListener(DevModeBase.java:898)
    at com.google.gwt.dev.DevModeBase.doStartup(DevModeBase.java:888)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1030)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:783)
    at com.google.gwt.dev.DevMode.main(DevMode.java:275)
log4j:WARN No appenders could be found for logger (org.apache.jasper.compiler.JspRuntimeContext).
log4j:WARN Please initialize the log4j system properly.
Starting Jetty on port 8888
   [WARN] failed SelectChannelConnector@127.0.0.1:8888
java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind(Native Method)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
    at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:205)
    at org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:304)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.Server.doStart(Server.java:233)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:543)
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:421)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1035)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:783)
    at com.google.gwt.dev.DevMode.main(DevMode.java:275)
   [WARN] failed Server@69d02b
java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind(Native Method)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
    at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:205)
    at org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:304)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.Server.doStart(Server.java:233)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:543)
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:421)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1035)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:783)
    at com.google.gwt.dev.DevMode.main(DevMode.java:275)
Port 127.0.0.1:8888 is already is use; you probably still have another session active
Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278
Sagar Varpe
  • 3,531
  • 4
  • 27
  • 43
  • 2
    Somehow I think you will need to provide more information. Can you provide the stack trace and code for the initialiser where the exception occurs? – Mark Jul 27 '10 at 11:19
  • 2
    Do you expect anyone here to be some kind of magician that can guess the exact conditions of your program? Have you read the API for the ExceptionInInitializeError? If not, then please do so. If you did, then what exactly didn't you understand? – Christian Seifert Jul 27 '10 at 13:34
  • possible duplicate of [question on GWT, Cookies and webpage directing](http://stackoverflow.com/questions/2974100/question-on-gwt-cookies-and-webpage-directing) – Sagar Varpe Oct 17 '11 at 06:10

4 Answers4

11

here's what helped me : http://isurprise.mobi/live/error-port-127-0-0-18888-is-already-in-use

enter image description here

Michael
  • 22,196
  • 33
  • 132
  • 187
3

You have another session active, the stack trace is pretty obvious:

[ERROR] Unable to bind socket on port 9997 -- is another session active?

java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method)

Port 127.0.0.1:8888 is already is use; you probably still have another session active

Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278
0

You haven't provided enough information, such as the stack trace and the code. However, what I can tell is that ExceptionInInitializerError occurs when a static initialization code throws a runtime exception. Note that the exception wraps the triggering runtime exception, so try to view the complete stack trace and analyze it.

Here is an example:

public class Test {
    static {
        String s = "hi";
        s.substring(10);
    }

    public static void main(String[] args) {

    }
}

The stack trace printout is:

java.lang.ExceptionInInitializerError
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -8
    at java.lang.String.substring(String.java:1938)
    at java.lang.String.substring(String.java:1905)
    at Test.<clinit>(Test.java:5)
Exception in thread "main" 

--EDIT--

now that you provided more details, take a look at the other response which is more specific to your case: you either have another session of your GWT application already running, or you have some other server application on the localhost, listening on port 8888.

Eyal Schneider
  • 22,166
  • 5
  • 47
  • 78
0

This thread might be of help to you.

Quoting the top answer from that thread:

"Even after you have exited all browser connections, the code server is still running waiting for new connections. You need to stop that connection from your previous launch before starting another one. Also, note that you don't necessarily have to restart it at all -- just make your changes and refresh the browser or launch a new browser."

From my personal experience , try launching the webapp after 1 min or so. This problem would go away. Not a clean way to do stuffs and so there is a bug filed with the GWT team for this case.

A Null Pointer
  • 2,261
  • 3
  • 26
  • 28