调用Java接口InetAddress.getAllByName得到两种不同的结果 5C
  • 1. 我在java APP上创建一个下载线程,文件下载失败后重试,重试前,先调用接口InetAddress.getAllByName()。
  • 2. 把程序运行起来,然后断开网络,2分钟后,打开网络,发现下载线程中调用接口InetAddress.getAllByName()总是捕获到异常UnknownHostException。
  • 3. 我在我的程序里面添加一个循环不断地去调用接口InetAddress.getAllByName().
  • 4. 然后重复步骤2,发现最后两个线程都能正确获取到ip和host name.

运行环境: Centos7 OpenJDK1.8

2个回答

因为没有看到你的代码,没法知道你具体什么问题,但是这里有两个类似的问题,你参考下:
https://bbs.csdn.net/topics/390606776
https://stackoverflow.com/questions/43601656/inetaddress-getallbyname-throws-unknownhostexception
再有就是你的dns不稳定,设置为8.8.8.8或者你的ISP指定给你的dns试试看

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
JAVA中InetAddress.getByName("ip").getHostName();获取的主机名为什么多了后缀.lan?

运行结果如下,本地主机名是XXl,但获取的是XXL.lan;获取的ip地址无误 ![图片说明](https://img-ask.csdn.net/upload/201904/10/1554871828_774944.png) 这是代码: ``` package Pers.Pluto.Day26; import java.net.InetAddress; import java.net.UnknownHostException; public class InetAddressDemo { public static void main(String[] args) throws UnknownHostException { InetAddress address = null; //主机名或者ip地址 // address = InetAddress.getByName("XXL"); // address = InetAddress.getLocalHost(); address = InetAddress.getByName("192.168.1.136"); String name = address.getHostName(); //获取主机名 String hostAddress = address.getHostAddress(); //获取本地ip System.out.println("主机名:" + name + "\r\n" + "ip:" + hostAddress); } } ``` 运行结果如下,本地主机名是XXl,但获取的是XXL.lan ![图片说明](https://img-ask.csdn.net/upload/201904/10/1554871828_774944.png)

希望有个 java 牛人帮我解决

1、在 java 程序中如何让 String 中的字符串当作程序来运行 2、如何通过代码来让. java 文件编译成 class 字节码文件。 注 如果可以请附上代码,或者给出思路,小弟会十分感谢。 小弟初入此行半年,还没有c 币,希望大家支持下,谢谢

tomcat启动失败,提示存在内存泄露

警告: The web application [eservice] appears to have started a thread named [Thread-3] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Thread.sleep(Native Method) org.apache.log4j.helpers.FileWatchdog.run(FileWatchdog.java:104) 八月 14, 2017 9:42:08 上午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads 警告: The web application [eservice] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) java.net.InetAddress$1.lookupAllHostAddr(Unknown Source) java.net.InetAddress.getAddressesFromNameService(Unknown Source) java.net.InetAddress.getAllByName0(Unknown Source) java.net.InetAddress.getAllByName(Unknown Source) java.net.InetAddress.getAllByName(Unknown Source) java.net.InetAddress.getByName(Unknown Source) java.net.InetSocketAddress.<init>(Unknown Source) sun.net.NetworkClient.doConnect(Unknown Source) sun.net.www.http.HttpClient.openServer(Unknown Source) sun.net.www.http.HttpClient.openServer(Unknown Source) sun.net.www.http.HttpClient.<init>(Unknown Source) sun.net.www.http.HttpClient.New(Unknown Source) sun.net.www.http.HttpClient.New(Unknown Source) sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) org.quartz.utils.UpdateChecker.getUpdateProperties(UpdateChecker.java:99) org.quartz.utils.UpdateChecker.doCheck(UpdateChecker.java:56) org.quartz.utils.UpdateChecker.checkForUpdate(UpdateChecker.java:47) org.quartz.utils.UpdateChecker.run(UpdateChecker.java:39) java.util.TimerThread.mainLoop(Unknown Source) java.util.TimerThread.run(Unknown Source)

这个问题怎么解决,docker搭建kafka的wen'ti

