日期:2014-05-17  浏览次数:20686 次

请教Address already in use: connect问题
我做了一个信息查询的东东,信息量大,大概一次500左右个,显示在一个页面,并且每次要从数据库里查询这个信息是否有,如果有就做其他操作。但是经常出现以下这样的情况,不知道如何解决。从网上搜索也就是说说socket没有被释放什么的,请问应该如何释放???具体怎么做,谢谢!!! 
Caused by: java.net.BindException: Address already in use: connect 
at java.net.PlainSocketImpl.socketConnect(Native Method) 
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) 
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) 
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) 
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364) 
at java.net.Socket.connect(Socket.java:507) 
at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:585) 
at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:304) 
at net.sourceforge.jtds.jdbc.SharedSocket. <init>(SharedSocket.java:255) 
at net.sourceforge.jtds.jdbc.ConnectionJDBC2. <init>(ConnectionJDBC2.java:310) 
... 50 more 
java.lang.NullPointerException 
at com.oper.ReservaOper.selectReservaRepeat(ReservaOper.java:204) 
at org.apache.jsp.Reserva.ReservationsAddNextWeek_jsp._jspService(ReservationsAddNextWeek_jsp.java:2478) 
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) 
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) 
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) 
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704) 
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590) 
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:510) 
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966) 
at org.apache.jsp.ReservationsAddNextWeekRun_jsp._jspService(ReservationsAddNextWeekRun_jsp.java:52) 
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) 
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) 
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) 
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) 
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) 
at org.apache.catalina.cor