爬虫在执行EntityUtils.toString时报socket的问题 5C

如题
在高并发前提下执行爬虫任务,在日志中有大量的SocketTimeoutException异常出现,定位是html = EntityUtils.toString(response.getEntity(), charset);这句报错,异常如下:
2018-01-12 10:00:21 ERROR com.prnasia.util.http.StringUtil.getEntityAccordChar(StringUtil.java:83) - 网页转换编码出现问题,出现问题的url是:http://www.hotelschools.cn/zhuanke/shanghai/149.html出现的错误原因是:
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
at org.apache.http.impl.io.SessionInputBufferImpl.read(SessionInputBufferImpl.java:198)
at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:176)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.Reader.read(Reader.java:140)
at org.apache.http.util.EntityUtils.toString(EntityUtils.java:225)
at org.apache.http.util.EntityUtils.toString(EntityUtils.java:268)
at com.prnasia.util.http.StringUtil.getEntityAccordChar(StringUtil.java:66)
at com.prnasia.spider.basic.BasicCrawl.getEntity(BasicCrawl.java:45)
at com.prnasia.spider.pageUrl.PageUrl.getPageUrlByXpath(PageUrl.java:45)
at com.prnasia.task.consumer.TaskConsumerThread.run(TaskConsumerThread.java:51)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
网页是可以正常访问的,但是程序运行时会有很多类似异常抛出,求各位大神答疑解惑。

2个回答

爬虫高并发? 要么是你把人家的服务器给抓死了, 要么是触发防火墙规则人家把你给墙了, 不能这么干啊

