idea项目报错Comparison method violates its general contract
作者:互联网
idea项目报错Comparison method violates its general contract!
代码之前是没有任何问题的,早上一上班竟然就报错,然后我就百度了报错信息,看到了一个博主写的非常的详细,我就记录一下我的错误,转载,感谢!
https://www.cnblogs.com/firstdream/p/7204067.html
报错信息
java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeLo(TimSort.java:777) ~[na:1.8.0_201]
at java.util.TimSort.mergeAt(TimSort.java:514) ~[na:1.8.0_201]
at java.util.TimSort.mergeCollapse(TimSort.java:441) ~[na:1.8.0_201]
at java.util.TimSort.sort(TimSort.java:245) ~[na:1.8.0_201]
at java.util.Arrays.sort(Arrays.java:1512) ~[na:1.8.0_201]
at java.util.ArrayList.sort(ArrayList.java:1462) ~[na:1.8.0_201]
at java.util.Collections.sort(Collections.java:175) ~[na:1.8.0_201]
at cn.snn.borad2.Controller.XtendWarehouseIssueController.list(XtendWarehouseIssueController.java:147) ~[classes/:na]
at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.14.jar:5.3.14]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.14.jar:5.3.14]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.14.jar:5.3.14]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.14.jar:5.3.14]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.14.jar:5.3.14]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.14.jar:5.3.14]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) ~[spring-webmvc-5.3.14.jar:5.3.14]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.14.jar:5.3.14]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.14.jar:5.3.14]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.3.14.jar:5.3.14]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:681) ~[tomcat-embed-core-9.0.56.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.14.jar:5.3.14]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.56.jar:4.0.FR]
解决方案:
配置JVM参数为
-Djava.util.Arrays.useLegacyMergeSort=true
JVM的配置教程
https://editor.csdn.net/md/?articleId=122447391
标签:Comparison,5.3,java,14,web,na,jar,idea,报错 来源: https://blog.csdn.net/qq_46056826/article/details/122447568