Runtime Exception - ResourceRole in GUI for Screen Policies

Hi,

logged in with admin,
I tried to create a screen policy and get this runtime exception.
All others are working fine.

Win 10
Idea 2021.2
actual JMIX plugin and version

Regards
Roland

java.lang.RuntimeException: Unable to find value of assign param: fieldWidth
at > io.jmix.ui.sys.ScreenXmlParser.lambda$replaceAssignParameters$0(ScreenXmlParser.java:106)

at io.jmix.core.common.util.Dom4j.walkAttributes(Dom4j.java:229)
at io.jmix.core.common.util.Dom4j.walkAttributesRecursive(Dom4j.java:220)
at io.jmix.core.common.util.Dom4j.walkAttributesRecursive(Dom4j.java:223)
at io.jmix.core.common.util.Dom4j.walkAttributesRecursive(Dom4j.java:223)
at io.jmix.core.common.util.Dom4j.walkAttributesRecursive(Dom4j.java:223)
at io.jmix.core.common.util.Dom4j.walkAttributesRecursive(Dom4j.java:223)
at io.jmix.core.common.util.Dom4j.walkAttributesRecursive(Dom4j.java:223)
at io.jmix.core.common.util.Dom4j.walkAttributesRecursive(Dom4j.java:223)
at io.jmix.core.common.util.Dom4j.walkAttributesRecursive(Dom4j.java:223)
at io.jmix.ui.sys.ScreenXmlParser.replaceAssignParameters(ScreenXmlParser.java:97)
at io.jmix.ui.sys.ScreenXmlParser.parseDescriptor(ScreenXmlParser.java:65)
at io.jmix.ui.sys.ScreenXmlLoader.createDocument(ScreenXmlLoader.java:95)
at io.jmix.ui.sys.ScreenXmlLoader.getDocument(ScreenXmlLoader.java:88)
at io.jmix.ui.sys.ScreenXmlLoader.load(ScreenXmlLoader.java:67)
at io.jmix.ui.WindowConfig.resolveWindowInfo(WindowConfig.java:137)
at io.jmix.ui.WindowConfig$1.getType(WindowConfig.java:107)
at io.jmix.ui.WindowInfo.getType(WindowInfo.java:94)
at io.jmix.securityui.screen.resourcepolicy.ResourcePolicyEditorUtils.lambda$getScreenOptionsMap$2(ResourcePolicyEditorUtils.java:111)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1628)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at io.jmix.securityui.screen.resourcepolicy.ResourcePolicyEditorUtils.getScreenOptionsMap(ResourcePolicyEditorUtils.java:112)
at io.jmix.securityui.screen.resourcepolicy.ScreenResourcePolicyModelCreate.onInit(ScreenResourcePolicyModelCreate.java:68)
at io.jmix.core.common.event.EventHub.publish(EventHub.java:170)
at io.jmix.ui.screen.Screen.fireEvent(Screen.java:124)
at io.jmix.ui.screen.UiControllerUtils.fireEvent(UiControllerUtils.java:58)
at io.jmix.ui.sys.ScreensImpl.fireScreenInitEvent(ScreensImpl.java:1352)
at com.haulmont.cuba.web.sys.CubaScreens.fireScreenInitEvent(CubaScreens.java:619)
at io.jmix.ui.sys.ScreensImpl.createScreen(ScreensImpl.java:223)
at io.jmix.ui.sys.ScreensImpl.create(ScreensImpl.java:133)
at io.jmix.ui.builder.ScreenBuilderProcessor.buildScreen(ScreenBuilderProcessor.java:49)
at io.jmix.ui.builder.ScreenBuilder.build(ScreenBuilder.java:124)
at io.jmix.ui.builder.ScreenClassBuilder.build(ScreenClassBuilder.java:104)
at io.jmix.securityui.screen.resourcerole.ResourceRoleModelEdit.onResourcePoliciesTableCreateScreen(ResourceRoleModelEdit.java:204)
at io.jmix.core.common.event.EventHub.publish(EventHub.java:170)
at io.jmix.ui.action.BaseAction.actionPerform(BaseAction.java:220)
at io.jmix.ui.component.impl.PopupButtonImpl.lambda$setPopupButtonAction$1(PopupButtonImpl.java:321)
at io.jmix.ui.widget.JmixButton.fireClick(JmixButton.java:77)
at com.vaadin.ui.Button$1.click(Button.java:57)
at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:153)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:115)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:442)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:407)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:275)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:83)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1636)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:465)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:121)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:101)
at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:92)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:147)
at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

