分布式网上商城项目-solr搜索功能错误
1、RuntimeException错误
java.lang.RuntimeException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.thyonline.taotao.search.mapper.SearchItemMapper.SearchItemList
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.thyonline.taotao.search.mapper.SearchItemMapper.SearchItemList
at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:189)
at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:43)
at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:58)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:51)
at com.sun.proxy.$Proxy34.SearchItemList(Unknown Source)
at cn.thyonline.taotao.search.service.impl.SearchItemServiceImpl.importAllItems(SearchItemServiceImpl.java:24)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
at com.sun.proxy.$Proxy35.importAllItems(Unknown Source)
at com.alibaba.dubbo.common.bytecode.Wrapper0.invokeMethod(Wrapper0.java)
at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46)
at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72)
at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53)
at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:60)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:112)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:108)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170)
at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52)
at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
但是查看target文件发现查看报错信息可以看见是mapper绑定无效

Mapper文件已经放置在一个文件夹,再检查两个文件发现是select语句的ID没有对应上
2、请求超时错误
com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method importAllItems in the service cn.thyonline.taotao.search.service.SearchItemService. Tried 3 times of the providers [192.168.199.139:20882] (1/1) from the registry 192.168.25.128:2181 on the consumer 192.168.199.139 using the dubbo version 2.5.3. Last error is: Invoke remote method timeout. method: importAllItems, provider: dubbo://192.168.199.139:20882/cn.thyonline.taotao.search.service.SearchItemService?anyhost=true&application=taotao-manager-web&check=false&dubbo=2.5.3&interface=cn.thyonline.taotao.search.service.SearchItemService&methods=importAllItems&pid=3208&revision=0.0.1-SNAPSHOT&side=consumer×tamp=1528390391677, cause: Waiting server-side response timeout. start time: 2018-06-08 00:53:16.967, end time: 2018-06-08 00:53:17.968, client elapsed: 0 ms, server elapsed: 1001 ms, timeout: 1000 ms, request: Request [id=2, version=2.0.0, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=importAllItems, parameterTypes=[], arguments=[], attachments={path=cn.thyonline.taotao.search.service.SearchItemService, interface=cn.thyonline.taotao.search.service.SearchItemService, version=0.0.0}]], channel: /192.168.199.139:11038 -> /192.168.199.139:20882
Web层请求超时
但是检查search层在查询数据库前后打印
System.out.println("开始查询商品!");
List<SearchItem> items = mapper.searchItemList();
//2、创建solrServer对象,将商品信息通过SolrInputDocument存入
System.out.println("查询到的商品数量:"+items.size());
并且打印出来了数据说明mapper映射文件也没有问题。重新开始测试,发现后台两条数据都打印了出来,证明请求从controller层传递到了service层,dubbo连接没有问题。
那证明一件事情就是这次连接因为要连接solr导致耗时很长,使得超出了dubbo的默认连接时间从而失败,修改dubbo在service层和controller层的配置:
<!-- 名字不能够重复,和随便,用于计算依赖关系,服务调用的情况 -->
<dubbo:application name="taotao-search" />
<!-- 使用zookeeper注册协议 -->
<dubbo:registry protocol="zookeeper" address="192.168.25.128:2181" />
<!-- 使用dubbo协议,暴露服务的端口 -->
<dubbo:protocol name="dubbo" port="20882" />
<!-- 发布服务 -->
<dubbo:service interface="cn.thyonline.taotao.search.service.SearchItemService" ref="searchItemServiceImpl" timeout="300000"/>
查看solr数据修改连接超时为5分钟,再次测试,连接成功