首先说明这个错误的前提,我没有自己在虚拟机上搭建,因为华为送了服务器,我就直接在它的服务器上搭建了docker,弄了三个容器装了kafka,直接使用docker-compose搭建集群  映射的端口就是这样子,但是呢,在IDEA连接kafka集群的时候 首先连接IP:5000,5002,5004 再连接返回的host.name =kafka1,kafka2,kafka3 最后继续连接advertised.host.name=kafka1,kafka2,kafka3 这样的情况,如果是普通服务器还好,直接在本地hosts添加主机IP映射即可 但是这个容器就添加不了了,容器的IP地址是内网设定的,我们本地访问ip肯定访问不到了。 20/01/16 22:11:04 INFO AppInfoParser: Kafka version: 2.4.0 20/01/16 22:11:04 INFO AppInfoParser: Kafka commitId: 77a89fcf8d7fa018 20/01/16 22:11:04 INFO AppInfoParser: Kafka startTimeMs: 1579183864167 20/01/16 22:11:04 INFO KafkaConsumer: [Consumer clientId=consumer-groupid1-1, groupId=groupid1] Subscribed to topic(s): test, topicongbo 20/01/16 22:11:04 INFO Metadata: [Consumer clientId=consumer-groupid1-1, groupId=groupid1] Cluster ID: Kkwgy0gkSkmGAlsC_5cz9A 20/01/16 22:11:04 INFO AbstractCoordinator: [Consumer clientId=consumer-groupid1-1, groupId=groupid1] Discovered group coordinator kafka3:9092 (id: 2147483644 rack: null) 20/01/16 22:11:06 WARN NetworkClient: [Consumer clientId=consumer-groupid1-1, groupId=groupid1] Error connecting to node kafka3:9092 (id: 2147483644 rack: null) java.net.UnknownHostException: kafka3 at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929) at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324) at java.net.InetAddress.getAllByName0(InetAddress.java:1277) at java.net.InetAddress.getAllByName(InetAddress.java:1193) at java.net.InetAddress.getAllByName(InetAddress.java:1127) at org.apache.kafka.clients.ClientUtils.resolve(ClientUtils.java:104) at org.apache.kafka.clients.ClusterConnectionStates$NodeConnectionState.currentAddress(ClusterConnectionStates.java:403) at org.apache.kafka.clients.ClusterConnectionStates$NodeConnectionState.access$200(ClusterConnectionStates.java:363) at org.apache.kafka.clients.ClusterConnectionStates.currentAddress(ClusterConnectionStates.java:151) at org.apache.kafka.clients.NetworkClient.initiateConnect(NetworkClient.java:955) at org.apache.kafka.clients.NetworkClient.ready(NetworkClient.java:289) at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.tryConnect(ConsumerNetworkClient.java:572) at org.apache.kafka.clients.consumer.internals.AbstractCoordinator$FindCoordinatorResponseHandler.onSuccess(AbstractCoordinator.java:757) at org.apache.kafka.clients.consumer.internals.AbstractCoordinator$FindCoordinatorResponseHandler.onSuccess(AbstractCoordinator.java:737) at org.apache.kafka.clients.consumer.internals.RequestFuture$1.onSuccess(RequestFuture.java:204) at org.apache.kafka.clients.consumer.internals.RequestFuture.fireSuccess(RequestFuture.java:167) at org.apache.kafka.clients.consumer.internals.RequestFuture.complete(RequestFuture.java:127) at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient$RequestFutureCompletionHandler.fireCompletion(ConsumerNetworkClient.java:599) at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.firePendingCompletedRequests(ConsumerNetworkClient.java:409) at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:294) at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:233) at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:212) at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.ensureCoordinatorReady(AbstractCoordinator.java:230) at org.apache.kafka.clients.consumer.internals.ConsumerCoordinator.poll(ConsumerCoordinator.java:444) at org.apache.kafka.clients.consumer.KafkaConsumer.updateAssignmentMetadataIfNeeded(KafkaConsumer.java:1267) at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1235) at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1168) at org.apache.spark.streaming.kafka010.DirectKafkaInputDStream.paranoidPoll(DirectKafkaInputDStream.scala:172) at org.apache.spark.streaming.kafka010.DirectKafkaInputDStream.start(DirectKafkaInputDStream.scala:260) at org.apache.spark.streaming.DStreamGraph.$anonfun$start$7(DStreamGraph.scala:54) at org.apache.spark.streaming.DStreamGraph.$anonfun$start$7$adapted(DStreamGraph.scala:54) at scala.collection.parallel.mutable.ParArray$ParArrayIterator.foreach(ParArray.scala:145) at scala.collection.parallel.ParIterableLike$Foreach.leaf(ParIterableLike.scala:974) at scala.collection.parallel.Task.$anonfun$tryLeaf$1(Tasks.scala:53) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at scala.util.control.Breaks$$anon$1.catchBreak(Breaks.scala:67) at scala.collection.parallel.Task.tryLeaf(Tasks.scala:56) at scala.collection.parallel.Task.tryLeaf$(Tasks.scala:50) at scala.collection.parallel.ParIterableLike$Foreach.tryLeaf(ParIterableLike.scala:971) at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute(Tasks.scala:153) at scala.collection.parallel.AdaptiveWorkStealingTasks$WrappedTask.compute$(Tasks.scala:149) at scala.collection.parallel.AdaptiveWorkStealingForkJoinTasks$WrappedTask.compute(Tasks.scala:440) at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) 那么这个错误怎么解决的呢,而且华为的安全组我没有权限修改,只能5000-5010的端口对外开方

