IDEA连接服务器远程调试报 "Connection refused: connect"

IntelliJ IDEA连接tomcat服务器远程调试报Unable to open debugger port : java.net.ConnectException "Connection refused: connect"错误怎么解决;而且有时候是可以连接的,有时候又不行了。。。求各位大神解答一下,谢谢。。。。。。。

3个回答

查看你的网络,网络不好

wyh906802129
wyh906802129 这和网络没多大关系吧。。。
2 年多之前 回复
wyh906802129
wyh906802129 我连的是本地连接啊。。。。
2 年多之前 回复

检查你的服务是不是没启

wyh906802129
wyh906802129 有时还报Error running emm: Unable to connect to the localhost:8000
2 年多之前 回复
wyh906802129
wyh906802129 起了呀tomcat都启动了,还提示Listening for transport dt_socket at address: 8000了,idea 启动的时候就报着个了
2 年多之前 回复

已解决,电脑防火墙网络问题

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
ejb客户端通过JNDI访问服务器报错 Connection refused: connect
ejb客户端通过JNDI访问服务器报错 javax.naming.ServiceUnavailableException: Connection refused: connect 客户端代码为: ``` InitialContext ctx = new InitialContext(); FirstEjb ejb = (FirstEjb)ctx.lookup("FirstEjbBean/remote"); String s = ejb.saySomething("HelloWorld"); System.out.println(s); ``` 具体错误为:![图片说明](https://img-ask.csdn.net/upload/201602/27/1456579823_883123.gif)
测试报错,Connection refused: connect,求解?
代码: ``` public class ItfTest { /** * @param args */ public static void main(String[] args) { try { String out = testbiz(); System.out.println(out); } catch (IOException e) { e.printStackTrace(); } } public static String testbiz() throws HttpException, IOException { HttpClient httpClient = new HttpClient(); PostMethod post = new PostMethod( "http://localhost:8001/itf/OI_AddSaleByParameter"); // PostMethod post = new PostMethod( "https://rryx.sinovatech.com/itf/OI_QueryEShopOrder"); post.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); String key = "123321abc"; String channel="ch_shenxun"; Map<String, Object> req = new HashMap<>(); String instr ="{\"body\": \"{\\\"startTime\\\":\\\"2019-01-01 14:43:19\\\",\\\"endTime\\\":\\\"2019-01-12 15:14:42\\\",\\\"phone\\\":\\\"18309858042\\\"}\",\"head\": {} }"; /* String instr ="6351"; req.put("loginCode",instr);*/ Map<String, Object> header = new HashMap<>(); header.put("appId", channel); header.put("tid", UUID.randomUUID().toString()); header.put("timestamp", System.currentTimeMillis()); header.put("ver", "1.0"); Map<String, Object> reMap = new HashMap<>(); reMap.put("header", header); reMap.put("req", req); req.put("saleName","123"); req.put("goodIds","ff8080815e562c4d015e6103956700b6"); req.put("orderValue","1"); req.put("createName","管理员"); System.out.println(JSONObject.toJSON(reMap)); String reqdata = JSONObject.toJSONString(reMap); String sign = DigestUtils.md5Hex(reqdata + key); NameValuePair[] param = { new NameValuePair("sign", sign), new NameValuePair("reqdata", reqdata) }; post.setRequestBody(param); int result = httpClient.executeMethod(post); System.out.println("返回结果=" + result); InputStream in = post.getResponseBodyAsStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder sb = new StringBuilder(); String line = reader.readLine(); while (line != null) { sb.append(line); line = reader.readLine(); } reader.close(); return sb.toString(); } } //以上代码传参测试,但是运行后报错 java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:286) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323) at com.sinovatech.test.ItfTest.testbiz(ItfTest.java:95) at com.sinovatech.test.ItfTest.main(ItfTest.java:52) 求大神指点 ```
基于AXIS调用webservice报错:Connection refused: connect
我的调用方法: public static void main(String[] args) throws Exception { String client_id = "HeYiApp"; String orderNum = "2"; List numberList = new ArrayList(); numberList.add("120719"); numberList.add("120746"); numberList.add("113095"); String webUrl = "https://10.218.132.26/api/openapi/employee/getBatchEmpInfoList.json";// 服务端url地址 String webMethod = "getBatchEmpInfoList";// 调用方法名称 Service service = new Service(); // 建服务 Call call; try { call = (Call) service.createCall(); try { call.setTargetEndpointAddress(new URL(webUrl)); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); }// 设置访问地址 call.setOperationName(webMethod);// 设置访问方法 call.addParameter("arg0", XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 定义参数 call.addParameter("arg1", XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 定义参数 call.addParameter("arg2", XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);// 定义参数 call.setReturnType(XMLType.XSD_STRING);// 定义返回值格式 //List<Map<String, Object>> workersInfo= (List<Map<String, Object>>) call.invoke(new Object[] { client_id, numberList, orderNum }); //for(Map m:workersInfo){ // System.out.println(m.get("name")); //} JSONArray jsonObject = (JSONArray) call.invoke(new Object[] { client_id, numberList, orderNum }); System.out.println(jsonObject.toString()); } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } // 建对话 } 报错: Exception in thread "main" AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.net.ConnectException: Connection refused: connect faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668) at sun.security.ssl.SSLSocketImpl.&lt;init&gt;(SSLSocketImpl.java:427) at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88) at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92) at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191) at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at webservice.Test.main(Test.java:52) {http://xml.apache.org/axis/}hostname:zhangxl java.net.ConnectException: Connection refused: connect at org.apache.axis.AxisFault.makeFault(AxisFault.java:101) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at webservice.Test.main(Test.java:52) Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668) at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:427) at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88) at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92) at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191) at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138) ... 10 more
初学者关于 java.net.ConnectException: Connection refused: connect的问题?
javase初学者一名,在看到head first java的网络联机这一节中遇到了问题。 用eclipse测试该语句时报错: java.net.ConnectException: Connection refused: connect ``` Socket s=new Socket("127.0.0.1",5000); ``` 搜索了一些处理 java.net.ConnectException: Connection refused: connect的方法,大多都是说Tomcat的问题,刚刚接触java不久对这些javaweb的东西一无所知,看了一部分帖子后,我猜测可能是我没有Tomcat的原因,我尝试了下在eclipse上装了server,并且载入了Tomcat,但是启动服务器失败了。![图片说明](https://img-ask.csdn.net/upload/201908/30/1567102922_739107.png) 所以我想问这里的 ``` Socket s=new Socket("127.0.0.1",5000); ``` 到底是什么原因导致了connection refused。是否是因为与网络相关就必须要载入服务器,还是别的原因。《head frist java》并没有说需要载入服务器,Tomcat什么的操作。 以下是错误提示 ![图片说明](https://img-ask.csdn.net/upload/201908/30/1567103184_669305.png) 程序代码 ``` import java.io.*; import java.net.*; public class DailyAdviceClient { public void go () { try { Socket s=new Socket("127.0.0.1",5000); InputStreamReader streamReader=new InputStreamReader(s.getInputStream()); BufferedReader reader=new BufferedReader(streamReader); String advice=reader.readLine(); System.out.println("Today you should "+advice); }catch(IOException ex) { ex.printStackTrace(); } } public static void main(String[] args) { DailyAdviceClient client =new DailyAdviceClient(); client.go(); } } ```
Connection refused: connect: localhost" [90067-168])
连接远程oracle报了一个连接拒绝的错,我是win7的,下面是错误,那位大神指导下吧: apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Connection is broken: "java.net.ConnectException: Connection refused: connect: localhost" [90067-168]) at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:224) at $Proxy4.getMetaData(Unknown Source) at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDatabaseType(ProcessEngineConfigurationImpl.java:517) at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.initDataSource(ProcessEngineConfigurationImpl.java:478) at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:323) at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:300) at org.activiti.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:60) at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:56) at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:32) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1442) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:305) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061) at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
连接hbase Connection refused: no further information
server环境: 在virtualbox里安装了ubuntu,然后装了了hadoop2.7.5,hbase1.3.1,然后hadoop和hbase的环境都配置好了 启动了hbase,然后本机里通过scala访问虚拟机里的hbase时,connection能获取到,但是在执行tableExists时,卡一会后就报超时了,client的代码和server的配置如: server配置(其中zookeeper用的hbase自己管理的): hbase-site.xml ![图片说明](https://img-ask.csdn.net/upload/201804/02/1522641879_341754.png) client的代码: ``` class HbaseUtil { def GetHbaseConfiguration(ip:String):Unit={ var conf = HBaseConfiguration.create; //这个是远程hbase的ip地址 conf.set("hbase.zookeeper.quorum",ip) //conf.set("zookeeper.znode.parent", "/hbase-unsecure") //2181是hbase里zookeeper的默认端口号 conf.set("hbase.zookeeper.property.clientPort","2181") println(ip+":habse connention success...") val tableName = "jndata" conf.set(TableInputFormat.INPUT_TABLE, tableName) val con= ConnectionFactory.createConnection(conf) val hBaseAdmin = con.getAdmin//new HBaseAdmin(conf); val tn = TableName.valueOf(tableName); // hBaseAdmin.disableTable(tn) // println(tableName + " is exist,detele....") //创建表 if (hBaseAdmin.tableExists(tn)) { println(tableName + " is exist,....") }else{ println(tableName + " is not exist,....") } } } ``` 然后server端的zookeeper的log如下: ![图片说明](https://img-ask.csdn.net/upload/201804/02/1522640993_389812.png) client端的异常如下: ``` Exception in thread "main" org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=36, exceptions: Mon Apr 02 11:30:11 CST 2018, null, java.net.SocketTimeoutException: callTimeout=60000, callDuration=76915: Connection refused: no further information row 'jndata,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=simon-virtualbox,16201,1522631406769, seqNum=0 at org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.throwEnrichedException(RpcRetryingCallerWithReadReplicas.java:276) at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:210) at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:60) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:212) at org.apache.hadoop.hbase.client.ClientScanner.call(ClientScanner.java:314) at org.apache.hadoop.hbase.client.ClientScanner.nextScanner(ClientScanner.java:289) at org.apache.hadoop.hbase.client.ClientScanner.initializeScannerInConstruction(ClientScanner.java:164) at org.apache.hadoop.hbase.client.ClientScanner.<init>(ClientScanner.java:159) at org.apache.hadoop.hbase.client.HTable.getScanner(HTable.java:796) at org.apache.hadoop.hbase.MetaTableAccessor.fullScan(MetaTableAccessor.java:602) at org.apache.hadoop.hbase.MetaTableAccessor.tableExists(MetaTableAccessor.java:366) at org.apache.hadoop.hbase.client.HBaseAdmin.tableExists(HBaseAdmin.java:408) at rxb.flinkDemo.hbase.HbaseUtil.GetHbaseConfiguration(HbaseUtil.scala:42) at rxb.flinkDemo.MyDemo$.main(FlinkDemo.scala:27) at rxb.flinkDemo.MyDemo.main(FlinkDemo.scala) Caused by: java.net.SocketTimeoutException: callTimeout=60000, callDuration=76915: Connection refused: no further information row 'jndata,,' on table 'hbase:meta' at region=hbase:meta,,1.1588230740, hostname=simon-virtualbox,16201,1522631406769, seqNum=0 at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:171) at org.apache.hadoop.hbase.client.ResultBoundedCompletionService$QueueingFuture.run(ResultBoundedCompletionService.java:65) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.net.ConnectException: Connection refused: no further information at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206) at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531) at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:495) at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.setupConnection(RpcClientImpl.java:416) at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.setupIOstreams(RpcClientImpl.java:722) at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.writeRequest(RpcClientImpl.java:909) at org.apache.hadoop.hbase.ipc.RpcClientImpl$Connection.tracedWriteRequest(RpcClientImpl.java:873) at org.apache.hadoop.hbase.ipc.RpcClientImpl.call(RpcClientImpl.java:1244) at org.apache.hadoop.hbase.ipc.AbstractRpcClient.callBlockingMethod(AbstractRpcClient.java:227) at org.apache.hadoop.hbase.ipc.AbstractRpcClient$BlockingRpcChannelImplementation.callBlockingMethod(AbstractRpcClient.java:336) at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$BlockingStub.scan(ClientProtos.java:35396) at org.apache.hadoop.hbase.client.ScannerCallable.openScanner(ScannerCallable.java:404) at org.apache.hadoop.hbase.client.ScannerCallable.call(ScannerCallable.java:211) at org.apache.hadoop.hbase.client.ScannerCallable.call(ScannerCallable.java:65) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:212) at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas$RetryingRPC.call(ScannerCallableWithReplicas.java:364) at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas$RetryingRPC.call(ScannerCallableWithReplicas.java:338) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:137) ... 4 more ``` 好多办法都试过了还是不行: 1.server和client的防火墙都关了 2.client的host里也配置了server的ip和hostname
java.net.ConnectException: Connection refused: connect
昨天遇到了这个错,到现在没解决,求大佬帮助 1.服务器安装了一个8082的项目,网页访问服务器ip:8082没有任何问题 2.本地装了个node,启动了一个前端项目 localhost:3000,后端接口配的就是http://服务器ip:8082 然后本地掉服务器接口就一直报 java.net.ConnectException: Connection refused: connect, 3.前端是通过jsonp掉的接口 之前都是好的,请问怎么解决啊 spring boot 项目 服务器windows的,防火墙是关闭的,端口也没占用 错误信息 ``` java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) at sun.net.www.http.HttpClient.<init>(HttpClient.java:211) at sun.net.www.http.HttpClient.New(HttpClient.java:308) at sun.net.www.http.HttpClient.New(HttpClient.java:326) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1167) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1103) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:997) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:931) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1281) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1256) at com.sunline.utils.HttpUtil.httpRequest(HttpUtil.java:62) at com.sunline.utils.HttpUtil.httpRequest(HttpUtil.java:30) at com.sunline.web.controller.XlrLoginController.oauthLogin(XlrLoginController.java:134) at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:158) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:126) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:111) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:209) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:613) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) ```
tomcat:Connection refused: connect什么原因
我的tomcat.startup.bat后,客户端同时启动1000个以上线程去请求它时,开始运行会有 java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.<init>(Unknown Source) at java.net.Socket.<init>(Unknown Source) 抛出,大家帮分析下是什么原因呢? 我的server.xml中设置maxThreads="500" acceptCount="500"
(已解决)紧急求助!springboot启动服务,提示: java.net.ConnectException: Connection refused: connect
## 这个服务昨晚还可以运行的,今早启动后, 一开始提示:could not be registered. A bean with that name has already been 根据网友的说法,我设置了:_allow-bean-definition-overriding: true _ ## 然后就开始报这个错了,现在把上面这个配置注释掉也不行。。。 请大神指教! +++ ![图片说明](https://img-ask.csdn.net/upload/202002/04/1580782392_321522.png) +++ ``` com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187) ~[jersey-apache-client4-1.19.1.jar:1.19.1] at com.sun.jersey.api.client.filter.GZIPContentEncodingFilter.handle(GZIPContentEncodingFilter.java:123) ~[jersey-client-1.19.1.jar:1.19.1] at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27) ~[eureka-client-1.9.13.jar:1.9.13] at com.sun.jersey.api.client.Client.handle(Client.java:652) ~[jersey-client-1.19.1.jar:1.19.1] at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682) ~[jersey-client-1.19.1.jar:1.19.1] at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) ~[jersey-client-1.19.1.jar:1.19.1] at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:509) ~[jersey-client-1.19.1.jar:1.19.1] at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.getApplicationsInternal(AbstractJerseyEurekaHttpClient.java:194) ~[eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.getApplications(AbstractJerseyEurekaHttpClient.java:165) ~[eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.MetricsCollectingEurekaHttpClient.execute(MetricsCollectingEurekaHttpClient.java:73) ~[eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.executeOnNewServer(RedirectingEurekaHttpClient.java:118) ~[eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.execute(RedirectingEurekaHttpClient.java:79) ~[eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:120) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:1069) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:983) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:430) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:276) [eureka-client-1.9.13.jar:1.9.13] at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:272) [eureka-client-1.9.13.jar:1.9.13] at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:67) [spring-cloud-netflix-eureka-client-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:322) [spring-cloud-netflix-eureka-client-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$fdd1bb83.CGLIB$eurekaClient$2(<generated>) [spring-cloud-netflix-eureka-client-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$fdd1bb83$$FastClassBySpringCGLIB$$45c98188.invoke(<generated>) [spring-cloud-netflix-eureka-client-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) [spring-core-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) [spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration$$EnhancerBySpringCGLIB$$fdd1bb83.eurekaClient(<generated>) [spring-cloud-netflix-eureka-client-2.1.4.RELEASE.jar:2.1.4.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) [spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) [spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:607) [spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321) [spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) [spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) [spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) [spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:356) [spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:389) ~[spring-cloud-context-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:186) ~[spring-cloud-context-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:353) [spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35) ~[spring-aop-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getTargetObject(EurekaRegistration.java:129) ~[spring-cloud-netflix-eureka-client-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getEurekaClient(EurekaRegistration.java:117) ~[spring-cloud-netflix-eureka-client-2.1.4.RELEASE.jar:2.1.4.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181] at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) ~[spring-core-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:499) ~[spring-cloud-context-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) ~[spring-aop-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration$$EnhancerBySpringCGLIB$$ea0a2add.getEurekaClient(<generated>) ~[spring-cloud-netflix-eureka-client-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.maybeInitializeClient(EurekaServiceRegistry.java:57) ~[spring-cloud-netflix-eureka-client-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.register(EurekaServiceRegistry.java:38) ~[spring-cloud-netflix-eureka-client-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration.start(EurekaAutoServiceRegistration.java:83) ~[spring-cloud-netflix-eureka-client-2.1.4.RELEASE.jar:2.1.4.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:893) ~[spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) ~[spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) ~[spring-boot-2.1.10.RELEASE.jar:2.1.10.RELEASE] at com.myfeign.MyFeignConsumer_8888.main(MyFeignConsumer_8888.java:14) ~[classes/:na] Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_181] at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_181] at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_181] at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_181] at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_181] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_181] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_181] at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_181] at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117) ~[httpclient-4.5.1.jar:4.5.1] at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177) ~[httpclient-4.5.1.jar:4.5.1] at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144) ~[httpclient-4.5.1.jar:4.5.1] at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131) ~[httpclient-4.5.1.jar:4.5.1] at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611) ~[httpclient-4.5.1.jar:4.5.1] at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446) ~[httpclient-4.5.1.jar:4.5.1] at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882) ~[httpclient-4.5.1.jar:4.5.1] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:117) ~[httpclient-4.5.1.jar:4.5.1] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55) ~[httpclient-4.5.1.jar:4.5.1] at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:173) ~[jersey-apache-client4-1.19.1.jar:1.19.1] ... 79 common frames omitted ```
Spring LDAP在链接AD域的时候报Connection refused: connect]]
我在用Spring Ldap链接AD域的时候报PartialResultException [Root exception is (我尝试着随便写个密码,链接的时候会提示密码错误) (用java自带的可以链接成功) 我从看文档说可以抑制,结果抑制了还是不行,有没有朋友知道这是为什么?求告知 这是我xml的配置文件 ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505207141_514391.jpg) ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505207187_983442.jpg) ![图片说明](https://img-ask.csdn.net/upload/201709/12/1505207196_902440.jpg) 这是报的异常 org.springframework.ldap.PartialResultException: nested exception is javax.naming.PartialResultException [Root exception is javax.naming.CommunicationException: wzax.com:389 [Root exception is java.net.ConnectException: Connection refused: connect]] at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:216) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:385) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:309) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:642) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:578) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:1617) at com.wzax.springldap.MyPersonRepoImpl.getPassword(MyPersonRepoImpl.java:316) at com.wzax.springldap.PersonRepoTest.testPassword(PersonRepoTest.java:20) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) Caused by: javax.naming.PartialResultException [Root exception is javax.naming.CommunicationException: wzax.com:389 [Root exception is java.net.ConnectException: Connection refused: connect]] at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreImpl(AbstractLdapNamingEnumeration.java:237) at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMore(AbstractLdapNamingEnumeration.java:189) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:365) ... 35 more Caused by: javax.naming.CommunicationException: wzax.com:389 [Root exception is java.net.ConnectException: Connection refused: connect] at com.sun.jndi.ldap.LdapReferralContext.<init>(LdapReferralContext.java:96) at com.sun.jndi.ldap.LdapReferralException.getReferralContext(LdapReferralException.java:150) at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreReferrals(AbstractLdapNamingEnumeration.java:325) at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreImpl(AbstractLdapNamingEnumeration.java:227) ... 37 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at com.sun.jndi.ldap.Connection.createSocket(Connection.java:363) at com.sun.jndi.ldap.Connection.<init>(Connection.java:203) at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:137) at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1614) at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2746) at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:319) at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:192) at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:151) at com.sun.jndi.url.ldap.ldapURLContextFactory.getObjectInstance(ldapURLContextFactory.java:52) at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:601) at javax.naming.spi.NamingManager.processURL(NamingManager.java:381) at javax.naming.spi.NamingManager.processURLAddrs(NamingManager.java:361) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:333) at com.sun.jndi.ldap.LdapReferralContext.<init>(LdapReferralContext.java:119) ... 40 more
关于CXF的client调用server,出现Connection refused: connect
环境描述 jdk7 cxf.version = 3.0.0 Spring.version = 3.2.4 图片详细描述:http://www.oschina.net/question/1027522_2138367#answers 出的问题: 以前没设置防火墙,访问http://IP/services/服务名,请求没有问题 现在有设置防火墙了,不能IP访问,只能通过域名,http://yx.hello.comIP/services/服务名 然后就经常Connection refused: connect 请问是哪个环节需要改进?公司明确了就是要通过网址调用,求各位大神解救啊
java网络编程错误java.net.ConnectException: Connection refused: connect求教
刚开始学习java网络编程,在书上看到一段代码,就动手试一下,结果出现下面错误: java.net.ConnectException: Connection refused: connect 源代码如下: import java.io.*; import java.net.*; class lx01 { public static void main(String[] args) { String host = "localhost"; BufferedReader br = null; PrintWriter pw = null; Socket s = null; try { s = new Socket(host, 10000); InputStreamReader isr; isr = new InputStreamReader(s.getInputStream()); br = new BufferedReader(isr); pw = new PrintWriter(s.getOutputStream(), true); pw.println("DATE"); System.out.println(br.readLine()); pw.println("PAUSE"); pw.println("DOW"); System.out.println(br.readLine()); pw.println("DOM"); System.out.println(br.readLine()); pw.println("DOY"); System.out.println(br.readLine()); } catch (IOException e) { System.out.println(e.toString()); } finally { try { if (br != null) br.close(); if (pw != null) pw.close(); if (s != null) s.close(); } catch (IOException e) { } } } } 求教各位大神这是啥原因,如何解决?
java错误:Connection refused:connect
这是我主界面,我想在这点开文件,然后可以发送给连接的人,目前的测试就是自己给自己发。 package com.fastSendFile; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetAdapter; import java.awt.dnd.DropTargetDropEvent; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import java.io.IOException; import java.net.InetAddress; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTable; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.table.DefaultTableColumnModel; import javax.swing.table.DefaultTableModel; import javax.swing.table.JTableHeader; public class SendWindow { // private static final SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd:HH:mm:ss"); // private static Object lock1 = new Object(); private Object[] columnNames = { "用户名", "工作组","主机名","优先级", "IP地址", "port","" }; private String myName = ""; private UDP udpService; private static SendWindow sendWindow; int add =0; int count=0,flag=0; JFrame frame; File f; File file; JButton reFresh; JButton send; JButton file_btn; JButton open_file; JLabel userOnline; JLabel userCount; JCheckBox packaging; JCheckBox lock; JTable table; JTextArea inputArea; JScrollPane scrollPaneTable; JScrollPane scrollPaneFile; JSplitPane jSplitPane; JPanel panelSouth; JPanel panelSouthNorth; JPanel panelSouthSouth; JPanel panelNorth; JPanel panelNorthEast; private JFileChooser filechooser; private AddFileWindow addFileWindow; String filename = "",filePath = "",filepath=""; long fileSize = 0; int d = 0,port; public Vector fileVector = new Vector(); private void createWindow() { //分割容器 jSplitPane=new JSplitPane();//创建一个分割容器类 jSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);//设置分割线方向 jSplitPane.setDividerSize(5); jSplitPane.setDividerLocation(50);//设置分割线位于中央 //上半部分整体布局 panelNorth = new JPanel(new BorderLayout()); panelNorthEast = new JPanel(new BorderLayout()); panelNorth.add(panelNorthEast,BorderLayout.EAST); jSplitPane.setTopComponent(panelNorth); //下半部分整体布局 panelSouth = new JPanel(new BorderLayout()); panelSouthNorth = new JPanel(); panelSouthSouth = new JPanel(); inputArea = new JTextArea(); scrollPaneFile = new JScrollPane(inputArea); scrollPaneFile.setPreferredSize(new Dimension(500, 150)); scrollPaneFile.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); file_btn = new JButton(); // panelSouthNorth.add(fileName); file_btn.setVisible(false); FlowLayout flowLayout2 = new FlowLayout(FlowLayout.CENTER , 10 , 10); panelSouthSouth.setLayout(flowLayout2); panelSouth.add(file_btn,BorderLayout.NORTH); panelSouth.add(scrollPaneFile,BorderLayout.CENTER); panelSouth.add(panelSouthSouth,BorderLayout.SOUTH); jSplitPane.setBottomComponent(panelSouth); DefaultTableModel tableModel = new DefaultTableModel(null, columnNames); table = new JTable(tableModel){ private static final long serialVersionUID = 1L; @Override public boolean isCellEditable(int row, int column) { return false; } }; scrollPaneTable = new JScrollPane(); scrollPaneTable.setPreferredSize(new Dimension(500, 150)); //scrollPaneTable.setPreferredSize(panelNorth.getPreferredSize()); scrollPaneTable.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); //scrollPane.setBounds(new Rectangle(76, 35, 257, 193)); //table.setFillsViewportHeight(true); //panelNorth.add(table.getTableHeader(), BorderLayout.PAGE_START); panelNorth.add(scrollPaneTable,BorderLayout.WEST); // JScrollPane tableScroll = new JScrollPane(); JTableHeader header = table.getTableHeader(); header.setBounds(0, 0, 400, 20); table.setBounds(0, 20, 400, 180); DefaultTableColumnModel columnModel = (DefaultTableColumnModel) table.getColumnModel(); columnModel.removeColumn(columnModel.getColumn(6)); scrollPaneTable.setViewportView(header); scrollPaneTable.setViewportView(table); scrollPaneTable.setBounds(0, 0, 400, 200); scrollPaneTable.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPaneTable.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); //scrollPaneTable = new JScrollPane(table); //scrollPaneTable.setPreferredSize(new Dimension(500, 150)); //scrollPaneTable.setPreferredSize(panelNorth.getPreferredSize()); //scrollPaneTable.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); //scrollPane.setBounds(new Rectangle(76, 35, 257, 193)); //table.setFillsViewportHeight(true); //panelNorth.add(table.getTableHeader(), BorderLayout.PAGE_START); panelNorth.add(scrollPaneTable,BorderLayout.WEST); //上半部分标签和按钮 userOnline = new JLabel("在线用户",JLabel.CENTER); userCount = new JLabel("0",JLabel.CENTER); reFresh = new JButton("刷新(R)"); panelNorthEast.add(userOnline,BorderLayout.NORTH); panelNorthEast.add(userCount,BorderLayout.CENTER); panelNorthEast.add(reFresh,BorderLayout.SOUTH); //下半部分拖拽 DropTargetAdapter kgd=new DropTargetAdapter() { @Override public void drop(DropTargetDropEvent dtde) { try { Transferable tf=dtde.getTransferable(); if(tf.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); List lt=(List)tf.getTransferData(DataFlavor.javaFileListFlavor); Iterator itor=lt.iterator(); while(itor.hasNext()) { f=(File)itor.next(); filename = f.getName(); fileSize = f.length(); filePath = f.getPath(); file_btn.setText(f.getName()); // fileName.setText(f.getPath()); //fileName.setText(f.getPath().substring(filePath.lastIndexOf("\\") + 1)); file_btn.setVisible(true); fileVector.add(f); add = 0; // flag+=1; //frame.removeAll(); // frame.repaint(); if(fileSize>0) { open_file.setEnabled(false); } } dtde.dropComplete(true); } else { dtde.rejectDrop(); } } catch(Exception e) { e.printStackTrace(); } } }; new DropTarget(inputArea,DnDConstants.ACTION_COPY_OR_MOVE,kgd); file_btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addFileWindow = AddFileWindow.createWindow(getInstance()); addFileWindow.frame.setVisible(true); System.out.println("file_btn:"+f.getName()+f.length()+f.getPath()); addFileWindow.showFile(f.getName(),f.length(),f.getPath()); } }); //下半部分按钮和复选按钮 open_file = new JButton("添加文件"); send = new JButton("发送(S)"); packaging = new JCheckBox("封装(E)"); packaging.setSelected(true); lock = new JCheckBox("上锁(K)"); panelSouthSouth.add(open_file); panelSouthSouth.add(send); panelSouthSouth.add(packaging); panelSouthSouth.add(lock); open_file.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { filechooser = new JFileChooser(); filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int option = filechooser.showDialog(null, "选择文件"); if (option == 0) { file = filechooser.getSelectedFile(); filePath = file.getPath(); file_btn.setText(file.getName()); file_btn.setVisible(true); add = 0; } } }); packaging.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(packaging.isSelected()==false) { lock.setSelected(false); lock.setEnabled(false); } } }); //整个布局 frame = new JFrame("FastSend"); frame.setSize(595, 420); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setResizable(true); frame.setContentPane(jSplitPane); jSplitPane.setDividerLocation(0.5); //frame.pack(); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent event) { try { udpService.broadcast("offline#"); } catch (IOException e) { e.printStackTrace(); } } }); reFresh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { frame.repaint(); } }); send.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String msg = inputArea.getText(); if(add==1) { filepath = ""; } else { filepath = filePath; } System.out.println("1111filepath:"+filepath); if ((msg != null && msg.length() > 0) || (filepath != null && filepath.length() > 0)) { List<Map<String, String>> selected = getSelected(); if (selected == null) { JOptionPane.showMessageDialog(null, "请选择发送对象!", "注意", JOptionPane.INFORMATION_MESSAGE); return; } for (Map<String, String> map : selected) { String addr = map.get("addr"); int port = Integer.parseInt(map.get("port")); try { StringBuffer sb = new StringBuffer("msg#"); sb.append(myName); msg = (msg != null && msg.length() > 0) ? msg : "null"; sb.append("#" + msg.replaceAll("#", "*")); filepath = (filepath != null && filepath.length() > 0) ? filepath : "null"; sb.append("#" + filepath); //if(addFileWindow.) udpService.send(addr, port, sb.toString()); Vector sendList = new Vector( ); sendList.add(fileVector); int[] selectRows = table.getSelectedRows(); InetAddress sendAddress; DefaultTableModel model = (DefaultTableModel) table.getModel(); // for (int i = 0; i < selectRows.length; i++) { // String addr = model.getValueAt(selectRows[i], 3).toString(); sendAddress=InetAddress.getByName( ( String ) model.getValueAt (selectRows[0] ,3 ) ); Thread clientThread=new Thread(new Client( sendList ,sendAddress)); clientThread.setPriority(6); clientThread.start(); // } } catch (IOException e1) { e1.printStackTrace(); } } inputArea.setText(null); file_btn.setVisible(false); file_btn.setText(""); sendWindow.setVisible(false); //filepath = ""; filename = ""; fileSize = 0; filePath = ""; d= 1; System.out.println("哈哈"+filepath); } else { System.out.println("wode.."); JOptionPane.showMessageDialog(null, "请输入内容或选择文件!", "注意", JOptionPane.INFORMATION_MESSAGE); } } }); } private void addRow(String userName,String hostGroup,String hostName,String Priority,String hostAddr, int hostPort) { DefaultTableModel model = (DefaultTableModel) table.getModel(); model.addRow(new Object[] { userName,hostGroup,hostName, Priority,hostAddr, hostPort }); } private void rmRow(String addr) { DefaultTableModel model = (DefaultTableModel) table.getModel(); for (int i = 0, j = table.getRowCount(); i < j; i++) { String taddr = model.getValueAt(i, 2).toString(); if (taddr.equals(addr)) { model.removeRow(i); break; } } } private List<Map<String, String>> getSelected() { int[] selectRows = table.getSelectedRows(); if (selectRows.length == 0) { return null; } List<Map<String, String>> selected = new ArrayList<Map<String, String>>(); DefaultTableModel model = (DefaultTableModel) table.getModel(); for (int i = 0; i < selectRows.length; i++) { String addr = model.getValueAt(selectRows[i], 3).toString(); port = Integer.parseInt(model.getValueAt(selectRows[i], 5).toString()); Map<String, String> map = new HashMap<String, String>(); map.put("addr", addr); map.put("port", port + ""); selected.add(map); } return selected; } public void setInpuArea(String str) { this.inputArea.setText(str); } public void setVisible(boolean b) { frame.setVisible(b); } private SendWindow() throws IOException { this.createWindow(); myName = System.getProperty("user.name"); udpService = new UDP(); ReceiveThread thread = new ReceiveThread(); thread.start(); udpService.broadcast("online#" + myName); count++; userCount.setText(count+""); frame.repaint(); // TCP.init(); } public static SendWindow getInstance() { // synchronized (lock1) { if (sendWindow == null) { try { sendWindow = new SendWindow(); } catch (IOException e) { e.printStackTrace(); } } return sendWindow; // } } class ReceiveThread extends Thread { @Override public void run() { try { while (true) { Map<String, String> recMap = udpService.receive(); if (recMap != null && recMap.size() > 0) { handlData(recMap); } } } catch (IOException e) { e.printStackTrace(); } } void handlData(Map<String, String> recMap) throws IOException { String data = recMap.get("data").trim(); String hostName = recMap.get("hostName"); String hostGroup = ""; String hostAddr = recMap.get("hostAddr"); String Priority = ""; int hostPort = Integer.parseInt(recMap.get("hostPort")); String[] dataArr = data.split("#"); if (dataArr[0].equals("online")) {// 收到上线消息后回复发消息给我的人 String userName = dataArr[1]; addRow(userName,hostGroup,hostName, Priority,hostAddr, hostPort); udpService.send(hostAddr, hostPort, "reply#" + dataArr[1]); return; } if (dataArr[0].equals("reply")) {// 更新在线table if(!hostAddr.equals(InetAddress.getLocalHost().getHostAddress())){ String userName = dataArr[1]; addRow(userName,hostGroup,hostName, Priority,hostAddr, hostPort); count++; userCount.setText(count+""); frame.repaint(); } return; } if (dataArr[0].equals("offline")) {// 下线消息,更新table rmRow(hostAddr); count--; userCount.setText(count+""); frame.repaint(); return; } if (dataArr[0].equals("msg")) {// 接收文本消息 ReceiveWindow receiveWindow = ReceiveWindow.createWindow(getInstance()); String msg = dataArr[2].equals("null") ? "":dataArr[2]; String file = dataArr[3].equals("null") ? "":dataArr[3]; System.out.println("hhfilename"+file); receiveWindow.showMsg(dataArr[1] + "/" + hostName, msg, file, hostAddr); //addFileWindow.showFile( filename,fileSize,filePath); return; } } } public static void main(String[] args) throws IOException { SendWindow sendWindow = SendWindow.getInstance(); } } 这是接收客户端,是端口选择的问题吗,我要怎么改呢T T package com.fastSendFile; import java.awt.GridLayout; import java.util.*; import java.net.*; import java.io.*; import javax.swing.*; public class Client implements Runnable { private Vector Vname=new Vector(); private InetAddress address; private Vector sendDir = new Vector(); private Vector fileVector = new Vector(); private long totalSize; private long fileSize; private String fileName; private long receivedSize; private long skipSize; SendWindow sendWindow; Client( Vector file , InetAddress address) { fileVector.addAll ( file ) ; this.address = address; } public void getFiles(File file,String lastDir ,String localPath) { if(file.isFile()) { totalSize += file.length(); sendDir.add (localPath); Vname.add(new String(lastDir + "/"+file.getName())); } else if(file.isDirectory()) { lastDir = lastDir + "/" + file.getName(); String strs[] = file.list(); for(int i = 0 ;i < strs.length; i ++) { File newfile = new File( file.getAbsolutePath() + "/" + strs[i] ); getFiles( newfile , lastDir , localPath ); } } } public void run() { totalSize = 0; String send = ""; try { byte[] buffer = new byte[1024]; Socket sendSocket = new Socket(address, 20); DataInputStream in = new DataInputStream(sendSocket.getInputStream()); BufferedOutputStream outb = new BufferedOutputStream(sendSocket.getOutputStream(),512); DataOutputStream out = new DataOutputStream(outb); ObjectOutputStream oout = new ObjectOutputStream (out); oout.writeObject ( fileVector ); oout.flush (); ObjectInputStream oin = new ObjectInputStream ( in ); Vector accVector = (Vector) oin.readObject (); if ( sendWindow.d ==1) JOptionPane.showMessageDialog(null, "消息已发送","提示",JOptionPane.DEFAULT_OPTION); for (int i = 0 ; i < accVector .size (); i ++) { File temp = (File) accVector.get ( i ); send += " " + temp.getName (); getFiles( temp ,"",temp.getParent ()); } //receive file out.writeLong(totalSize); out.flush(); int rSize; File tempFile; String tempString; long count ; JFrame frame = new JFrame(); frame.setTitle("正在发送文件"); JLabel lable1 = new JLabel(); JLabel lable2 = new JLabel(); JLabel lable3 = new JLabel(); frame.add( lable1,"North" ); frame.add( lable3,"South" ); receivedSize = 0; JProgressBar bar = new JProgressBar ( 0 , (int)(totalSize/1024)); JProgressBar bar1 = new JProgressBar (); bar.setForeground(new java.awt.Color(102, 255, 102)); bar.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)), "\u603b\u8fdb\u5ea6", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 13), new java.awt.Color(0, 0, 255))); bar.setDoubleBuffered(true); bar.setStringPainted ( true ) ; bar1.setSize (320,20); bar.setSize (320,20); bar1.setForeground(new java.awt.Color(102, 255, 102)); bar1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)), "当前进度", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 13), new java.awt.Color(0, 0, 255))); bar1.setDoubleBuffered(true); bar1.setStringPainted ( true ); JPanel jp = new JPanel(); jp.setLayout ( new GridLayout( 3 , 1 )); // jp.add ( new JLabel ("总进度: ")); jp.add ( bar ); // jp.add ( new JLabel( "当前进度: " )); jp.add ( bar1 ); jp.add ( lable2 ); frame.add ( jp ); String Lmessage1 = "总共要发送: "+String.valueOf( totalSize / 1024) + " KB"; String Lmessage2 = "速度: 0"; lable1.setText( Lmessage1 ); lable2.setText( Lmessage2 ); lable3.setText ( "共" + Vname.size () + "个文件,已完成" + 0 + "个"); RandomAccessFile inFile; frame.setBounds( 250 , 200 , 400 , 200); frame.setResizable ( false ); frame.setVisible(true); long baseTime = new Date().getTime(); for(int i = 0;i < Vname.size();i++) { count = 0; lable3.setText ( "共" + Vname.size () + "个文件,已完成" + i + "个"); bar1.setMinimum ( 0 ); tempString = ( String ) Vname.get(i); tempFile = new File( sendDir.get(i) + tempString); fileSize = tempFile.length(); jp.setToolTipText ( "正发送:" + tempString.substring ( 1 ) ); out.writeLong(fileSize); int locate = new Random().nextInt ( 1000 ); byte [] fileRandom = new byte [10]; if ( tempFile.length () < 1024 ) locate = -1 ; else fileRandom = getFile( locate,tempFile ); out.writeInt ( locate ); out.write ( fileRandom ); frame.setTitle ( "正发送文件:" + tempString.substring ( 1 ) ); bar1.setMaximum ( ( int )fileSize / 1024 ); bar1.setValue ( 0 ); byte data2[] = tempString.getBytes( "UTF-8" ); out.write(data2); out.flush(); skipSize = in.readLong(); rSize = in.read(buffer); String reBack = new String(buffer,0,rSize,"UTF-8"); if("S".equals(reBack)) { receivedSize += fileSize; count = fileSize; bar.setValue ( (int) receivedSize / 1024); bar1.setValue ((int) count / 1024); continue; } else { if("C".equals(reBack)) { receivedSize += skipSize; count = skipSize; bar.setValue ( ( int )receivedSize / 1024 ); bar1.setValue ( ( int )count /1024 ); inFile = new RandomAccessFile(tempFile, "r"); inFile.seek( skipSize ); } else { inFile=new RandomAccessFile(tempFile, "r"); } while((rSize = inFile.read(buffer)) != -1) { receivedSize += rSize; count += rSize; bar.setValue ( ( int )receivedSize / 1024 ); bar1.setValue ( ( int )count / 1024 ); lable2.setText("速度: "+ String.valueOf(receivedSize * 1000 / (new Date().getTime() - baseTime + 1) / 1024 )+" KB/s"); outb.write( buffer, 0 ,rSize ); } outb.flush(); inFile.close(); } } fileSize = -1; out.writeLong(fileSize); out.writeInt ( -1 ); out.write( new byte [10]); byte data3[] = "#发送完毕#".getBytes("UTF-8"); out.write(data3); out.flush(); frame.setVisible(false); JOptionPane.showMessageDialog(null, "发送完成!","提示", JOptionPane.DEFAULT_OPTION); in.close(); out.close(); sendSocket.close(); } catch(Exception e) { JOptionPane.showMessageDialog(null, "发送文件出错l:"+e,"错误", JOptionPane.ERROR_MESSAGE); } } public static byte [] getFile( int n , File file) { byte [] b = new byte [10]; try { RandomAccessFile rf = new RandomAccessFile(file,"r"); rf.seek ( n ); rf.read ( b, 0 ,b.length); rf.close (); } catch (Exception e) { } return b; } }
android连接电脑tomcat服务器报错 connection refused
在电脑上部署了tomcat的服务器,电脑ip地址是192.168.191.1,这是android应用里请求的url地址:String URL = "http://192.168.191.1:8080/system_web/server";通过 HttpResponse httpResponse=httpClient.execute(httpRequest);这种方法请求连接。 结果报错connection to 192.168.191.1 refused。我的手机连的是电脑的wifi,而且在手机的浏览器通过访问http://192.168.191.1:8080/system_web/server是可以的,就是android程序里面报错。到底是哪里的问题啊,弄了一下午了。
java 我执行一个非常简单的socket程序都出错!java.net.ConnectException: Connection refused:
<div class="iteye-blog-content-contain" style="font-size: 14px;"> <p>java  网络编程</p> <p> </p> <p>我执行一个非常简单的socket程序都出错!要崩溃了!我关闭了防火墙也不行,试了Ping 127.0.0.1是可以的,而且我查了这个端口也没有被占用,怎么解决?</p> <p>java.net.ConnectException: Connection refused: connect</p> <p>at java.net.DualStackPlainSocketImpl.connect0(Native Method)</p> <p>at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)</p> <p>at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)</p> <p>at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)</p> <p>at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)</p> <p>at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)</p> <p>at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)</p> <p>at java.net.Socket.connect(Socket.java:579)</p> <p>at java.net.Socket.connect(Socket.java:528)</p> <p>at java.net.Socket.&lt;init&gt;(Socket.java:425)</p> <p>at java.net.Socket.&lt;init&gt;(Socket.java:208)</p> <p>at com.hxw.socket.SimpleSocketClient.main(SimpleSocketClient.java:22)</p> <p>java.lang.NullPointerException</p> <p>at com.hxw.socket.SimpleSocketClient.main(SimpleSocketClient.java:37)</p> <p> </p> <p><span style="font-size: 24px;">源码在此:</span></p> <pre name="code" class="java">package com.hxw.socket; import java.io.*; import java.net.*; /** * 简单的Socket客户端 功能为:发送字符串“Hello”到服务器端,并打印出服务器端的反馈 */ public class SimpleSocketClient { public static void main(String[] args) { Socket socket = null; InputStream is = null; OutputStream os = null; // 服务器端IP地址 String serverIP = "127.0.0.1"; // 服务器端端口号 int port = 10002; // 发送内容 String data = "Hello"; try { // 建立连接 socket = new Socket(serverIP, port); // 发送数据 os = socket.getOutputStream(); os.write(data.getBytes()); // 接收数据 is = socket.getInputStream(); byte[] b = new byte[1024]; int n = is.read(b); // 输出反馈数据 System.out.println("服务器反馈:" + new String(b, 0, n)); } catch (Exception e) { e.printStackTrace(); // 打印异常信息 } finally { try { // 关闭流和连接 is.close(); os.close(); socket.close(); } catch (Exception e2) { e2.printStackTrace(); } } } } </pre> <p> </p> </div>
ngnix+fastcgi+python服务器每隔20几分钟就报connection refused
正在搭建一个fake server,要求每秒钟支持7000个并发。server采用nginx/fastcgi/flup搭建,用spawn-fastcgi来管理fastcgi进程,后台的应用程序很简单,就是返回固定的一串字符串,用python写的。用jmeter打流量测试,发现开始20几分钟server运行很好,后面就会有断断续续的error产生,刚开始以为是应用程序反映不过来,后来就将fastcgi进程加到200,可还是会有这样的情况发生。nginx的error.log: 2011/09/30 23:47:54 [error] 31160#0: *35 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: domain.com, request: "GET /dev/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "domain.com 搞了很久,还是没解决,求那位大神指点迷津,感激涕零!
FileZilla连接失败,connection refused
本人Linux小白,望轻喷 我用visualbox配置了一台Ubuntu16.04的虚拟机,今天想用FileZilla传一些文件给虚拟机,发现连接失败。 错误信息是: ``` 状态: 正在连接 192.168.3.5... 响应: fzSftp started, protocol_version=5 命令: open "jeloys@192.168.3.5" 22 错误: Network error: Connection refused 错误: 无法连接到服务器 ``` 然后尝试了网上所说的开启ssh 和 sshd 没有用,防火墙已经关闭,iptables也已经为ssh设置好了。然后在虚拟机上使用 ``` root@jeloys-VirtualBox:~# ssh 192.168.3.4 ``` 提示: ``` ssh: connect to host 192.168.3.4 port 22: Connection refused ``` 注:宿主ip为192.168.3.4;虚拟机IP为192.168.3.5;虚拟机网络为桥接模式。 求各位大佬答疑解惑~
jdbc连接远程的oracle数据库报错,Connection refused
通过jdbc连接远程的oracle数据库,报错连接被拒绝: java.sql.SQLRecoverableException: IO 错误: Connection refused at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546) at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at com.yzj.taf.Mytest.test(Mytest.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209) Caused by: oracle.net.ns.NetException: Connection refused at oracle.net.ns.NSProtocol.connect(NSProtocol.java:395) at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320) ... 30 more 写的测试代码如下: public void test() { Connection conn = null; Statement stmt = null; ResultSet rs = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@192.168.1.155:1521:orcl"; String dbUsername = "test"; String dbPassword = "test"; conn = DriverManager.getConnection(url, dbUsername, dbPassword); System.out.println("正常"); } catch (Exception e) { e.printStackTrace(); System.out.println("异常"); } finally { if (conn != null) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } } 用sqlDeverloper工具可以连接,但是写代码就不行,其他的电脑同样的开发工具和代码可以连接,求大神!!!!!
RMI异常,java.rmi.ConnectException: Connection refused to host
[code="java"] String name = "Compute"; HelloWorldCompute engine = new HelloWorldEngine(); HelloWorldCompute stub = (HelloWorldCompute) UnicastRemoteObject.exportObject(engine, 8888); Registry registry = LocateRegistry.getRegistry(); registry.rebind(name, stub);[/code] 执行最后一句,抛出异常 java.rmi.ConnectException: Connection refused to host: 10.200.1.184; nested exception is: java.net.ConnectException: Connection refused: connect 什么原因啊
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
阿里面试官问我:如何设计秒杀系统?我的回答让他比起大拇指
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图和个人联系方式,欢迎Star和指教 前言 Redis在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在Redis的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸,打败了...
C语言魔塔游戏
很早就很想写这个,今天终于写完了。 游戏截图: 编译环境: VS2017 游戏需要一些图片,如果有想要的或者对游戏有什么看法的可以加我的QQ 2985486630 讨论,如果暂时没有回应,可以在博客下方留言,到时候我会看到。 下面我来介绍一下游戏的主要功能和实现方式 首先是玩家的定义,使用结构体,这个名字是可以自己改变的 struct gamerole { char n...
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
Android性能优化(4):UI渲染机制以及优化
文章目录1. 渲染机制分析1.1 渲染机制1.2 卡顿现象1.3 内存抖动2. 渲染优化方式2.1 过度绘制优化2.1.1 Show GPU overdraw2.1.2 Profile GPU Rendering2.2 卡顿优化2.2.1 SysTrace2.2.2 TraceView 在从Android 6.0源码的角度剖析View的绘制原理一文中,我们了解到View的绘制流程有三个步骤,即m...
微服务中的Kafka与Micronaut
今天,我们将通过Apache Kafka主题构建一些彼此异步通信的微服务。我们使用Micronaut框架,它为与Kafka集成提供专门的库。让我们简要介绍一下示例系统的体系结构。我们有四个微型服务:订单服务,行程服务,司机服务和乘客服务。这些应用程序的实现非常简单。它们都有内存存储,并连接到同一个Kafka实例。 我们系统的主要目标是为客户安排行程。订单服务应用程序还充当网关。它接收来自客户的请求...
致 Python 初学者们!
作者| 许向武 责编 | 屠敏 出品 | CSDN 博客 前言 在 Python 进阶的过程中,相信很多同学应该大致上学习了很多 Python 的基础知识,也正在努力成长。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 Python 这门编程语言,从2009年开始单一使用 Python 应对所有的开发工作,直至今...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
字节跳动面试官这样问消息队列:分布式事务、重复消费、顺序消费,我整理了一下
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip installselenium -ihttps://pypi.tuna.tsinghua.edu.cn/simple/ ...
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
SpringBoot2.x系列教程(三十六)SpringBoot之Tomcat配置
Spring Boot默认内嵌的Tomcat为Servlet容器,关于Tomcat的所有属性都在ServerProperties配置类中。同时,也可以实现一些接口来自定义内嵌Servlet容器和内嵌Tomcat等的配置。 关于此配置,网络上有大量的资料,但都是基于SpringBoot1.5.x版本,并不适合当前最新版本。本文将带大家了解一下最新版本的使用。 ServerProperties的部分源...
Python绘图,圣诞树,花,爱心 | Turtle篇
每周每日,分享Python实战代码,入门资料,进阶资料,基础语法,爬虫,数据分析,web网站,机器学习,深度学习等等。 公众号回复【进群】沟通交流吧,QQ扫码进群学习吧 微信群 QQ群 1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle()...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o...
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ...... ...
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。 再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。 下文是原回答,希望能对你能有所启发。 如果我说,这个世界上人真的分三六九等,...
2020年全新Java学习路线图,含配套视频,学完即为中级Java程序员!!
新的一年来临,突如其来的疫情打破了平静的生活! 在家的你是否很无聊,如果无聊就来学习吧! 世上只有一种投资只赚不赔,那就是学习!!! 传智播客于2020年升级了Java学习线路图,硬核升级,免费放送! 学完你就是中级程序员,能更快一步找到工作! 一、Java基础 JavaSE基础是Java中级程序员的起点,是帮助你从小白到懂得编程的必经之路。 在Java基础板块中有6个子模块的学...
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合...
爬取薅羊毛网站百度云资源
这是疫情期间无聊做的爬虫, 去获取暂时用不上的教程 import threading import time import pandas as pd import requests import re from threading import Thread, Lock # import urllib.request as request # req=urllib.request.Requ...
如何优雅地打印一个Java对象?
你好呀,我是沉默王二,一个和黄家驹一样身高,和刘德华一样颜值的程序员。虽然已经写了十多年的 Java 代码,但仍然觉得自己是个菜鸟(请允许我惭愧一下)。 在一个月黑风高的夜晚,我思前想后,觉得再也不能这么蹉跎下去了。于是痛下决心,准备通过输出的方式倒逼输入,以此来修炼自己的内功,从而进阶成为一名真正意义上的大神。与此同时,希望这些文章能够帮助到更多的读者,让大家在学习的路上不再寂寞、空虚和冷。 ...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名...
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计...
HTML5适合的情人节礼物有纪念日期功能
前言 利用HTML5,css,js实现爱心树 以及 纪念日期的功能 网页有播放音乐功能 以及打字倾诉感情的画面,非常适合情人节送给女朋友 具体的HTML代码 具体只要修改代码里面的男某某和女某某 文字段也可自行修改,还有代码下半部分的JS代码需要修改一下起始日期 注意月份为0~11月 也就是月份需要减一。 当然只有一部分HTML和JS代码不够运行的,文章最下面还附加了完整代码的下载地址 &lt;!...
相关热词 c#如何定义数组列表 c#倒序读取txt文件 java代码生成c# c# tcp发送数据 c#解决时间格式带星期 c#类似hashmap c#设置istbox的值 c#获取多线程返回值 c# 包含数字 枚举 c# timespan
立即提问