java.lang.UnsupportedOperationException: A TupleBackedMap cannot be modified.解决以及探究
java.lang.UnsupportedOperationException: A TupleBackedMap cannot be modified.
at org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap.put(AbstractJpaQuery.java:390) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
at org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap.put(AbstractJpaQuery.java:323) ~[spring-data-jpa-2.1.8.RELEASE.jar:2.1.8.RELEASE]
at cn.exrick.xboot.modules.system.serviceimpl.FileManageServiceImpl.findNameByFileId(FileManageServiceImpl.java:191) ~[classes/:na]
at cn.exrick.xboot.modules.system.serviceimpl.FileManageServiceImpl$$FastClassBySpringCGLIB$$72ffea60.invoke(<generated>) ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295) ~[spring-tx-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) ~[spring-tx-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) ~[spring-aop-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at cn.exrick.xboot.modules.system.serviceimpl.FileManageServiceImpl$$EnhancerBySpringCGLIB$$23c87bfa.findNameByFileId(<generated>) ~[classes/:na]
at cn.exrick.xboot.modules.system.controller.FileManageController.findNameByFileId(FileManageController.java:184) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_66]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_66]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_66]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_66]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) ~[spring-webmvc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) ~[spring-webmvc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039) ~[spring-webmvc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) [spring-webmvc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) [spring-webmvc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) [spring-webmvc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.19.jar:9.0.19]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.19.jar:9.0.19]
这个已经算是我们开发中经常遇到的问题了,其实就是不可操作map的一个异常,解决呢也比较好解决,直接new 一个新的map,将原有的map数据装进去,然后再进行修改,就不会发生异常了,下面先给大家看一下我的原错误代码以及修改后的代码。
修改前:
Map<String, Object> nameByFileId = fileManageDao.findNameByFileId(id);
nameByFileId.put("filePath",imagesUrl+nameByFileId.get("filePath"));
return nameByFileId;
修改后:
Map<String, Object> nameByFileId = fileManageDao.findNameByFileId(id);
Map<String, Object> newMap = new HashMap<>(nameByFileId);
newMap.put("filePath",imagesUrl+nameByFileId.get("filePath"));
return newMap;
java.lang.UnsupportedOperationException: A TupleBackedMap cannot be modified.解决以及探究的更多相关文章
- Caused by: java.lang.UnsupportedOperationException
对Arrays.asList()返回的List进行操作之后报错Caused by: java.lang.UnsupportedOperationException 让我们来看一下Arrays.asLi ...
- java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12
最近使用Android Studio开发一个新项目,刚做完几个界面,跑在android 5.0上面很正常,因为都是挺简单的布局,本以为应该不存在兼容性问题(Flag啊). 偶然用了一个4.x的实机测试 ...
- java.lang.UnsupportedOperationException: Not supported by BasicDataSource
场景: SpringMVC+Hibernate+Maven 问题: 在src/main/resources 目录中添加hibernate.properties文件, 则如果存在这句hibernate. ...
- mybatis java.lang.UnsupportedOperationException
mybatis抛出下面的异常: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exc ...
- 异常:java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession
使用mybatis-3.2.2.jar + mybatis-spring-1.2.0.jar集成时,报以下异常: 15:42:48.538 [Thread-1] DEBUG o.s.b.f.s.Dis ...
- java 异常java.lang.UnsupportedOperationException
在项目中采用一个枚举的集合,本人采用Collections中的空集合Collections.emptyList()在添加时发生异常: 常见集合如下: private List<VacationC ...
- java.lang.UnsupportedOperationException
在运行路况预测这个项目时,报错出现:java.lang.UnsupportedOperationException 原因:我将1.3版本和1.6版本的两个jar包都Add to Build Path ...
- ArrayList Iterator remove java.lang.UnsupportedOperationException
在使用Arrays.asList()后调用add,remove这些method时出现 java.lang.UnsupportedOperationException异常.这是由于Arrays.asLi ...
- HibernateProxy异常处理 java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: org.hibernate.proxy.HibernateProxy. Forgot to register a type adapter?
这里使用google的Gson包做JSON转换,因为较早的1.4版本的FieldAttributes类中没有getDeclaringClass()这个方法,这个方法是获取field所属的类,在我的排除 ...
随机推荐
- Java多线程同步_synchronized
1.synchronized是什么?synchronized是Java中的关键字,是一种同步锁.它修饰的对象有以下几种:1. 修饰一个代码块,被修饰的代码块称为同步语句块,其作用的范围是大括号{}括起 ...
- foreach循環體控制
通常情況下,在程式中的cursor定義之前,整合了l_sql變量后,轉化sql語句時,通過檢查STATUS的值來判斷sql語句是否有錯誤. 語句如: if STATUS th ...
- js对象数组新增、修改时的验证是否重复的逻辑
JS代码: // 定义数据集合 const persons = [ { id: 1, name: '张三' }, { id: 2, name: '李四' } ] console.log('') con ...
- 滑动窗口(Sliding Window)技巧总结
什么是滑动窗口(Sliding Window) The Sliding Problem contains a sliding window which is a sub – list that run ...
- Android开发之数据存储——SharedPreferences基础知识详解,饿补学会基本知识,开发者必会它的用法。
一.数据存储选项:Data Storage --Storage Options[重点] 1.Shared Preferences Store private primitive data in key ...
- c++ binding code generator based on clang
google it http://www.swig.org/Doc3.0/CSharp.html http://samanbarghi.com/blog/2016/12/06/generate-c-i ...
- html中实现倒计时功能(setInterval,clearInterval)
倒计时主要用到的知识点:1.设置时间间隔的setInterval可以被clearInterval取消 2.毫秒转换为时分格式 这个是效果图 下面是js中的函数 var shijian=3600; va ...
- 使用Javax.mail 发送邮件
使用Javax.mail 发送邮件 详细说明都在代码中: 引入依赖 <!--sun定义的一套接收.发送电子邮件的API--> <dependency> < ...
- Roads in the North (树的直径)
Building and maintaining roads among communities in the far North is an expensive business. With thi ...
- K - Queries for Number of Palindromes(区间dp+容斥)
You've got a string s = s1s2... s|s| of length |s|, consisting of lowercase English letters. There a ...