安卓下载图片,多线程下载就会报错,有人知道怎么解决么?

android.os.NetworkOnMainThreadException at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117) at java.net.InetAddress.lookupHostByName(InetAddress.java:385) at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) at java.net.InetAddress.getAllByName(InetAddress.java:214) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137) at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)

mysql和jsp连接问题,500错误

jsp连接数据库制作一个商品网站,登录界面输入账号密码登录500错误,每一个连接数据库的界面都是500,求大佬解答,就是下面这个c'w 登录反馈结果 com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.UnknownHostException MESSAGE: local STACKTRACE: java.net.UnknownHostException: local at java.net.InetAddress.getAllByName0(InetAddress.java:1157) at java.net.InetAddress.getAllByName(InetAddress.java:1083) at java.net.InetAddress.getAllByName(InetAddress.java:1019) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:246) at com.mysql.jdbc.MysqlIO.(MysqlIO.java:271) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771) at com.mysql.jdbc.Connection.(Connection.java:1555) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:207) at myservlet.control.HandleLogin.doPost(HandleLogin.java:40) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) ** END NESTED EXCEPTION ** Last packet sent to the server was 0 ms ago.

急!!本机项目访问linux下的mysql 一直报错

31-Oct-2017 19:41:43.520 严重 [Druid-ConnectionPool-Create-1019023074] com.alibaba.druid.pool.DruidDataSource.error create connection error, url: jdbc:mysql://zhang:3306/test?useSSL=false&autoReconnect=true&failOverReadOnly=false, errorCode 0, state 08001 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. at sun.reflect.GeneratedConstructorAccessor19.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) at com.mysql.jdbc.Util.getInstance(Util.java:387) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:917) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:896) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:885) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860) at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2165) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2090) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44) at sun.reflect.GeneratedConstructorAccessor17.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1464) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1529) at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2178) Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.GeneratedConstructorAccessor15.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:981) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:339) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253) at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2106) ... 12 more Caused by: java.net.UnknownHostException: zhang at java.net.InetAddress.getAllByName0(InetAddress.java:1280) at java.net.InetAddress.getAllByName(InetAddress.java:1192) at java.net.InetAddress.getAllByName(InetAddress.java:1126) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:188) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:298) ... 14 more

在Android上,怎么检查网络访问? InetAddress类也没有超时。

我用AsyncTask来检查连接到主机的网络。但是doInBackground从来都没有超时。有人知道为什么? public class HostAvailabilityTask extends AsyncTask<String, Void, Boolean>{ private Main main; public HostAvailabilityTask(Main main){ this.main = main; } protected Boolean doInBackground(String... params) { Main.Log("doInBackground() isHostAvailable():"+params[0]); try { return InetAddress.getByName(params[0]).isReachable(30); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return false; } protected void onPostExecute(Boolean... result) { Main.Log("onPostExecute()"); if(result[0] == false){ main.setContentView(R.layout.splash); return; } main.continueAfterHostCheck(); } }

OkHttp无法访问http://baidu.com

提示出错 st W/System.err: java.net.UnknownHostException: Unable to resolve host "baidu.com": No address associated with hostname 03-28 14:35:14.118 14410-14439/com.example.administrator.test W/System.err: at java.net.InetAddress.lookupHostByName(InetAddress.java:479) 03-28 14:35:14.118 14410-14439/com.example.administrator.test W/System.err: at java.net.InetAddress.getAllByNameImpl(InetAddress.java:259) 03-28 14:35:14.118 14410-14439/com.example.administrator.test W/System.err: at java.net.InetAddress.getAllByName(InetAddress.java:221) 03-28 14:35:14.118 14410-14439/com.example.administrator.test W/System.err: at com.android.okhttp.HostResolver$1.getAllByName(HostResolver.java:29) 03-28 14:35:14.118 14410-14439/com.example.administrator.test W/System.err: at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:232) 03-28 14:35:14.118 14410-14439/com.example.administrator.test W/System.err: at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:124) 03-28 14:35:14.118 14410-14439/com.example.administrator.test W/System.err: at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:278) 03-28 14:35:14.118 14410-14439/com.example.administrator.test W/System.err: at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:216) 03-28 14:35:14.118 14410-14439/com.example.administrator.test W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:392) 03-28 14:35:14.118 14410-14439/com.example.administrator.test W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:342) 03-28 14:35:14.118 14410-14439/com.example.administrator.test W/System.err: at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:520)

