分布式网上商城项目-图片上传及删除功能错误

1、自己创建的jar包导入本地仓库引用后出现错误

 1 [ERROR] [ERROR] Some problems were encountered while processing the POMs:
 2
 3 [WARNING] ‘dependencies.dependency.(groupId:artifactId:type:classifier)‘ must be unique: org.apache.commons:commons-io:jar -> duplicate declaration of version (?) @ line 66, column 21
 4
 5 [ERROR] ‘dependencies.dependency.version‘ for fastdfs_client:fastdfs_client:jar is missing. @ line 58, column 21
 6
 7  @
 8
 9 [ERROR] The build could not read 1 project -> [Help 1]
10
11 [ERROR]
12
13 [ERROR]   The project cn.thyonline:taotao-common:0.0.1-SNAPSHOT (D:\application\taotao\taotao-common\pom.xml) has 1 error
14
15 [ERROR]     ‘dependencies.dependency.version‘ for fastdfs_client:fastdfs_client:jar is missing. @ line 58, column 21
16
17 [ERROR]
18
19 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
20
21 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
22
23 [ERROR]
24
25 [ERROR] For more information about the errors and possible solutions, please read the following articles:
26
27 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

不知道为什么父pom文件里面声明的版本号没有生效,在对应的子pom文件添加版本号之后这个错误就消失了

2、数据MultipartFile在dubbo中传递的错误

  1 严重: Servlet.service() for servlet [taotao-manager-web] in context with path [] threw exception [Request processing failed; nested exception is com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method uploadPic in the service cn.thyonline.taotao.service.PictureService. Tried 3 times of the providers [192.168.199.139:20880] (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: Failed to invoke remote method: uploadPic, provider: dubbo://192.168.199.139:20880/cn.thyonline.taotao.service.PictureService?anyhost=true&application=taotao-manager-web&check=false&dubbo=2.5.3&interface=cn.thyonline.taotao.service.PictureService&methods=uploadPic&pid=6968&revision=0.0.1-SNAPSHOT&side=consumer&timestamp=1528043711358, cause: Fail to decode request due to: RpcInvocation [methodName=uploadPic, parameterTypes=null, arguments=null, attachments={path=cn.thyonline.taotao.service.PictureService, input=964, dubbo=2.5.3, version=0.0.0}]] with root cause
  2
  3 com.alibaba.dubbo.remoting.RemotingException: Fail to decode request due to: RpcInvocation [methodName=uploadPic, parameterTypes=null, arguments=null, attachments={path=cn.thyonline.taotao.service.PictureService, input=964, dubbo=2.5.3, version=0.0.0}]
  4
  5          at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.returnFromResponse(DefaultFuture.java:190)
  6
  7          at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:110)
  8
  9          at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:84)
 10
 11          at com.alibaba.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke(DubboInvoker.java:96)
 12
 13          at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:144)
 14
 15          at com.alibaba.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:74)
 16
 17          at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)
 18
 19          at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
 20
 21          at com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:53)
 22
 23          at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
 24
 25          at com.alibaba.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:48)
 26
 27          at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91)
 28
 29          at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53)
 30
 31          at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:77)
 32
 33          at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:227)
 34
 35          at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:72)
 36
 37          at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52)
 38
 39          at com.alibaba.dubbo.common.bytecode.proxy2.uploadPic(proxy2.java)
 40
 41          at cn.thyonline.taotao.controller.PictureController.uploadFile(PictureController.java:26)
 42
 43          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 44
 45          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 46
 47          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 48
 49          at java.base/java.lang.reflect.Method.invoke(Method.java:564)
 50
 51          at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)
 52
 53          at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
 54
 55          at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
 56
 57          at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814)
 58
 59          at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737)
 60
 61          at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
 62
 63          at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
 64
 65          at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
 66
 67          at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
 68
 69          at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
 70
 71          at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
 72
 73          at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
 74
 75          at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
 76
 77          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
 78
 79          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 80
 81          at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
 82
 83          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 84
 85          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 86
 87          at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
 88
 89          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
 90
 91          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 92
 93          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 94
 95          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
 96
 97          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
 98
 99          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
100
101          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
102
103          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
104
105          at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
106
107          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
108
109          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
110
111          at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
112
113          at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
114
115          at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
116
117          at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
118
119          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
120
121          at java.base/java.lang.Thread.run(Thread.java:844)

检查发现dubbo的引用服务和发布服务的设定都没问题。但是picFile这个方法就是传递不到。这些都没问题,问题只可能是传递的数据MultipartFile不支持dubbo的这种传递方式。于是我把保存图片的方法写到controller层。运行成功~

