本文介绍了为什么在 .parallel() 期间出现 MyBatisSystemException.在 Alfresco 6.2 中执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将 Alfresco 表单 5.2 版升级到 6.2 版后,它变得不稳定:有时我们会:

After an upgrade Alfresco form version 5.2 to version 6.2 it became unstable: sometimes we got :

org.mybatis.spring.MyBatisSystemException: nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Error instantiating class java.util.ArrayList with invalid types () or values

通常在 .parallel() 期间.集合执行.有完整的堆栈跟踪 https://pastebin.com/7d7NBwkn 并且有代码 https://pastebin.com/RyPt5d0g.其实我连一个控制流都看不懂,为什么要涉及到MyBatis?

Usually during .parallel(). collection execution. There is full stack trace https://pastebin.com/7d7NBwkn and there is the code https://pastebin.com/RyPt5d0g . Actually I even can not understand a flow of control, why MyBatis is involved?

请帮帮我!

谢谢!

PS:实际上这个错误不能很好地重现.当我删除 .parallel() 时,此异常不会出现.并使用单线程流处理.

PS: Actually this error is not reproducible well. This exception doesn't rise when I remove .parallel(). and use single thread stream processing.

UPD:以下代码在 .parallel() 的情况下引发异常.执行并且在串行执行的情况下不会引发异常:

UPD: the following code rises an exception in case of .parallel(). execution and does not rise an exception in case of serial execution:

final SecurityManager sm = System.getSecurityManager();
   if (sm != null) {
        sm.checkPermission(new RuntimePermission("accessDeclaredMembers"));
    }

UPD 2 解决方案: 在 Alfresco 5.2 版中 System.getSecurityManager() == NULL (!!!) 但在 6.2 版中.它已经建立.这是不同行为的问题(https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ForkJoinPool.html).V 6.2 设置了 SecurityManager 和 V 5.2.没有.解决方案是将 Dockerfile 中的 catalina.sh 替换为新修改的 cataliha.sh,该文件已删除安全 JVM 选项.

UPD 2 SOLUTION: in Alfresco version 5.2 System.getSecurityManager() == NULL (!!!) but in version 6.2. it has been set up. That is the matter of different behavior (details in https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ForkJoinPool.html). V 6.2 set up the SecurityManager and v 5.2. doesn't. The solution was the replacement catalina.sh in Dockerfile to new modified cataliha.sh which has removed security JVM options.

推荐答案

此异常来自 Java 安全管理器.如果您使用的是 Alfresco docker 镜像,则默认情况下启用安全管理器.如果您已经完成了非 docker 安装,那么您将使用-security"命令启动 tomcat.转变.虽然推荐使用安全管理器是因为它使您的安装更加安全,但它不是必需的.

This exception comes from the Java Security manager. If you are using the Alfresco docker images, the security manager is enabled by default. If you have done a non-docker installation, you are launching tomcat using the "-security" switch. While the security manager is recommended because it makes your installation more secure, it is not required.

如果您使用的是 Alfresco 的 docker 镜像,您将需要修改 docker-compose.yml 文件并指定一个命令";为露天"辩护服务.开箱即用的命令"参数是 [catalina.sh";跑"-安全"].您需要删除-security"旗帜.例如:

If you are using Alfresco's docker images, you will need to modify the docker-compose.yml file and specify a "command" argument for the "alfresco" service. Out of the box, the "command" argument is ["catalina.sh" "run" "-security"]. You need to remove the "-security" flag. For example:

...
services:
    alfresco:
        image: alfresco/alfresco-content-repository-community:6.2.0-ga
        command: ["catalina.sh" "run"]
...

如果您手动安装了 Alfresco,您只需更改启动方式即可.删除-security"标志.

If you have installed Alfresco manually, you simply need to change the way that you are starting it. Remove the "-security" flag.

根据:

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ForkJoinPool.html

使用并行执行会导致线程在没有安全配置的情况下产生.这意味着对于这种情况,除非禁用安全管理器,否则无法使用并行执行.因此,您的选择是使用上述步骤禁用安全管理器或使用串行执行.

Using parallel execution causes threads to spawn with no security configuration. This means that for this situation, you cannot use parallel execution unless you disable the security manager. So your choices are to disable the security manager using the above steps or to use serial execution.

这篇关于为什么在 .parallel() 期间出现 MyBatisSystemException.在 Alfresco 6.2 中执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 09:30