JSP对数据库进行信息添加及关键字查询出现错误,怎么解决

org.apache.jasper.JasperException: An exception occurred processing JSP page /emp_list.jsp at line 18 15: if(keyWord==null){ 16: keyWord=""; 17: } 18: List<Emp> all=DAOFactory.getIEmpDAOInstance().findAll(keyWord); 19: Iterator<Emp> iter=all.iterator(); 20: %> 21: <center> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause javax.servlet.ServletException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:916) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:845) org.apache.jsp.emp_005flist_jsp._jspService(emp_005flist_jsp.java:141) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:525) com.mysql.jdbc.Util.handleNewInstance(Util.java:409) com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118) com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:343) com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2308) com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122) com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774) com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49) sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:525) com.mysql.jdbc.Util.handleNewInstance(Util.java:409) com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:375) com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289) java.sql.DriverManager.getConnection(DriverManager.java:579) java.sql.DriverManager.getConnection(DriverManager.java:221) com.wgh.dbc.DatabaseConnection.<init>(DatabaseConnection.java:13) com.wgh.dao.proxy.EmpDAOProxy.<init>(EmpDAOProxy.java:13) com.wgh.factory.DAOFactory.getIEmpDAOInstance(DAOFactory.java:7) org.apache.jsp.emp_005flist_jsp._jspService(emp_005flist_jsp.java:82) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.net.UnknownHostException: locahost java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866) java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258) java.net.InetAddress.getAllByName0(InetAddress.java:1211) java.net.InetAddress.getAllByName(InetAddress.java:1127) java.net.InetAddress.getAllByName(InetAddress.java:1063) com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:246) com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:292) com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2308) com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122) com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774) com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49) sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:525) com.mysql.jdbc.Util.handleNewInstance(Util.java:409) com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:375) com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289) java.sql.DriverManager.getConnection(DriverManager.java:579) java.sql.DriverManager.getConnection(DriverManager.java:221) com.wgh.dbc.DatabaseConnection.<init>(DatabaseConnection.java:13) com.wgh.dao.proxy.EmpDAOProxy.<init>(EmpDAOProxy.java:13) com.wgh.factory.DAOFactory.getIEmpDAOInstance(DAOFactory.java:7) org.apache.jsp.emp_005flist_jsp._jspService(emp_005flist_jsp.java:82) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.57 logs.

linux服务器下的matlabpool问题

>> matlabpool local 4 Starting matlabpool using the 'local' profile ... Error using matlabpool (line 137) Java exception occurred: java.net.UnknownHostException: ic-m2.localdomain: ic-m2.localdomain: Name or service not known at java.net.InetAddress.getLocalHost(Unknown Source) Caused by: java.net.UnknownHostException: ic-m2.localdomain: Name or service not known at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$1.lookupAllHostAddr(Unknown Source) at java.net.InetAddress.getAddressesFromNameService(Unknown Source) ... 1 more

Android studio开发小白,登录注册在手机上运行停止,求大神指教

