错误 |发生异常:org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException:行为拒绝接口调用

ERROR | Exception occured: org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException: Behavior rejected interface invocation

我将我的应用程序从 Wicket 6.x 升级到 Wicket 8.x 并且还替换了 ButtonA​​jaxButton class 到 IndicatingAjaxButton class。单击提交按钮 link.

我遇到以下错误
IndicatingAjaxButton btnSubmit = new IndicatingAjaxButton("submit") {
        private static final long serialVersionUID = 1L;
        @SuppressWarnings("rawtypes")
        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            AjaxLazyLoadPanel panel = new AjaxLazyLoadPanel("cnt2") {
                private static final long serialVersionUID = 1L;
                @Override
                public Component getLazyLoadComponent(String markupId) {
                    try {
                        return new ContractClassPanel(markupId, null, getIdentifier(), getTimelines());
                    } catch (ContractException e) {
                        throw new RuntimeException("", e);
                    }
                }
            };
            panel.setOutputMarkupId(true);
            form.setVisible(false);
            AbstractContractsClassPage.this.replace(panel);
            target.focusComponent(AbstractContractsClassPage.this);
        }
        @Override
        protected void onError(AjaxRequestTarget target) {
            super.onError();
        }           
    };

错误 |异常发生: org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedException: 行为拒绝接口调用。组件:[AjaxButton [Component id = submit]] 行为:org.apache.wicket.ajax.markup.html.form.AjaxButton$1@591549f6 在 org.apache.wicket.core.request.handler.ListenerRequestHandler.invoke(ListenerRequestHandler.java:276) 在 org.apache.wicket.core.request.handler.ListenerRequestHandler.invokeListener(ListenerRequestHandler.java:222) 在 org.apache.wicket.core.request.handler.ListenerRequestHandler.respond(ListenerRequestHandler.java:208) 在 org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:914) 在 org.apache.wicket.request.RequestHandlerExecutor.execute(RequestHandlerExecutor.java:65) 在 org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:282) 在 org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:253) 在 org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:221) 在 org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:275) 在 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:206) 在 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:299) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) 在 org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) 在 org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 在 org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 在 org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 在 org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 在 org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 在 org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 在 org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 在 org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:204) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 在 org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92) 在 org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 在 org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) 在 org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 在 org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) 在 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) 在 org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) 在 org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) 在 org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) 在 org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 在 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) 在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) 在 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:543) 在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) 在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) 在 org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688) 在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) 在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) 在 org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:615) 在 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) 在 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:818) 在 org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1623) 在 org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 在 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 在 java.lang.Thread.run(Thread.java:748)

我错过了在表单中添加当前 class (AbstractContractsClassPage.this) 的代码。我调用了错误的方法 focusComponent() 而不是 add()。

我在调用 add() 方法而不是 focusComponent() 方法后得到了解决方案。

        protected void onSubmit(AjaxRequestTarget target) {
            AjaxLazyLoadPanel panel = new AjaxLazyLoadPanel("cnt2") {
                private static final long serialVersionUID = 1L;
                @Override
                public Component getLazyLoadComponent(String markupId) {
                    try {
                        return new ContractClassPanel(markupId, null, getIdentifier(), getTimelines());
                    } catch (ContractException e) {
                        throw new RuntimeException("", e);
                    }
                }
            };
            panel.setOutputMarkupId(true);
            form.setVisible(false);
            AbstractContractsClassPage.this.replace(panel);
            **target.add(AbstractContractsClassPage.this);**
        }