Solr数据导入成功
分布式网上商城项目-solr搜索功能错误的更多相关文章
- 分布式网上商城项目-dubbo搭建与初次使用错误
1.Spring-service启动失败 严重: Exception sending context initialized event to listener instance of class o ...
- 分布式网上商城项目- BeanDefinitionStoreException
BeanDefinitionStoreException: 严重: StandardWrapper.Throwable org.springframework.beans.factory.BeanDe ...
- 【SSH网上商城项目实战27】域名空间的申请和项目的部署及发布
转自:https://blog.csdn.net/wwww_com/article/details/54405355 前面陆陆续续的完成了网上商城的一些基本功能,虽然还有很多地方有待完善,但是不影响 ...
- 【SSH网上商城项目实战21】从Demo中看易宝支付的流程
转自: https://blog.csdn.net/eson_15/article/details/51447492 这一节我们先写一个简单点的Demo来测试易宝支付的流程,熟悉这个流程后, ...
- 新巴巴运动网上商城 项目 快速搭建 教程 The new babar sports online mall project quickly builds a tutorial
新巴巴运动网上商城 项目 快速搭建 教程 The new babar sports online mall project quickly builds a tutorial 作者:韩梦飞沙 Auth ...
- 【SSH网上商城项目实战16】Hibernate的二级缓存处理首页的热门显示
转自:https://blog.csdn.net/eson_15/article/details/51405911 网上商城首页都有热门商品,那么这些商品的点击率是很高的,当用户点击某个热门商品后需要 ...
- 商城06——solr索引库搭建&solr搜索功能实现&图片显示问题解决
1. 课程计划 1.搜索工程的搭建 2.linux下solr服务的搭建 3.Solrj使用测试 4.把数据库中的数据导入索引库 5.搜索功能的实现 2. 搜索工程搭建 要实现搜索功能,需要搭建 ...
- 【SSH网上商城项目实战30】项目总结
转自:https://blog.csdn.net/eson_15/article/details/51479994 0. 写在前面 项目基本完成了,加上这个总结,与这个项目相关的博客也写了30篇了 ...
- 【SSH网上商城项目实战30】项目总结(附源码下载地址)
项目基本完成了,加上这个总结,与这个项目相关的博客也写了30篇了,积少成多,写博客的过程是固化思路的一个过程,对自己很有用,同时也能帮助别人.顺便说个题外话,在学习的过程中肯定会遇到很多异常出现,我们 ...
随机推荐
- The Willpower Instinct(自控力,意志力)
下面是我这几天在读斯坦福大学麦格尼格尔教授的<自控力>这本书的过程中摘抄的部分经典句子,发人深思!有助于帮助我们更好的了解自己. 00 导言:欢迎进入意志力入门 意志力:控制自己的注意力. ...
- 建立makefile
一.目的 1.1 熟悉makefile的基本规则,学会建立自己的makefile,通过makefile提高编程效率 1.2 学会通过autotools建立makefile来更好更高效地管理软件项目工程 ...
- Android Studio图形基础(AS开发实战第二章学习笔记)
图形基础 一.drawable 在代码中引用drawable文件可分为两种情况 (1)使用setBackgroundResource和setImageResource方法,可直接在参数中指定drawa ...
- Redux学习笔记--异步Action和Middleware
异步Action 之前介绍的都是同步操作,Redux通过分发action处理state,所有的数据流都是同步的,如果需要一步的话怎么办? 最简单的方式就是使用同步的方式来异步,将原来同步时一个acti ...
- element ui下拉框如何实现默认选择?
<template> <el-select v-model="value4" clearable placeholder="请选择"> ...
- LeetCode-Subsets ZZ
LeetCode:Subsets Given a set of distinct integers, S, return all possible subsets. Note: Elements in ...
- 事件循环进阶:macrotask与microtask
这段参考了参考来源中的第2篇文章(英文版的),(加了下自己的理解重新描述了下), 这里没法给大家演示代码,我就简单说下我的理解吧. promise和settimeout 在一起的时候执行顺序是个有意思 ...
- 【Leetcode】【Medium】Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2-&g ...
- vue + element-ui 制作下拉菜单(可配置路由、可根据路由高亮list、可刷新自动展开定位路由)
本篇文章分享一篇关于 vue制作可路由切换组件.可刷新根据路由定位导航(自动展开).可根据路由高亮对应导航选项 一.实现的功能如下: 1.可折叠导航面板 2.点击导航路由不同组件 ...
- java中i = i++问题
今天偶然呗问到了一个java中自增运算符的问题,涉及到了堆栈,觉得挺有趣的把它记录下来. int i=0; i=i++; 结果i是多少? 这是一个经常被提及的问题,答案一 ...