访问太频繁ip被封了吧

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
EntityUtils.toString问题
List AddressInfo = new ArrayList ();rn HttpResponse response = HTTPUtils.getRawHtml(client, url);rn int StatusCode = response.getStatusLine().getStatusCode();rn rn if (StatusCode == 200) rn System.out.println(response.getEntity());rn String entity = EntityUtils.toString(response.getEntity(), "utf-8");rn System.out.println(response.getEntity());rn GzipDecompressingEntity zipRes = new GzipDecompressingEntity(rn response.getEntity());rn String s = EntityUtils.toString(zipRes, "gb2312");rn AddressInfo = SouFangAddressParser.getdata(s);rn EntityUtils.consume(response.getEntity());rn else rn EntityUtils.consume(response.getEntity());rn rn为什么我上面能打印出来response.getEntity()值,用了EntityUtils.toString方法后,下面就无法打印出值了呢?并且entity也打印不出来值,且会报错
EntityUtils.tostring 中文乱码
HttpEntity entity = httpResponse.getEntity();rn rnString stringResult = new String(EntityUtils.toString(entity, "utf-8"));rnrn请求后返回的内容中,中文显示为“?”rn后来,改为“gbk”,"gb2312",仍然是乱码rn rn求大神们指点!rn
EntityUtils.toString(httpEntity)的值读取不出来
[code=java]package com.example.master.mynews.service;rnrnimport android.util.Log;rnrnimport com.example.master.mynews.model.Parameter;rnrnimport org.apache.http.HttpResponse;rnimport org.apache.http.HttpStatus;rnimport org.apache.http.client.HttpClient;rnimport org.apache.http.client.entity.UrlEncodedFormEntity;rnimport org.apache.http.client.methods.HttpGet;rnimport org.apache.http.client.methods.HttpPost;rnimport org.apache.http.impl.client.DefaultHttpClient;rnimport org.apache.http.message.BasicNameValuePair;rnimport org.apache.http.params.BasicHttpParams;rnimport org.apache.http.params.HttpConnectionParams;rnimport org.apache.http.params.HttpParams;rnimport org.apache.http.protocol.HTTP;rnimport org.apache.http.util.EntityUtils;rnrnimport java.io.IOException;rnimport java.util.ArrayList;rnimport java.util.List;rnrn/**rn *以同步方式发送Http请求rn */rnpublic class SyncHttp rn /**rn * 通过GET方式发送请求rn * @param url URL地址rn * @param params 参数rn * @returnrn * @throws Exceptionrn */rn public volatile String response = "return"; //返回信息rn public String urlCom;rnrn public String httpGet(final String url, String params) throws Exceptionrn rnrn //拼接请求URLrn if (null!=params&&!params.equals(""))rn rn urlCom =url+ "?" + params;rn rnrn int timeoutConnection = 3000;rn int timeoutSocket = 5000;rn HttpParams httpParameters = new BasicHttpParams();// Set the timeout in milliseconds until a connection is established.rn HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);// Set the default socket timeout (SO_TIMEOUT) // in milliseconds which is the timeout for waiting for data.rn HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);rnrn // 构造HttpClient的实例rn final HttpClient httpClient = new DefaultHttpClient(httpParameters);rnrn // 创建GET方法的实例rn new Thread(new Runnable() rn public void run() rn HttpGet httpGet = new HttpGet(urlCom);rn HttpResponse httpResponse = null;rn try rn httpResponse = httpClient.execute(httpGet);rn catch (IOException e) rn e.printStackTrace();rn rn int statusCode = httpResponse.getStatusLine().getStatusCode();rn if (statusCode == HttpStatus.SC_OK) //SC_OK = 200rn rn // 获得返回结果rn try rn org.apache.http.HttpEntity httpEntity=httpResponse.getEntity();rn response = EntityUtils.toString(httpEntity);rn Log.e("ERR", "run: "+response);rnrn catch (IOException e) rn e.printStackTrace();rn Log.e("Catch", "run: "+e);rn rn rn elsern rn response = "返回码:"+statusCode;rn Log.e("fail", "返回码: "+response);rn rn rn ).start();rn return response;rn Log.e("return", "httpGet: "+response);rn rnrn[/code]rnrn因为网络请求要放到子线程里,但是这个类我要return response给MainActivity,所以定义了个全局变量response。然而在执行到response = EntityUtils.toString(httpEntity);这句时,好像赋值不成功, 而且Log.e("ERR", "run: "+response);也没执行到,不知是出了什么错误。尝试定义了一个成员变量来获取EntityUtils.toString(httpEntity);,logcat也是没有执行到,求大神解救下小弟,这个问题一直想不明白
SQL执行时报标识符无效
21-Sep-2016 10:33:08.782 SEVERE [http-nio-80-exec-10] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [spring] in context with path [] threw exception [Request processing failed; nested exception is com.github.ltsopensource.store.jdbc.exception.JdbcException: Select SQL Error: rnSELECT TIMESTAMP ,AVG(DAEMON_THREAD_COUNT) AS DAEMON_THREAD_COUNT ,AVG(THREAD_COUNT) AS THREAD_COUNT ,AVG(TOTAL_STARTED_THREAD_COUNT) AS TOTAL_STARTED_THREAD_COUNT ,AVG(DEAD_LOCKED_THREAD_COUNT) AS DEAD_LOCKED_THREAD_COUNT ,AVG(PROCESS_CPU_TIME_RATE) AS PROCESS_CPU_TIME_RATE FROM LTS_ADMIN_JVM_THREAD WHERE (TIMESTAMP BETWEEN ? AND ? ) GROUP BY TIMESTAMP ] with root causern java.sql.SQLException: ORA-00904: "TIMESTAMPETWEEN": 标识符无效rn Query: SELECT TIMESTAMP ,AVG(DAEMON_THREAD_COUNT) AS DAEMON_THREAD_COUNT ,AVG(THREAD_COUNT) AS THREAD_COUNT ,AVG(TOTAL_STARTED_THREAD_COUNT) AS TOTAL_STARTED_THREAD_COUNT ,AVG(DEAD_LOCKED_THREAD_COUNT) AS DEAD_LOCKED_THREAD_COUNT ,AVG(PROCESS_CPU_TIME_RATE) AS PROCESS_CPU_TIME_RATE FROM LTS_ADMIN_JVM_THREAD WHERE (TIMESTAMP BETWEEN ? AND ? ) GROUP BY TIMESTAMP Parameters: [1474414388000, 1474425188000]rnrnrn打印出来的SQL是正确的,但不知道怎么报 "TIMESTAMPETWEEN": 标识符无效,我看全部SQL也只有 (TIMESTAMP BETWEEN ? AND ? 才有可能拼接成上面错误的SQL样子,但明明是有空格的 打了3-4个空格。 求解啊,调试到执行时 SQL都是正确的。 但报错却拼接在一起了
退出再执行时报严重错误。
在MFC对话框里点击一个按钮调用一个ATL的功能。rnrn当执行那个ATL的功能的退出后,回到MFC的界面,再去点击按钮执行此ATL的功能的时候,系统报错:rnrnDebug assertion failed!rnrn...vc\ce\atlmfc\include\atlbase.hrnline :2727rnrnexpression:_pAtlModule == 0rnrnrn-----------------------------------------rnrn退出功能的代码是:rnrn SendMessage(WM_CLOSE);rn return 0;rnrnrn按钮动作的代码是:rnCMiniPIEModule _AtlModule;rnint nShowCmd = 1; //value 1 is mobile IE showrn_AtlModule.WinMain(nShowCmd); rn
非阻塞socket 爬虫代码
要爬http://feeds.delicious.com/v2/rss/tag/%E8%80%90%E5%85%8B?count=100这个页面,rn如何用非阻塞的 socket来 爬,求高手指点..最好有解释...rn[code=Java]rnimport java.io.IOException;rnimport java.net.InetSocketAddress;rnimport java.net.Socket;rnimport java.nio.ByteBuffer;rnimport java.nio.channels.SelectionKey;rnimport java.nio.channels.Selector;rnimport java.nio.channels.SocketChannel;rnrnpublic class SocketNonBlock rn public static SocketChannel createSocketChannel(String hostName, int port)rn throws IOException rn SocketChannel sChannel = SocketChannel.open();rn sChannel.configureBlocking(false);rn sChannel.connect(new InetSocketAddress(hostName, port));rn sChannel.finishConnect();rn return sChannel;rn rnrn public static void main(String[] args) rn try rn rn // 创建链接rn SocketChannel sChannel = createSocketChannel("feeds.delicious.com", 80);rn ByteBuffer buffer = ByteBuffer.allocate(8 * 1024); rn // 可以通过判断是否连接,在链接成功建立前做一些其它的事情rn while (!sChannel.finishConnect()) rn System.out.println("等待非阻塞连接建立....");rn try rn Thread.sleep(10);rn catch (InterruptedException e) rn e.printStackTrace();rn rn rn System.out.println(sChannel.isConnected());rn rn rn catch (Exception e1) rn rn rnrnrn[/code]rnrn上述代码 就是只能 connect不知道 怎么获取 该网页内容.求好心人帮忙.....rn
关于socket的执行优先级问题
如下所示的程序结构:rnMainFunction()rnrnSubFunction1();rnSocketFunction();rnSubFunction2();rnrn为什么要在整个MainFunction()执行完之后才会进入SocketFunction()内部执行,而不是顺序执行下来?难道socket的执行优先级低吗?如何让它顺序执行,SubFunction2()还需要SocketFunction()的执行结果。
socket中bind时报权限错误
rnrn这是服务器进程的部分源代码:rnrnbzero(&addr,sizeof(addr));rn addr.sin_family = AF_INET;rn addr.sin_port = htons(13);//日期时间的端口rn addr.sin_addr.s_addr = htonl(INADDR_ANY);rn if(bind(sockid,(struct sockaddr *)&addr,sizeof(addr)) < 0)rn rn err_quit("bind sockid--%d error\n",sockid);rn rnrn我是新手,请高手指点一下
axis2客户端调用时报Socket异常
java.net.SocketException: Software caused connection abort: recv failedrn at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.7.0_79]rn at java.net.SocketInputStream.read(SocketInputStream.java:152) ~[na:1.7.0_79]rn at java.net.SocketInputStream.read(SocketInputStream.java:122) ~[na:1.7.0_79]rn at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) ~[na:1.7.0_79]rn at java.io.BufferedInputStream.read(BufferedInputStream.java:254) ~[na:1.7.0_79]rn at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78) ~[commons-httpclient-3.1-rc1.jar:3.1-rc1]rn at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106) ~[commons-httpclient-3.1-rc1.jar:3.1-rc1]rn at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116) ~[commons-httpclient-3.1-rc1.jar:3.1-rc1]rn at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1401) ~[commons-httpclient-3.1-rc1.jar:3.1-rc1]rn at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1969) ~[commons-httpclient-3.1-rc1.jar:3.1-rc1]rn at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1727) ~[commons-httpclient-3.1-rc1.jar:3.1-rc1]rn at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1090) ~[commons-httpclient-3.1-rc1.jar:3.1-rc1]rn at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398) ~[commons-httpclient-3.1-rc1.jar:3.1-rc1]rn at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) ~[commons-httpclient-3.1-rc1.jar:3.1-rc1]rn at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) ~[commons-httpclient-3.1-rc1.jar:3.1-rc1]rn at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:621) ~[axis2-transport-http-1.6.3.jar:na]rn at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193) [axis2-transport-http-1.6.3.jar:na]rn at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75) [axis2-transport-http-1.6.3.jar:na]rn at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:396) [axis2-transport-http-1.6.3.jar:na]rn at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:223) [axis2-transport-http-1.6.3.jar:na]rn at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443) [axis2-kernel-1.6.3.jar:1.6.3]rn at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406) [axis2-kernel-1.6.3.jar:1.6.3]rn at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) [axis2-kernel-1.6.3.jar:1.6.3]rn at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) [axis2-kernel-1.6.3.jar:1.6.3]rn at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555) [axis2-kernel-1.6.3.jar:1.6.3]rn at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531) [axis2-kernel-1.6.3.jar:1.6.3]
socket connect 时报 10049 错误,怎么解决?
socket在connect服务器提示异常错误:rnrn10049:can't assign requested address.rnrn怎么办?
socket connect 时报Operation now in progress
以下是我的代码: rn edpinfo->servAddr.sin_family = AF_INET;rn edpinfo->servAddr.sin_port = htons(port);rn edpinfo->servAddr.sin_addr.s_addr = addr;rnrn if(fcntl(sock, F_SETFL, O_NONBLOCK) == -1)rn return -1;rn rn printf("Connect return retval = %d,sock =%d\n",retval,sock);rn retval = connect(sock, (struct sockaddr *)&edpinfo->servAddr, sizeof(struct sockaddr));rn perror("connect");rn我先查了一下Operation now in progress是socket的阻塞了,要把socket设置成非阻塞模式,其实我也不是很明白fcntl这个函数的作用,但是从O_NONBLOCK来看,这个应该是把socket 设置成非阻塞模式了.但是,为什么还报了错误了..请指教?socket 的值是13.通过fcntl就得到了这个值.
用NMMSGServ接受消息时报Socket错误
用NMMSGServ接受NmmSg发送过来的消息,调试时,接受到消息后报以下错误:rnrn10038:Socket operating on non-socketrnrn是怎么回事啊?谢谢!
mysql登录时报socket找不到终极解决方案
mysqld.socket文件是用来给客户端和服务端进行通信的,如果通过源码方式安装,默认情况下这个文件会被放在tmp目录下。当然也可以手动指定存放位置,通过修改/etc/my.cnf文件的socket参数来修改mysqld.socket的存放路径。例如: [mysqld] socket=/data/mysqldb/mysqld.sock 但是这样一来在登录的时候就会出现如下问题 [...
发送文件程序退出时报Socket错误!
发送线程rnCSocket sockListen;rnsockListen.Create(5000);rnsockListen.Listen(); rnsockListen.Accept(lpThis->m_sockConnect);rnsockListen.Close();rn文件发送完成后,lpThis->m_sockConnect.Close();rnrn接收线程rnsockClient.Create(); rnsockClient.Connect((LPCTSTR)strIP, 5000);rn接收完成后sockClient.Close();rnrn但是在文件传送完成后,关闭发送线程程序时报错。请问为什么啊?rnBOOL CAsyncSocket::AsyncSelect(long lEvent)rnrn ASSERT(m_hSocket != INVALID_SOCKET);rnrn _AFX_SOCK_THREAD_STATE* pState = _afxSockThreadState;rn ASSERT(pState->m_hSocketWindow != NULL);//程序在该处报错,值为NULLrnrn return WSAAsyncSelect(m_hSocket, pState->m_hSocketWindow,rn WM_SOCKET_NOTIFY, lEvent) != SOCKET_ERROR;rn
基于Socket和HttpURLConnection的爬虫实例
基于Socket和HttpURLConnection的爬虫实例,适合初学者参考。
c++基于socket的图片爬虫
#include <iostream> #include <winsock2.h> #include <fstream> #include <string> #include <sstream> using namespace std;int makeSocket(string url,int port) { WSADATA wsadata; WSAStartup(0x202,&ws
python爬虫socket包用法
以Httpserver为例,简单介绍一下socket包的使用 #socket:一组实现tcp协议的api #目前端口为32位整数;32位整数的最大值65535 import socket import re import os def service_client(new_socket): #1.接收浏览器发送过来的请求,即http请求 request = new_socke...
SOCKET accept() 无法执行
如下代码,很简单.但是就是执行到rnsock = accept(sock0, (struct sockaddr *)&client, &len);rn时就出错. rn或许哪位XDJM可以告诉我怎么捕捉这个异常.rnrnVS2008rnconsole applicationrnlib: ws2_32.librnrn[code=C/C++]rnrn#include rn#include rnrnintrnmain()rnrn WSADATA wsaData;rn SOCKET sock0;rn struct sockaddr_in addr;rn struct sockaddr_in client;rn int len;rn SOCKET sock;rnrnrn WSAStartup(MAKEWORD(2,0), &wsaData);rnrn // sock0 creatern sock0 = socket(AF_INET, SOCK_STREAM, 0);rn printf("\nhello world !!!!\n");rnrn if (sock0 == INVALID_SOCKET) rn printf("error : %d\n", WSAGetLastError());rn return 1;rn rn rn addr.sin_family = AF_INET;rn addr.sin_port = htons(12345);rn addr.sin_addr.S_un.S_addr = INADDR_ANY;rn bind(sock0, (struct sockaddr *)&addr, sizeof(addr));rnrn // TCP wait from clientrn listen(sock0, 5);rnrn // TCP accept from client rn len = sizeof(client);rnrn sock = accept(sock0, (struct sockaddr *)&client, &len);rnrn if (sock <0) rn printf("error : %d\n", WSAGetLastError());rn closesocket(sock0);rn return 1;rn rn rnrnrn // 文字送信rn send(sock, "HELLO", 5, 0);rnrn // TCP session overrn closesocket(sock);rnrn // winsock2 cleanrn WSACleanup();rnrn return 0;rnrn[/code]
在laravel中执行数据库迁移时报错解决方案:
Laravel5.4 默认使用 utf8mb4 字符,包括支持在数据库存储「表情」。如果你正在运行的 MySQL release 版本低于5.7.7 或 MariaDB release 版本低于10.2.2 ,为了MySQL为它们创建索引,你可能需要手动配置迁移生成的默认字符串长度,你可以通过调用 AppServiceProvider 中的 Schema::defaultStringLength
Mybatis执行批量更新时报mysql语法错误
问题描述:Mybatis执行批量更新时报mysql语法错误,把日志打印出来,执行打印出来的mysql,是可以正确执行的。解决办法:起因是jdbc连接数据库时,默认是不支持一次执行多个sql语句。在数据库链接的时候,添加`&amp;allowMultiQueries=true`
idea执行时报“无效的发行版:9”
JDk版本和项目配置的不一致: Flie ——&amp;gt; Project Stricture... ——&amp;gt; Project language level 如果是jdk8,把anguage level设置为8; 如果是jdk9,把anguage level设置为9。...
ajax有时执行成功,有时报500错误
这是前台JS代码:[code=php]$(document).on('change','.figure',function()rnrn var val = $(this).parent().prev().children().val();rn var value = $(this).val();rn rn var fh=$(this);rn rn $.ajax(rn url:" path('detail_stock_ajax', 'icmoId':icmoId ) ",rn type: "POST",rn data: brandId:val,figureId:value,rn success:function(msg)rn rn fh.parent().parent().children('td').eq(12).empty();rn fh.parent().parent().children('td').eq(12).html(msg.stock);rn rn )rn rn );[/code]rnrn这是后台PHP代码[code=php]$brandId = $request->request->get('brandId');rn $figureId = $request->request->get('figureId');rn $brand = $this->getDoctrine()->getRepository('DianzibuyStoreroomDepartmentBundle:DzbStoreroomProductBrand')->findOneById($brandId)->getId();rn $products = $this->getDoctrine()->getRepository('DianzibuyStoreroomDepartmentBundle:DzbStoreroomProduct')->findByTitle($figureId);rn foreach($products as $value)rn if($value->getBrand()->getId() == $brand)rn rn $stock = $value->getStock();rn rn rn rn return new JsonResponse(array('stock' => $stock));[/code]rnrn报错信息: Warning: rename(D:\phpStudy\WWW\Dianzibuy\var\cache\dev/doctrine/orm/Proxies\__CG__DianzibuyBundlePurchaseDepartmentBundleEntityDzbPurchaseSupplier.php.59bb801494e713.53833954,D:\phpStudy\WWW\Dianzibuy\var\cache\dev/doctrine/orm/Proxies\__CG__DianzibuyBundlePurchaseDepartmentBundleEntityDzbPurchaseSupplier.php):这里是乱码字符(code: 5)
如何处理执行系统命令时报“segmentation fault”
1关键词rnrnsegmentation fault、linux系统命令。rnrn2适用版本rnrnFusionCompute所有版本。rnrn3问题描述rnrn1、运维人员在linux系统执行系统命令时系统报“Segmentation fault”,如下为执行last reboot命令时的系统回显。rnrn2、查看该节点的系统message日志,发现存在大量“segfault”的异常打印。rnrnrn4问题分析rnrn分析发现该系统/usr/bin目录下部分文件有最近更新的情况,且最后修改时间晚于系统安装时间。(通常该目录下的文件为系统文件)rn对LINUX系统对系统文件,如/usr/bin目录下文件执行“dos2unix *”命令后就会造成其他系统命令使用异常的情况。rnrn5解决方法rnrn若明确那个具体文件被修改,可从同类型操作系统中拷贝对应的文件恢复(须保持文件权限一致)。rn若不明确修改的文件,须对该节点进行重新安装恢复。rnrn6总结&建议rn对2进制文件执行“dos2unix”之后会影响该文件功能,用户以root权限在linux系统执行rm,dos2unix等命令时必须明确含义及其作用域。rn7fb161a54e5d8accefc7ea35bc1c986b
在Firefox中执行javascrip时报错了,请教!
在Firefox中报错rnfunction dyniframesize(iframename) rn var pTar = null;rn if (document.getElementById)rn pTar = document.getElementById(iframename);rn rn elsern eval('pTar = ' + iframename + ';');rn rn if (pTar && !window.opera)rn //begin resizing iframern pTar.style.display="block"rn rn if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight)rn //ns6 syntaxrn pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight; //这里报错,FFextraHeight is not defined应该是什么啊rn rn else if (pTar.Document && pTar.Document.body.scrollHeight)rn //ie5+ syntaxrn pTar.height = pTar.Document.body.scrollHeight;rn rn rnrn这个JS什么意思rn rn rn
执行作业时报存储空间不足,如何解决?
sql2000数据库上有几个作业,一起动,就报存储空间不足,无法执行指令,但是把存储过程语句放到查询分析器执行没问题。而且有些作业运行也正常,重启后就好了rnrn而且机器的内存使用还正常,sql2000用了300多M,硬盘空间也有2G空闲空间rnrn请问大哥们,如何解决?
romimage.exe执行ce.bib时报访存错误?
rn我在命令行方式下,用romimage.exe ce.bib 生成nk,执行到 compacting bin file 时报指令访问了0x0内存.rnrn而在PB下makeimg却正常。哪位大侠知道什么原因?
qt编译时报 无法执行“rc.exe”
刚刚安装完QT5.9编译时发现报错(无法运行“rc.exe”) 我的解决方法是:将C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin 下的RC.Exe和RcDll.Dll拷贝到qmake的目录下(C:\Qt\Qt5.9.0\5.9\msvc2015_64\bin) 查看qmake目录 打开QT--&gt;工具--&gt;选项...
Spring 定时任务 在执行方法时报空指针
定时任务的xml:nn n com.boco.auto.AutoIPV6BusinessAlarmStatisticsReportn n n n n n n n 0 30 3 * * ?n n n Spring注入:n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n定时任务:npublic class AutoAlarmStatisticsReport implements Jobn static Logger logger = Logger.getLogger(AutoAlarmStatisticsReport.class) ;n private ReportCommonActionPipeRes pipeResAction;n n @Overriden public void execute(JobExecutionContext arg0) throws JobExecutionException n logger.info("+++进入定时任务。+++");n generateReport();n n public void generateReport()n logger.info("modelName=AlarmStatistics");n pipeResAction = (ReportCommonActionPipeRes)StartupApp.getInstance().n getAppContext().getBean("reportpiperesource");n String modelName = "IPV6BusinessAlarmStatistics";n Date date = new Date();n SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");n String today = sdf.format(date);n this.pipeResAction.insertBusinessNEStatistics(modelName);n //insertBusinessNEStatistics(modelName);n nn调用此方法:npublic boolean insertBusinessNEStatistics(String modelName)n boolean isOk = false;n Date date = new Date();n SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");n String createDate = sdf.format(date);n SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");n Date datestart = new Date(); n String startDateString="";n startDateString= sdf1.format(datestart);n List Allist = new ArrayList();n String informixSql = statementManagementBean.getStatementByName(modelName.trim());n Map parameterMap = new HashMap();n n if((null == informixSql)||informixSql.equalsIgnoreCase("no such table"))n return isOk;n elsen String[] sql_Array = informixSql.split(";");n List dataList = new ArrayList();n for(String sql : sql_Array)n if(sql != null && sql.trim().length() > 0)n if(modelName.equalsIgnoreCase("AlarmStatistics"))n String procName = "call pro_alarm_trans_counteveryday()";n boolean isInsertflag= false;n //测试:n isInsertflag = true;n // try n // isInsertflag = vendorfaultService.insertIPV6AlarmCount(procName);n // logger.info("++获得告警标识:++"+isInsertflag);n // catch (Exception e) n // TODO: handle exceptionn // logger.error("error 错误的信息", e);n // n if(isInsertflag == true)n tryn dataList = vendorfaultService.queyAlarm(parameterMap, sql.trim(), false);n catch(Throwable t)n logger.error("error 错误的信息", t);n n elsen return isInsertflag;n n elsen //dataList = reportCommonDao.commonQuery(sql.trim(), parameterMap);n dataList = reportCommonDao.commonQuery(sql.trim(), parameterMap);n nn n nn isOk = true;n n return isOk; n n
在执行mybatis-generator的配置文件generatorConfig.xml时报以下错
在dos下执行以下命令,报红色的错误,求解rnF:\innoWorkspaces\ssm>java -jar WebRoot/WEB-INF/lib/mybatis-generator-core-1.3.rn.jar -configfile src/generatorConfig.xml -overwriternXML Parser Errors occurred:rnrn[color=#FF0000]XML Parser Error on line 30: The string "--" is not permitted within comments.[/color]
有关socket关闭时报“无法访问已经释放的对象”的问题
我做了个socket服务器,有开启和关闭两种状态,关闭情况下客户端不能访问,只有开启了才能访问。问题是每当我要关闭服务器的时候,总会报说“无法访问已经释放的对象”,让我感到十分郁闷,请各位高手多多帮忙,我是新接触socket的,有很多东西都不太清楚。rn以下是我的代码:rn public void StartListening()rn rn rn // Establish the local endpoint for the socket.rn // The DNS name of the computerrn //设置服务器的IP地址,网络端口和终结点rn IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());rn IPAddress ipAddress = ipHostInfo.AddressList[0];rn IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 11000);rn // Create a TCP/IP socket.rn //建立服务器类型rn listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);rn // Bind the socket to the local endpoint and listen for incoming connections.rn tryrn rn //绑定连接终结点并开始侦听rn listener.Bind(localEndPoint);rn listener.Listen(10);rnrn // Start an asynchronous socket to listen for connections.rn //建立异步SOCKET来侦听传入的连接信息rn listener.BeginAccept(new AsyncCallback(AcceptCallback), listener); rn rn catch (Exception e)rn rn MessageBox.Show(e.ToString());rn rn rnrn public void AcceptCallback(IAsyncResult ar)rn rn // Get the socket that handles the client request.rn //获取传入的客户端信息rn Socket listene = (Socket)ar.AsyncState;rn Socket handler = listene.EndAccept(ar); //关闭时总是在这里报错rn listener.BeginAccept(new AsyncCallback(AcceptCallback), listener);rnrn listBox_IPAddress.Items.Add(handler.RemoteEndPoint.ToString());rnrn //获取客户端数据rn StateObject state = new StateObject();rn state.workSocket = handler;rn ht.Add(handler.RemoteEndPoint, handler);rnrn Receive(handler);rn rnrn private void button_Start_Click(object sender, EventArgs e)rn rn //判断服务器是否已经开启rn if (!ISListen)rn rn StartListening();rn ISListen = true;rn rn elsern rn MessageBox.Show("服务器已经启动!","系统提示");rn rn rn /// rn /// 关闭所有的客户端会话,与所有的客户端连接会断开rn /// rn public virtual void CloseAllClient()rn rn foreach (Socket client in ht.Values)rn rn client.Close();rn rnrn ht.Clear();rn rnrn private void button_Stop_Click(object sender, EventArgs e)rn rn if (ISListen)rn rn //这个条件语句,一定要在关闭所有客户端以前调用rn //否则在EndConn会出现错误rn ISListen = false;rnrn //关闭数据连接,负责客户端会认为是强制关闭连接rn if (listener.Connected)rn rn listener.Shutdown(SocketShutdown.Both);rn rnrn CloseAllClient();rnrn //清理资源rn listener.Close();rnrn ht = null;rn rn elsern rn MessageBox.Show("服务器已经关闭!","系统提示");rn rn rn
为什么执行时报3010的错误?/谢谢
Public Sub pfクエリ実行(strName, strSQL)rn Dim DB As Databasern Dim LQDF As QueryDefrnrn Set DB = CurrentDbrn If strName <> "" Then '注①rn DoCmd.DeleteObject acTable, strNamern End Ifrn Set LQDF = DB.QueryDefs("クエリ実行テンプレート")rn LQDF.SQL = strSQLrn LQDF.Executern LQDF.ClosernEnd Subrn其中strSQL为下面的内容rnSELECT P_年度2.年度,P_年度2.通知日,P_年度2.有効期限 INTO WK_年度 FROM P_年度2 WHERE (((P_年度2.更新日)=[Forms]![F_業者名簿作成]![TXT_更新日])); rn错误内容为缺少参数怎么修改呢??rn谢谢!rnrnrn
关于执行ST_Geometry的st_centroid函数时报ORA-28579错误的问题
环境 SDE版本:10./10.2/10.2.1/10.2.2 Oracle版本:11g R2 11.2.0.1 Windows版本:Windows Server 2008 R2 问题描述及原因 以全球的边界数据为样例数据,执行语句: select sde.st_astext(sde.st_centroid(shape)) from sde.world; 报网络错误,错误编码ORA...
弹出对话框时报404问题
各位高手:我使用了ScriptManage控件弹出对话框代码为:[code=C#]ScriptManager.RegisterStartupScript(this.UpdatePanel1, UpdatePanel1.GetType(), "msg", "alert('提示:您的登录名已被使用,请更换!')", true);[/code]在本机上可用,但当布属在服务器上时报出以下异常Sys.WebForms.PageRequestManagerServerErrorException:An unknown error occurred while processing the request on the server. The status code returned from the server was: 404。是以对话框的形式弹出来的,,,请问是怎么回事了。rn谢谢了
Ubuntu系统上脚本文件执行时报No such file or directory的问题
Ubuntu等linux系统上脚本文件功能十分强大,但是有时稍不注意会出现一些莫名其妙的问题。 比如,当执行一个脚本文件时,命名文件存在,命令中的路径也没问题,但是执行脚本文件时会报No such file or directory的错误。 如果报上述错误时,提示信息中同时打印了脚本文件中的某一行或某几行的内容,这往往是由于脚本文件中存在语法问题,一种情况就是脚本中赋值语句中变量名称使
JOB执行存储过程时报:ORA-01031: insufficient privileges问题的解决
编写了一个存储过程,手动执行的时候没有问题,但创建job调用存储过程的时候报错:ORA-01031: insufficient privileges。   在网上查了查,说是没有权限创建表,要显示授权,在创建存储过程的时候加上:Authid Current_User,修改后的存储过程结构如下: CREATE OR REPLACE PROCEDURE P_RES_F_UD_FLOW(TIME_D...
解决db.serverStatus()命名执行时报无权限的问题
转载:解决db.serverStatus()命名执行时报无权限的问题原文地址:解决db.serverStatus()命名执行时报无权限的问题 1、问题描述 今天在执行db.serverStatus()命令时给出了“ "errmsg" : "not authorized on admin to execute command { serve...
Scrapy爬虫框架下执行爬虫的方法
在使用Scrapy框架进行爬虫时,执行爬虫文件的方法是 scrapy crawl xxx ,其中 xxx 是爬虫文件名。 但是,当我们在建立了多个文件时,使用上面的命令时会比较繁琐麻烦,我们就可以使用下述方法同时完成爬虫文件的执行。 第一种,在scrapy框架下建立一个运行文件,如 run.py ,在文件中建立一个列表,列表为爬虫的执行命令,最后通过循环执行 execute() 函数完成执行。...
(新手)python的socket问题,执行总出错
windows下:rnserver:rnrnfrom socket import *rnrnid_1 = ('xu',1024,1900,'hello world')rnid_2 = ('li',2048,2000,'hello world')rnid_3 = ('wa',3064,2100,'hello world')rnid_4 = ('he',4096,2200,'hello world')rnrnBUF = 1024rnrnhost = ''rnport = 2536rnsfd = socket(AF_INET,SOCK_STREAM)rnsfd.bind((host,port))rnsfd.listen(5)rnwhile True:rn cli,addr = sfd.accept()rn print 'waiting for connection ...'rn data = sfd.recv(BUF)rn if data == 1:rn cli.send('%s' % id_1)rn elif data == 2:rn cli.send('%s' % id_2)rn elif data == 3:rn cli.send('%s' % id_3)rn elif data ==4:rn cli.send('%s' % id_4)rn else:rn breakrn cli.close()rnsfd.connect()rn*************************************rnrecv:rnrnfrom socket import *rnrnBUF = 1024rnhost = 'localhost'rnport = 2536rnsfd =socket(AF_INET,SOCK_STREAM)rnsfd.connect((host,port))rnsfd.sendall(1)rndata = sfd.recv(BUF)rnprint datarnsfd.close()rnrn***************************************rn结果:rnwaiting for connection ...rnTraceback (most recent call last):rn File "D:\source\python\my_tset\sockets\data_ser.py", line 18, in rn data = sfd.recv(BUF)rnsocket.error: [Errno 10057]rn
scrapy顺序执行多个爬虫
爬虫的时候写了一个main.py,里面使用下面代码:import sys import os from scrapy.cmdline import execute sys.path.append(os.path.dirname(os.path.abspath(__file__))) execute(["scrapy", "crawl", "shanghaione"]) time.sleep(30
爬虫获得界面执行信息
爬虫
相关热词 c# 标准差 计算 c#siki第五季 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池