05-19-2021 10:50 AM
Hello.
I'm use java api when set permission to nodeRef:
permissionService.setPermission(nodeRef, userName, PermissionService.CONTRIBUTOR, true);
but when I see nodeRef in my node browser I don't see the assigned rights for this user.
All what I see in my alfresco log is this(I think this is a consequence):
2021-05-19T14:28:21.816860615Z Caused by: org.apache.ibatis.reflection.ReflectionException: Error instantiating class java.util.ArrayList with invalid types () or values (). Cause: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
2021-05-19T14:28:21.816865845Z at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:90)
2021-05-19T14:28:21.816870724Z at org.apache.ibatis.reflection.factory.DefaultObjectFactory.create(DefaultObjectFactory.java:50)why its not work?
05-20-2021 02:45 PM
I found problem, that was in my script task variable.
05-20-2021 04:42 AM
05-20-2021 04:48 AM
Are you executing that line as Alfresco Administrator?
05-20-2021 10:32 AM
Class from activiti:
<scriptTask id="initializeNextStep" name="Initialize next step" scriptFormat="javascript" activiti:autoStoreVariables="false">
<extensionElements>
<activiti:executionListener event="start" class="ru.customorg.repo.workflow.planning.StartStepExecutionListener"></activiti:executionListener>
</extensionElements>
<script><![CDATA[execution.setVariable('cowf_isRejected', false);]]></script>
</scriptTask>Part of code from that class:
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>() {
@Override
public Void doWork() {
try {
FilePermissionServiceImpl filePermissionService = (FilePermissionServiceImpl) WorkflowUtils
.getServiceRegistry()
.getService(QName.createQName(null, FilePermissionServiceImpl.BEAN));
filePermissionService.addPermissions(docRef, userName);
} catch (Exception e) {
LOGGER.error("StartStepExecution permission error ", e);
}
return null;
}
}, AuthenticationUtil.getSystemUserName());here my full stack trace:
2021-05-20T14:19:01.465071292Z Warning: Nashorn engine is planned to be removed from a future JDK release
2021-05-20T14:19:01.521319176Z 2021-05-20 14:19:01,508 ERROR [impl.interceptor.CommandContext] [http-nio-8080-exec-6] Error while closing command context
2021-05-20T14:19:01.521370262Z org.apache.ibatis.exceptions.PersistenceException:
2021-05-20T14:19:01.521377505Z ### Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: Error instantiating class java.util.ArrayList with invalid types () or values (). Cause: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
2021-05-20T14:19:01.521384078Z ### The error may exist in org/activiti/db/mapping/entity/HistoricVariableInstance.xml
2021-05-20T14:19:01.521410577Z ### The error may involve org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.selectHistoricVariableInstanceByVariableInstanceId
2021-05-20T14:19:01.521417821Z ### The error occurred while handling results
2021-05-20T14:19:01.521422039Z ### SQL: select * from ACT_HI_VARINST where ID_ = ?
2021-05-20T14:19:01.521426327Z ### Cause: org.apache.ibatis.reflection.ReflectionException: Error instantiating class java.util.ArrayList with invalid types () or values (). Cause: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
2021-05-20T14:19:01.521430855Z at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
2021-05-20T14:19:01.521435464Z at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:122)
2021-05-20T14:19:01.521440473Z at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:113)
2021-05-20T14:19:01.521444972Z at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:73)
2021-05-20T14:19:01.521448689Z at org.activiti.engine.impl.db.DbSqlSession.selectOne(DbSqlSession.java:455)
2021-05-20T14:19:01.521453337Z at org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntityManager.findHistoricVariableInstanceByVariableInstanceId(HistoricVariableInstanceEntityManager.java:67)
2021-05-20T14:19:01.521458136Z at org.activiti.engine.impl.history.DefaultHistoryManager.recordVariableUpdate(DefaultHistoryManager.java:692)
2021-05-20T14:19:01.521462975Z at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.updateVariableInstance(VariableScopeImpl.java:829)
2021-05-20T14:19:01.521468135Z at org.activiti.engine.impl.persistence.entity.ExecutionEntity.updateVariableInstance(ExecutionEntity.java:1208)
2021-05-20T14:19:01.521473685Z at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariableLocal(VariableScopeImpl.java:710)
2021-05-20T14:19:01.521478304Z at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:617)
2021-05-20T14:19:01.521482953Z at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:590)
2021-05-20T14:19:01.521487721Z at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$5$\^eval\_/0x00000008013a4440.:program(<eval>:1)
2021-05-20T14:19:01.523356955Z ... 368 more
2021-05-20T14:19:01.523361324Z Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
2021-05-20T14:19:01.523366203Z at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
2021-05-20T14:19:01.523370871Z at java.base/java.security.AccessController.checkPermission(AccessController.java:895)
2021-05-20T14:19:01.523375530Z at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:322)
2021-05-20T14:19:01.523386521Z at java.base/java.lang.Class.checkMemberAccess(Class.java:2848)
2021-05-20T14:19:01.523392111Z at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2550)
2021-05-20T14:19:01.523396830Z at org.apache.ibatis.reflection.factory.DefaultObjectFactory.instantiateClass(DefaultObjectFactory.java:62)
2021-05-20T14:19:01.523401459Z ... 381 more
05-20-2021 02:45 PM
I found problem, that was in my script task variable.
05-21-2021 05:40 AM
Hi @sergus_dev
Thanks for updating your thread.
Best wishes,
Explore our Alfresco products with the links below. Use labels to filter content by product module.