解决 eclipse出现 Address already in use: bind
时间:2016-10-12 17:07:54
收藏:0
阅读:1590
今天开发遇到下面问题,贴出部分异常信息,如下:
[WARNING] failed SelectChannelConnector@0.0.0.0:8080 java.net.BindException: Address already in use: bind at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:444) at sun.nio.ch.Net.bind(Net.java:436) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216) at org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:315) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.Server.doStart(Server.java:233) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132) at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:384) at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:320) at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:205) at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) [WARNING] failed Server@3bca1fe2 [INFO] Shutdown hook executing [INFO] Destroying Spring FrameworkServlet ‘springmvc‘ 2016-10-12 15:39:02,237 INFO XmlWebApplicationContext:1042 - Closing WebApplicationContext for namespace ‘springmvc-servlet‘: startup date [Wed Oct 12 15:38:57 CST 2016]; parent: Root WebApplicationContext 2016-10-12 15:39:02,238 INFO DefaultListableBeanFactory:444 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@551b8762: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,accountAO,accountController,AccountBuzLogAO,accountBuzLogController,accountAmountAO,flowAO,flowController,accountOpenLogAO,accountOpenLogController,RechargeAO,rechargeController,accountRequestLogAO,accountRequestLogController,supplementAO,supplementController,acctransferAO,acctransferController,advForShopAO,advForShopController,billManageAO,billManageController,blockLogAO,blockController,buyerGoodsAO,buyerGoodsController,changeAcountAO,changeAcountController,adminController,compareAO,accountCompareController,cycleSettlementAO,cycleSettlementItemAO,cycleSettItemController,cycleSettlementController,inputInvoiceAccAO,inputInvoiceAccountController,inputInvoiceAccCloseAO,inputInvoiceAccountCloseController,inputInvoiceRecordAO,invoiceRecordController,inputInvoiceAO,invoiceController,/settlementLogAO,settlementLogController,mallDealAO,mallDealController,logisticsAO,logisticsController,processAO,processController,ordersDetailController,orderDetailController,goodsAO,goodsController,payAO,payController,payCancelAO,payCancelController,permissController,proceedsAO,proceedsController,rechargeRefundAO,rechargeRefundController,refundLogAO,refundLogController,secondSettlementAO,secondSettlementController,serviceFeeAO,serviceFeeController,suplierlogisticAO,suplierlogisticController,suplierprocessAO,suplierProcessController,accountAmtAO,fixInvoiceAO,fixPayAO,logisticProcessTempAO,payDBCompletingAO,accountAmtController,invoiceFixController,logisticProcessTempController,payFixController,testSellerGoodsController,testSendMQ,withdrawalsAO,withdrawalsController,contentNegotiationManager,org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0,stringHttpMessageConverter,fastJsonHttpMessageConverter,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,mvcContentNegotiationManager,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#1,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,velocityConfig,velocityViewResolver,exceptionResolver,multipartResolver,localeResolver,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@39ced71b [ERROR] failed jsp java.lang.NoClassDefFoundError: org/apache/jasper/runtime/JspApplicationContextImpl at org.apache.jasper.servlet.JspServlet.destroy(JspServlet.java:411) at org.mortbay.jetty.servlet.ServletHolder.destroyInstance(ServletHolder.java:318) at org.mortbay.jetty.servlet.ServletHolder.doStop(ServletHolder.java:289) at org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78) at org.mortbay.jetty.servlet.ServletHandler.doStop(ServletHandler.java:171) at org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78) at org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142) at org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78) at org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142) at org.mortbay.jetty.servlet.SessionHandler.doStop(SessionHandler.java:124) at org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78) at org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142) at org.mortbay.jetty.handler.ContextHandler.doStop(ContextHandler.java:591) at org.mortbay.jetty.webapp.WebAppContext.doStop(WebAppContext.java:498) at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStop(Jetty6PluginWebAppContext.java:132) at org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78) at org.mortbay.jetty.handler.HandlerCollection.doStop(HandlerCollection.java:169) at org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78) at org.mortbay.jetty.handler.HandlerCollection.doStop(HandlerCollection.java:169) at org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78) at org.mortbay.jetty.handler.HandlerWrapper.doStop(HandlerWrapper.java:142) at org.mortbay.jetty.Server.doStop(Server.java:281) at org.mortbay.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:78) at org.mortbay.jetty.Server$ShutdownHookThread.run(Server.java:559) Caused by: java.lang.ClassNotFoundException: org.apache.jasper.runtime.JspApplicationContextImpl at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227) ... 24 more [ERROR] failed ServletHandler@19d31463
刚看到这个异常以为是启动了两个jetty,结果按照解决办法不行,重启eclipse也不行,到任务管理器里也没有发现占用端口的进程。
最终网上找到解决办法:
1、进入命令窗口,输入命令 :tasklist
其实这显示的就是任务管理器里服务那个页面内容,但是要比任务管理器里展示内容更多,就如我遇到的这个问题,其实是有个pid在任务管理器中是没有显示的。
2、输入命令:taskkill /im 要杀死的进程名称 /f
提示杀死成功,重启eclipse,启动项目,ok。
下面贴图 :
查询taskkill命令的使用方法:
“taskkill /im 映像名称.exe /f” 其中,“/im”后面接映像名称,“/f”的意思的强制结束如想看taskkill的更多用法,可用命令“taskkill /?”进行查看
评论(0)