部分logcat如下,取部分红色代码 11-28 20:34:22.972 4563-4563/? E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.dell.login, PID: 4563 java.lang.SecurityException: Permission denied (missing INTERNET permission?) at java.net.InetAddress.lookupHostByName(InetAddress.java:418) at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236) at java.net.InetAddress.getAllByName(InetAddress.java:214) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137) at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:362) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:560) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:490) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:468) at com.example.dell.login.MainActivity$4.onClick(MainActivity.java:116) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18473) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5120) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) at dalvik.system.NativeStart.main(Native Method) Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname) at libcore.io.Posix.getaddrinfo(Native Method) at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:61) at java.net.InetAddress.lookupHostByName(InetAddress.java:405)             at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)             at java.net.InetAddress.getAllByName(InetAddress.java:214)             at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)             at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)             at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)             at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:362)             at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:560)             at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:490)             at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:468)             at com.example.dell.login.MainActivity$4.onClick(MainActivity.java:116)             at android.view.View.performClick(View.java:4438)             at android.view.View$PerformClick.run(View.java:18473)             at android.os.Handler.handleCallback(Handler.java:733)             at android.os.Handler.dispatchMessage(Handler.java:95)             at android.os.Looper.loop(Looper.java:136)             at android.app.ActivityThread.main(ActivityThread.java:5120)             at java.lang.reflect.Method.invokeNative(Native Method)             at java.lang.reflect.Method.invoke(Method.java:515)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)             at dalvik.system.NativeStart.main(Native Method) Caused by: libcore.io.ErrnoException: getaddrinfo failed: EACCES (Permission denied)             at libcore.io.Posix.getaddrinfo(Native Method)             at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:61)             at java.net.InetAddress.lookupHostByName(InetAddress.java:405)             at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)             at java.net.InetAddress.getAllByName(InetAddress.java:214)             at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)             at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)             at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)             at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:362)             at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:560)             at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:490)             at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:468)             at com.example.dell.login.MainActivity$4.onClick(MainActivity.java:116)             at android.view.View.performClick(View.java:4438)             at android.view.View$PerformClick.run(View.java:18473)             at android.os.Handler.handleCallback(Handler.java:733)             at android.os.Handler.dispatchMessage(Handler.java:95)             at android.os.Looper.loop(Looper.java:136)             at android.app.ActivityThread.main(ActivityThread.java:5120)             at java.lang.reflect.Method.invokeNative(Native Method)             at java.lang.reflect.Method.invoke(Method.java:515)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)             at dalvik.system.NativeStart.main(Native Method) 11-28 21:40:43.932 19809-19809/? E/Parcel﹕ Reading a NULL string not supported here. 11-28 21:40:43.942 19809-19809/? E/Parcel﹕ Reading a NULL string not supported here. 11-28 21:40:43.942 19796-19796/? E/Parcel﹕ Reading a NULL string not supported here. 11-28 21:40:43.942 19809-19809/? D/ActivityThread﹕ handleBindApplication:com.youdao.di

java代码运行出现错误“Address already in use: Cannot bind”

这是数据接受端代码: import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.SocketException; public class ReceiveUDP { public static void main(String[] args) throws IOException { //定义Socket,并开放一个端口,用来接受数据 int port=10000; DatagramSocket ds = new DatagramSocket(port); //定义一个数据缓冲池,用来存放接收到的数据 byte bytes[] = new byte[1024]; DatagramPacket dp = new DatagramPacket(bytes,bytes.length); //用Receive方法将接收的内容放入数据缓冲池 ds.receive(dp); System.out.println(dp.getPort()+":"); System.out.println(new String(dp.getData())); ds.close(); } } 这是发送数据端代码: import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.SocketException; import java.net.UnknownHostException; public class UDPSend { public static void main(String[] args) throws IOException { DatagramSocket ds = new DatagramSocket(10000,InetAddress.getByName("127.0.0.1")); byte bytes[] = "hello,UDP".getBytes(); DatagramPacket dp = new DatagramPacket(bytes,bytes.length); //发送数据 ds.send(dp); System.out.println("sent!"); ds.close(); } } 运行后出现问题: Exception in thread "main" java.net.BindException: Address already in use: Cannot bind at java.net.DualStackPlainDatagramSocketImpl.socketBind(Native Method) at java.net.DualStackPlainDatagramSocketImpl.bind0(Unknown Source) at java.net.AbstractPlainDatagramSocketImpl.bind(Unknown Source) at java.net.DatagramSocket.bind(Unknown Source) at java.net.DatagramSocket.<init>(Unknown Source) at java.net.DatagramSocket.<init>(Unknown Source) at UDPSend.main(UDPSend.java:11) 请各位大神帮忙看看是什么问题,怎么解决?

rocketMQ4.2.0控制台 启动报错

ERROR Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'monitorServiceImpl': Invocation of init method failed; nested exception is java.lang.ExceptionInInitializerError at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:137) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1581) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:554) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) at org.apache.rocketmq.console.App.main(App.java:28) 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.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) Caused by: java.lang.ExceptionInInitializerError: null at org.apache.rocketmq.console.service.impl.MonitorServiceImpl.loadData(MonitorServiceImpl.java:90) 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.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:366) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:311) at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:134) ... 26 common frames omitted Caused by: java.lang.RuntimeException: InetAddress java.net.InetAddress.getLocalHost() throws UnknownHostException See http://rocketmq.apache.org/docs/faq/ for further details. at org.apache.rocketmq.common.MixAll.localhost(MixAll.java:405) at org.apache.rocketmq.common.MixAll.<clinit>(MixAll.java:79) ... 34 common frames omitted Caused by: java.net.UnknownHostException: bogon: bogon: 未知的名称或服务 at java.net.InetAddress.getLocalHost(InetAddress.java:1506) at org.apache.rocketmq.common.MixAll.localhost(MixAll.java:402) ... 35 common frames omitted Caused by: java.net.UnknownHostException: bogon: 未知的名称或服务 at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929) at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324) at java.net.InetAddress.getLocalHost(InetAddress.java:1501) ... 36 common frames omitted