3、后台无法接收到js传来的数据

 1 text:‘删除‘,
 2
 3         iconCls:‘icon-cancel‘,
 4
 5         handler:function(){
 6
 7             var ids = getSelectionsIds();
 8
 9             if(ids.length == 0){
10
11                 $.messager.alert(‘提示‘,‘未选中商品!‘);
12
13                 return ;
14
15             }
16
17             $.messager.confirm(‘确认‘,‘确定删除ID为 ‘+ids+‘ 的商品吗?‘,function(r){
18
19                 if (r){
20
21                     var params = {"ids":ids};
22
23                     $.post("/rest/item/delete",params, function(data){
24
25                         if(data.status == 200){
26
27                             $.messager.alert(‘提示‘,‘删除商品成功!‘,undefined,function(){
28
29                                 $("#itemList").datagrid("reload");
30
31                             });
32
33                         }
34
35                     });
36
37                 }
38
39             });
40
41         }

改成对应的数据则删除成功,说明在后端接收数据的时候需要指定数据类型和数据的名称,才能正确接收到数据在做删除的功能时,后台使用Long id和string id都无法接收到数据。查看jQuery页面的时候发现页面传到后台的数据为String ids。

原文地址:https://www.cnblogs.com/thyHome/p/9131522.html

时间: 2024-10-07 19:53:05

分布式网上商城项目-图片上传及删除功能错误的相关文章

django之创建第10-1个项目-图片上传并记录上传时间

1.百度云盘:django之创建第10-1个项目-图片上传并记录上传时间 2.主要修改的配置文件有3个,forms.views和models3个文件以及html 3.forms.py文件修改 #coding:utf-8 #这里定义html页面中用到的表单,常和views和models文件配合使用 """ >>> help(django) Help on package django: PACKAGE CONTENTS conf (package) contr

多图片上传预览功能

//下面用于多图片上传预览功能 function setImagePreviews(avalue) { var docObj = document.getElementById("doc"); var dd = document.getElementById("dd"); dd.innerHTML = ""; var fileList = docObj.files; for (var i = 0; i < fileList.length;

图片上传-下载-删除等图片管理的若干经验总结3-单一业务场景的完整解决方案

这次完整地介绍图片上传的完整解决方案,如有bug,后续再补充. 一.图片表 CREATE TABLE `photo` ( `id` bigint(10) unsigned NOT NULL AUTO_INCREMENT, `bizid` bigint(11) NOT NULL DEFAULT '-1' COMMENT '业务id,比如项目的id', `cover` int(11) DEFAULT '0' COMMENT '1:是,0:不是', `sort` int(11) DEFAULT '0'

js实现图片上传预览功能,使用base64编码来实现

实现图片上传的方法有很多,这里我们介绍比较简单的一种,使用base64对图片信息进行编码,然后直接将图片的base64信息存到数据库. 但是对于系统中需要上传的图片较多时并不建议采用这种方式,我们一般会选择存图片路径的方式,这样有助于减小数据库压力,base64 编码后的图片信息是一个很长的字符串,一般我们使用longText类型来将其存入数据库. html代码如下: <div class="col-sm-6"> <img id="headPortraitI

图片上传-下载-删除等图片管理的若干经验总结2

今天再次思考了下图片上传,觉得昨天的有个细节存在问题. 昨天在码代码的时候,没有去考虑删除临时文件的问题.今天,想增加删除临时文件,发现昨天的代码就有问题了. 上次提到: class PhotoBean { //将要删除的,通常是数据库中的 public List<Photo> toDelete; //将要更新的,都在数据库中,部分最新内容来源于web前端 public List<Photo> toUpdate; //将要增加的,由于上传图片的时候都已经插入了,这个时候可以忽略了

分布式网上商城项目-solr搜索功能错误

1.RuntimeException错误 1 java.lang.RuntimeException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.thyonline.taotao.search.mapper.SearchItemMapper.SearchItemList 2 3 org.apache.ibatis.binding.BindingException: Inva

图片上传-下载-删除等图片管理的若干经验总结

图片上传功能很常见,很多人都觉得这个功能很简单,随着要求的提高,这个图片小系统也真是复杂啊. 需求1: 上传,未了达到"大容量存储"."负载均衡"."性能好","有技术含量"等装逼需求,采用了Fastdfs. 注:FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理. 功能包括:文件存储.文件同步.文件访问(文件上传.文件下载)等,解决了大容量存储和负载均衡的问题. 特别适合以文件为载体的在线服务,如相册网站.视频

图片上传预览功能实现

图片预览功能是在网站开发中非常常见的,以前图片预览是一个很简单的功能,只需要JS获得一下上传的路径,然后将路径设置为某一个img标签的src就可以了,但是现在很多浏览器出现安全方面的考虑,都不允许直接获得文件的路径,通过file的value值获得的路径都是带有fakepath,所以获得路径就变得困难,但是H5之后,可以通过JS的fileReader来实现文件的预览:代码如下: JS处理代码: <script type="text/javascript"> document.

asp.net图片上传及删除

方法一:UploadImage cetFU = new UploadImage(); if (cetFU.UpFile(FileUpload1, "teacher_picture"))//如果上传成功 第一个参数表示fileupload插件名称,第二表示文件夹的名称 { ImageName = cetFU.FileName; ImageType = ImageName.Substring(ImageName.IndexOf("."), ImageName.Lengt