Exception in thread Spider-0 java.lang.NullPointerException - Gecco爬虫心得
使用Gecco爬虫时偶尔遇到如下莫名其妙的异常而停止:
Exception in thread "Spider-0" java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
at java.util.regex.Matcher.reset(Matcher.java:309)
at java.util.regex.Matcher.<init>(Matcher.java:229)
at java.util.regex.Pattern.matcher(Pattern.java:1093)
at com.geccocrawler.gecco.utils.UrlMatcher.match(UrlMatcher.java:80)
at com.geccocrawler.gecco.spider.SpiderBeanFactory.matchSpider(SpiderBeanFactory.java:112)
at com.geccocrawler.gecco.spider.Spider.run(Spider.java:68)
at java.lang.Thread.run(Thread.java:745)
后来细心查看才发现(SpiderBeanFactory.java:112)中,空指针调用的url地址是来自 request
于是做了如下测试: HttpGetRequest start = new HttpGetRequest(null); GeccoEngine.create().classpath("com.example.crawler").start(start).interval(2000).run();
由此可知,是爬虫过程中如下的调用没有保证url不为null
HttpRequest sub = l.getRequest().subRequest(url); SchedulerContext.into(sub);
个人原创:爱我子月
Exception in thread Spider-0 java.lang.NullPointerException - Gecco爬虫心得相关推荐
- eclipse问题(!MESSAGE Unhandled event loop exception !STACK 0 java.lang.NullPointerException at org.e)
问题: !MESSAGE Unhandled event loop exception !STACK 0 java.lang.NullPointerException at org.eclipse.s ...
- Exception in thread “HiveServer2-Handler-Pool: Thread-67“ java.lang.OutOfMemoryError: Java heap spac
错误信息提示如下 Exception in thread "HiveServer2-Handler-Pool: Thread-67" java.lang.OutOfMemoryEr ...
- java textarea append_JavaFX TextArea.append()导致java.lang.NullPointerException
我正在读取一个串口并将其写入文本区域作为滚动值.我创建了SerialPortReader类,它运行良好.我的主代码只是调用"updateTextArea()"来告诉类textare ...
- 【已解决】关于IDEA中 Driver 出现Exception in thread quot;mainquot; java.lang.NullPointerException问题
在学习hive过程中,按照mapreduce编程规范,分别编写Mapper,Reducer,Driver,在编写Driver后运行报错了,花了两天,找到了解决方案(裂开.JPG). 代码: packa ...
- 一次空指针异常Exception in thread “main“ java.lang.NullPointerException
今天在学习JDBC的时候遭遇了一次空指针异常,报错内容 Exception in thread "main" java.lang.NullPointerException at c ...
- 空指针异常Exception in thread “main“ java.lang.NullPointerException
目录 例子: 实体类: 主程序 解决方法: map=new HashMap()和map=null的区别 引入:JVM内存机制 引入:HashMap结构 例子: 实体类: public class C ...
- 严重: Servlet.service() for servlet jsp threw exception java.lang.NullPointerException
在用maven管理的项目开发过程中,服务器我们用的是tomcat,有时候我们依赖的jar包会和tomcat自带的jar包起冲突,但是不加呢,jsp页面的<script>标签又会报红,虽然不 ...
- threw ‘java.lang.NullPointerException‘ exception // toString()
Method threw 'java.lang.NullPointerException' exception. Cannot evaluate org.json.JSONObject.toStrin ...
- Method threw ‘java.lang.NullPointerException‘ exception. Cannot evaluate com.sun.proxy.xxx
我在debug的时候发现会出现 Method threw 'java.lang.NullPointerException' exception. Cannot evaluate com.sun.pro ...
最新文章
- 大咖说:出道十五载,认知五迭代
- Oracle Export方式数据库备份和恢复(一)
- 升级gcc后glibc报错
- oracle 错误2 启动服务提示找不到指定文件_Weblogic中间件创建文件权限问题解决...
- 【数据库】关系型数据库优化操作
- CSocketFile类
- 论文浅尝 | 使用孪生BERT网络生成句子的嵌入表示
- Auto.JS 开发
- python人工自动抠图_python实现人工智能Ai抠图功能
- 智邦国际ERP软件实施成功的七大步骤
- 【安全】如何关闭Windows系统的137, 139, 445端口?
- 安装CentOS找不到硬盘,无法分区,No disks selected
- DTAS 国产三维尺寸公差分析软件尺寸链计算几何数据导入应用
- OSPF协议(Router-LSA、Network-LSA、Network-Summary-LSA、ASBR-Summary-LSA、AS-external-LSA、NSSA External LS)
- java定义hashmap_Java用自定义的类型作为HashMap的key
- 论文阅读笔记——VulDeePecker: A Deep Learning-Based System for Vulnerability Detection
- mybatis spring springMVC
- js方法在ie浏览器不起作用
- okhttp3基本用法
- 安卓udp编辑软件_IOS安卓7000+全球电视节目分享