Docker 中java程序对外请求,报错:Root Cause exception : java.net.UnknownHostException

1、在虚拟机中centos7 系统中,安装了Docker环境,想实现在docker中运行 “java -jar test.jar”,其中test.jar的main函数中会对外发起http请求,url=“http://plm.xxx.com:9091/xxx”,初始启动运行镜像文件就报错: ``` java.net.UnknownHostException: PLM at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901 ``` 2、我配置的dockfile 文件为: ``` From centos MAINTAINER liubin ADD test.jar test.jar ADD jdk-7u80-linux-x64.tar.gz /home/jdk/ ENV JAVA_HOME /home/jdk/jdk1.7.0_80 ENV PATH $JAVA_HOME/bin:$PATH ENV CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar ENTRYPOINT ["java","-jar","test.jar"] ``` 3、直接尝试在centos环境中运行java -jar test.jar不会报异常,我的/etc/hosts文件中配置了PLM相关地址 ``` 127.0.0.1 node1 localhost ::1 node1 localhost 192.168.2.18 plm.xxx.com plmapp PLM #与请求地址相关的域名 192.168.2.113 ode1 192.168.2.128 AAASPLMIFS ``` 4、我的问题是docker 中运行java程序报这个UnknownHostException,是不是需要在Dockerfile中配置其它内容。 不好意思,最近没有积分呀、

rpm安装jenkins启动后报错 UnknownHostException: centos68-192-168-18-4: Name or service not known