the same error, when you select one you created via menu policy and click on edit:
image

Hi @r.walde

Please tell what Jmix plugin and version do you use in your project?

Thanks.

Hi,
like I wrote, actual versions.
jmix 1.1.2
plugin 1.1.5 212

I’m trying to reproduce the error. Could you please provide more information about the issue:

  • Addons
  • gradle properties
  • Java version
  • your actions on IDEA before you’ve got the issue.

Hi Elena,

  • it is a migrated cuba app → jmix
  • first noticed that error when I opened the scheduler screen from the migrated app
    the menu entries are still visible… when you click on the create button in the old scheduler screen,
    you might see the same
  • I have ldap and data tools addon installed
  • java 1.8
  • gradle: #Tue Feb 23 11:37:19 CET 2021
    bintrayPremiumRepoUser=********
    premiumRepoUser=*****
    premiumRepoPass=*****
  • usually I do not change anything in IDEA, only whats needed for cuba/jmix

Regards
Roland

@r.walde

Unfortunately, we cannot reproduce the problem. We will be able to help you if you send us a small sample project along with reproduction scenario that demonstrates the issue.

Regards
Elena

Hi,

I sent you a message.

Roland

you could contact your Haulmont colleague Vladimir Agletdinov, he has the project code on his PC…

Hi,

noticed, that the issue does not occur in a new JMIX app.
For the migrated one I added this workaround.
But, would be great to know the reason for the error:
I just changed this line:
throw new RuntimeException("Unable to find value of assign param: " + paramKey);

Roland

@Primary
@Component(“myScreenXmlParser”)
public class my_ScreenXmlParser extends ScreenXmlParser {

@Override
protected void replaceAssignParameters(Document document) {
    Map<String, String> assignedParams = new HashMap<>();

    List<Element> assignElements = document.getRootElement().elements("assign");
    ThemeConstantsManager themeManager = this.themeConstantsManager;
    for (Element assignElement : assignElements) {
        String name = assignElement.attributeValue("name");
        if (StringUtils.isEmpty(name)) {
            throw new RuntimeException("'name' attribute of assign tag is empty");
        }

        String value = assignElement.attributeValue("value");
        if (StringUtils.isEmpty(value)) {
            throw new RuntimeException("'value' attribute of assign tag is empty");
        }

        if (StringUtils.startsWith(value, ThemeConstants.PREFIX)) {
            ThemeConstants theme = themeManager.getConstants();
            value = theme.get(value.substring(ThemeConstants.PREFIX.length()));
        }

        assignedParams.put(name, value);
    }

    if (!assignedParams.isEmpty()) {
        Element layoutElement = document.getRootElement().element("layout");
        if (layoutElement != null) {
            Dom4j.walkAttributesRecursive(layoutElement, (element, attribute) -> {
                String attributeValue = attribute.getValue();
                if (StringUtils.isNotEmpty(attributeValue)
                        && attributeValue.startsWith("${")
                        && attributeValue.endsWith("}")) {
                    String paramKey = attributeValue.substring(2, attributeValue.length() - 1);

                    String assignedValue = assignedParams.get(paramKey);
                    if (assignedValue == null) {
                        assignedValue = "0";
                        //throw new RuntimeException("Unable to find value of assign param: " + paramKey);
                        System.out.println("RuntimeException(\"Unable to find value of assign param: " + paramKey);
                    }

                    attribute.setValue(assignedValue);
                }
            });
        }

    }

}

}

Hi,

the issue got solved after deleting this line from build.gradle:
implementation “io.jmix.cuba:jmix-cuba-starter”

Together with ‘no more’ imports from the old Cuba classes,
all Cuba Administration menu entries disappeared and I could delete my own ScreenXmlParser.

Regards Roland

1 Like