linux - Exception in thread "main" java.net.BindException: Address already in use -
i try install java http api on linux server. try execute command command pompt run service:
java -dfile.encoding=utf8 -cp .:boilerpipe-1.2.0.jar:lib/nekohtml-1.9.13.jar:lib/xerces-2.9.1.jar:lib/langdetect.jar:lib/jsonic-1.2.8.jar exampleprogram
then have error:
exception in thread "main" java.net.bindexception: address in use @ sun.nio.ch.net.bind0(native method) @ sun.nio.ch.net.bind(net.java:463) @ sun.nio.ch.net.bind(net.java:455) @ sun.nio.ch.serversocketchannelimpl.bind(serversocketchannelimpl.java:223) @ sun.nio.ch.serversocketadaptor.bind(serversocketadaptor.java:74) @ sun.net.httpserver.serverimpl.(serverimpl.java:100) @ sun.net.httpserver.httpserverimpl.(httpserverimpl.java:50) @ sun.net.httpserver.defaulthttpserverprovider.createhttpserver(defaulthttpserverprovider.java:35) @ com.sun.net.httpserver.httpserver.create(httpserver.java:129) @ exampleprogram.main(exampleprogram.java:37)
here exampleprogram.java:
import java.io.inputstream; import java.io.filereader; import java.io.fileinputstream; import java.io.inputstreamreader; import java.io.ioexception; import org.xml.sax.inputsource; import de.l3s.boilerpipe.document.textdocument; import de.l3s.boilerpipe.extractors.articleextractor; import de.l3s.boilerpipe.sax.boilerpipesaxinput; // language detect librarys import com.cybozu.labs.langdetect.*; import net.arnx.jsonic.json; import net.arnx.jsonic.jsonexception; import java.io.*; import java.net.*; import java.util.concurrent.executors; import com.sun.net.httpserver.headers; import com.sun.net.httpserver.httpexchange; import com.sun.net.httpserver.httphandler; import com.sun.net.httpserver.httpserver; class exampleprogram { public static void main(string[] args) throws exception { everydetector evr = new everydetector(); inetsocketaddress addr = new inetsocketaddress("localhost",8080); httpserver server = httpserver.create(addr, 0); myhandler hndl = new myhandler(); hndl.setdetector(evr); myhandlerextractcontent hnd2 = new myhandlerextractcontent(); hnd2.setdetector(evr); myhandlerdetectlanguage hnd3 = new myhandlerdetectlanguage(); hnd3.setdetector(evr); server.createcontext("/",hndl); server.createcontext("/extractcontent",hnd2); server.createcontext("/detectlanguage",hnd3); server.setexecutor(executors.newcachedthreadpool()); server.start(); system.out.println("server listening on port 8080" ); } }
source: https://github.com/remdex/boilerpipe-and-language-detect-api-server
what wrong? how can fix it?
what looks happening running on port 8080 if change port number problem should go away.
Comments
Post a Comment