1. jenkins 版本 jenkins-2.164.1-1.1.noarch.rpm 2. rpm安装方式安装成功后通过service jenkins start启动报错 3. hostname和/etc/hosts都已修改centos68 ``` [root@centos68 work]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 centos68 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 127.0.0.1 centos68 127.0.0.1 centos68-192-168-18-4 192.168.18.4 centos68 ``` 4. 错误: ``` [root@centos68 jenkins]# tail -200f /var/log/jenkins/jenkins.log Running from: /usr/lib/jenkins/jenkins.war webroot: $user.home/.jenkins Mar 26, 2019 2:58:18 PM org.eclipse.jetty.util.log.Log initialized INFO: Logging initialized @428ms to org.eclipse.jetty.util.log.JavaUtilLog Mar 26, 2019 2:58:18 PM winstone.Logger logInternal INFO: Beginning extraction from war file Mar 26, 2019 2:58:18 PM org.eclipse.jetty.server.Server doStart INFO: jetty-9.4.z-SNAPSHOT; built: 2018-08-30T13:59:14.071Z; git: 27208684755d94a92186989f695db2d7b21ebc51; jvm 11.0.1+13-LTS Mar 26, 2019 2:58:18 PM org.eclipse.jetty.webapp.StandardDescriptorProcessor visitServlet INFO: NO JSP Support for /jenkins, did not find org.eclipse.jetty.jsp.JettyJspServlet Mar 26, 2019 2:58:18 PM org.eclipse.jetty.server.session.DefaultSessionIdManager doStart INFO: DefaultSessionIdManager workerName=node0 Mar 26, 2019 2:58:18 PM org.eclipse.jetty.server.session.DefaultSessionIdManager doStart INFO: No SessionScavenger set, using defaults Mar 26, 2019 2:58:18 PM org.eclipse.jetty.server.session.HouseKeeper startScavenging INFO: node0 Scavenging every 660000ms WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/root/.jenkins/war/WEB-INF/lib/xstream-1.4.7-jenkins-1.jar) to field java.util.TreeMap.comparator WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins Mar 26, 2019 2:58:19 PM org.eclipse.jetty.server.handler.ContextHandler doStart INFO: Started w.@66b72664{Jenkins v2.164.1,/jenkins,file:///root/.jenkins/war/,AVAILABLE}{/root/.jenkins/war} Mar 26, 2019 2:58:19 PM org.eclipse.jetty.server.AbstractConnector doStart INFO: Started ServerConnector@76b0ae1b{HTTP/1.1,[http/1.1]}{0.0.0.0:2155} Mar 26, 2019 2:58:19 PM org.eclipse.jetty.server.Server doStart INFO: Started @1369ms Mar 26, 2019 2:58:19 PM winstone.Logger logInternal INFO: Winstone Servlet Engine v4.0 running: controlPort=disabled Mar 26, 2019 2:58:19 PM jenkins.InitReactorRunner$1 onAttained INFO: Started initialization Mar 26, 2019 2:58:19 PM hudson.PluginManager loadDetachedPlugins INFO: Upgrading Jenkins. The last running version was 2.150.1. This Jenkins is version 2.164.1. Mar 26, 2019 2:58:19 PM hudson.PluginManager loadDetachedPlugins INFO: Upgraded Jenkins from version 2.150.1 to version 2.164.1. Loaded detached plugins (and dependencies): [jaxb.hpi] Mar 26, 2019 2:58:19 PM jenkins.InitReactorRunner$1 onAttained INFO: Listed all plugins Mar 26, 2019 2:58:20 PM jenkins.InitReactorRunner$1 onAttained INFO: Prepared all plugins Mar 26, 2019 2:58:20 PM jenkins.InitReactorRunner$1 onAttained INFO: Started all plugins Mar 26, 2019 2:58:20 PM jenkins.InitReactorRunner$1 onAttained INFO: Augmented all extensions Mar 26, 2019 2:58:20 PM jenkins.InitReactorRunner$1 onAttained INFO: Loaded all jobs Mar 26, 2019 2:58:20 PM hudson.model.AsyncPeriodicWork$1 run INFO: Started Download metadata Mar 26, 2019 2:58:20 PM hudson.model.AsyncPeriodicWork$1 run INFO: Finished Download metadata. 3 ms Mar 26, 2019 2:58:21 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@3bf691fa: display name [Root WebApplicationContext]; startup date [Tue Mar 26 14:58:21 CST 2019]; root of context hierarchy Mar 26, 2019 2:58:21 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@3bf691fa]: org.springframework.beans.factory.support.DefaultListableBeanFactory@6a2e76fa Mar 26, 2019 2:58:21 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6a2e76fa: defining beans [authenticationManager]; root of factory hierarchy Mar 26, 2019 2:58:21 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@101e1204: display name [Root WebApplicationContext]; startup date [Tue Mar 26 14:58:21 CST 2019]; root of context hierarchy Mar 26, 2019 2:58:21 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@101e1204]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1a7623e2 Mar 26, 2019 2:58:21 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1a7623e2: defining beans [filter,legacy]; root of factory hierarchy Mar 26, 2019 2:58:21 PM jenkins.InitReactorRunner$1 onAttained INFO: Completed initialization Mar 26, 2019 2:58:21 PM hudson.WebAppMain$3 run INFO: Jenkins is fully up and running Mar 26, 2019 2:58:21 PM javax.jmdns.impl.HostInfo newHostInfo WARNING: Could not intialize the host network interface on nullbecause of an error: centos68-192-168-18-4: centos68-192-168-18-4: Name or service not known java.net.UnknownHostException: centos68-192-168-18-4: centos68-192-168-18-4: Name or service not known at java.base/java.net.InetAddress.getLocalHost(InetAddress.java:1642) at javax.jmdns.impl.HostInfo.newHostInfo(HostInfo.java:75) at javax.jmdns.impl.JmDNSImpl.<init>(JmDNSImpl.java:407) at javax.jmdns.JmDNS.create(JmDNS.java:60) at hudson.DNSMultiCast$1.call(DNSMultiCast.java:33) at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46) at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.net.UnknownHostException: centos68-192-168-18-4: Name or service not known at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929) at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1515) at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848) at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1505) at java.base/java.net.InetAddress.getLocalHost(InetAddress.java:1637) ... 10 more ```

请教一个java awt 显示的问题

自己想要的是(图一)这种效果的。运行时有时是(图一)有时是(图二)的样子 ,概率都到50%,自己看不出那儿错了 ,代码在下面。希望谁给我指点下啊。 ![图片说明](https://img-ask.csdn.net/upload/201709/01/1504229533_280256.jpg) (图一) ![图片说明](https://img-ask.csdn.net/upload/201709/01/1504229549_61503.jpg) (图二) 代码在下面: 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 import java.awt.BorderLayout; import java.awt.Button; import java.awt.Color; import java.awt.Font; import java.awt.Frame; import java.awt.Panel; import java.awt.TextArea; import java.awt.TextField; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.text.SimpleDateFormat; import java.util.Date; public class Send_Receive { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub Windows_chat wc = new Windows_chat(); wc.winChat(); wc.southPanel(); wc.centerPanel(); wc.WindowsExit(); wc.sendButton(); } } class Windows_chat extends Frame { private Button send; private Button log; private Button shake; private Button clear; private TextArea viewText; private TextArea sendText; private TextField tf; public void winChat() { setLocation(500, 50 ); setSize(400, 600); setVisible(true); } public void pannel() { } public void southPanel() { Panel south = new Panel(); //创建南边的Panel tf = new TextField(15); tf.setText("127.0.0.1"); send = new Button("发 送"); log = new Button("记 录"); clear = new Button("清 屏"); shake = new Button("震 动"); south.add(tf); south.add(send); south.add(log); south.add(clear); south.add(shake); this.add(south,BorderLayout.SOUTH); //将Panel放在Frame的南边 } public void centerPanel() { Panel center = new Panel(); //创建中间的Panel viewText = new TextArea(); sendText = new TextArea(5,1); center.setLayout(new BorderLayout()); //设置为边界布局管理器 center.add(sendText,BorderLayout.SOUTH); //发送的文本区域放在南边 center.add(viewText,BorderLayout.CENTER); //显示区域放在中间 viewText.setEditable(false); //设置不可以编辑 viewText.setBackground(Color.WHITE); //设置背景颜色 sendText.setFont(new Font("xxx", Font.PLAIN, 15)); viewText.setFont(new Font("xxx", Font.PLAIN, 15)); this.add(center,BorderLayout.CENTER); } public void WindowsExit() { this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } public void sendButton() { send.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub try { sendwindow(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); } public void sendwindow() throws IOException { String message = sendText.getText(); String ip = tf.getText(); DatagramSocket socket = new DatagramSocket(); DatagramPacket packet = new DatagramPacket(message.getBytes(),message.getBytes().length,InetAddress.getByName(ip),9999); String time = getCurrentTime(); String view = time + " 我对:" + (ip.equals("255.255.255.255") ? "所有人" : ip) + "说\r\n" + message + "\r\n\r\n";; viewText.append(view); } private String getCurrentTime() { // TODO Auto-generated method stub Date d = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss"); return sdf.format(d); } }

java.net.UnknownHostException: hostname

用jsp连接mysql数据库时出现了这样的错误,怎么解决? com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.UnknownHostException MESSAGE: hostname STACKTRACE: java.net.UnknownHostException: hostname

从activity中下载文件的错误

我使用http连接从web站点下载一个图像,如果下载是在服务器中执行就没有问题,如果我在一个activity中使用相同的方法下载文件就有下面的错误: 08-08 13:27:36.800: W/System.err(8010): android.os.NetworkOnMainThreadException 08-08 13:27:36.800: W/System.err(8010): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1077) 08-08 13:27:36.800: W/System.err(8010): at java.net.InetAddress.lookupHostByName(InetAddress.java:477) 08-08 13:27:36.800: W/System.err(8010): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:277) 08-08 13:27:36.800: W/System.err(8010): at java.net.InetAddress.getAllByName(InetAddress.java:249) 08-08 13:27:36.800: W/System.err(8010): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:69) 08-08 13:27:36.800: W/System.err(8010): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:48) 08-08 13:27:36.800: W/System.err(8010): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:304) 08-08 13:27:36.800: W/System.err(8010): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89) 08-08 13:27:36.800: W/System.err(8010): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:292) 08-08 13:27:36.800: W/System.err(8010): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:274) 08-08 13:27:36.800: W/System.err(8010): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.retrieveResponse(HttpURLConnectionImpl.java:1038) 08-08 13:27:36.800: W/System.err(8010): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:481) 08-08 13:27:36.800: W/System.err(8010): at java.net.URLConnection.getHeaderFieldInt(URLConnection.java:572) 08-08 13:27:36.800: W/System.err(8010): at java.net.URLConnection.getContentLength(URLConnection.java:335) 我用的下面的方法调用下载方法: new Thread(new Runnable() { public void run() { downloadFile(imagePath); } }).start();

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

点沙成金:英特尔芯片制造全过程揭密

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

一文带你入门Java Stream流,太强了

两个星期以前,就有读者强烈要求我写一篇 Java Stream 流的文章,我说市面上不是已经有很多了吗,结果你猜他怎么说:“就想看你写的啊!”你看你看,多么苍白的喜欢啊。那就“勉为其难”写一篇吧,嘻嘻。 单从“Stream”这个单词上来看,它似乎和 java.io 包下的 InputStream 和 OutputStream 有些关系。实际上呢,没毛关系。Java 8 新增的 Stream 是为...

立即提问
相关内容推荐