javaspringwicketwicket-8

org.apache.wicket.markup.MarkupNotFoundException: Markup not found for Component: [TreeTableItem [Component id = 0]]


I am getting below error after upgrading the Wicket framework from 6.x to 8.x. Where I updated the below dependency to keep the deprecated TreeTable code in wicket 8.x.

<dependency>
    <groupId>org.wicketstuff</groupId>
    <artifactId>wicket15-tree</artifactId>
    <version>8.0.0</version>
</dependency>

@SuppressWarnings({ "deprecation" })
private void myTreePage() {
    TreeTable myTestTree = new TreeTable("myTestTreeTable", new DefaultTreeModel(myTestRootNode), cols);
    statusImport();
    myTestTree.setRootLess(true);
    myTestTree.setOutputMarkupId(true);
    addOrReplace(myTestTree);
}




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" xml:lang="en" lang="en">
    <body>
        <wicket:extend>
            <div class="statusMsg"><span wicket:id="runIds"></span></div>
            <div class="query_table_header"><label>Import Table</label></div>
            <div wicket:id="myTestTreeTable"></div>
            <form wicket:id="form">
                <div wicket:id="countFilter">
                     <div class="query_table_header"><label>status</label></div>
                </div>
                <div><label>Entity: </label> <select wicket:id="selectEntity"/> <label>Status: </label> <select wicket:id="selectStatus"/></div>
            <input type="submit" value="select" wicket:id="select"/> <input type="submit" wicket:id="bucket" value="Start Reprocessing" />
            </form>
        </wicket:extend>
    </body>
</html>

As I found if I remove the tag then page is loading without any error. I think here issue is looking with the tag placement or tag definition.


ERROR | Exception occured: org.apache.wicket.markup.MarkupNotFoundException: Markup not found for Component: [TreeTableItem [Component id = 0]] at org.apache.wicket.Component.internalRender(Component.java:2267) at org.apache.wicket.Component.render(Component.java:2227) at org.apache.wicket.extensions.markup.html.tree.table.MiddleColumnsView.onRender(MiddleColumnsView.java:189) at org.apache.wicket.Component.internalRender(Component.java:2296) at org.apache.wicket.Component.render(Component.java:2227) at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1454) at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1654) at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1629) at org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer.java:798) at org.apache.wicket.markup.html.panel.AssociatedMarkupSourcingStrategy.renderAssociatedMarkup(AssociatedMarkupSourcingStrategy.java:77) at org.apache.wicket.markup.html.panel.PanelMarkupSourcingStrategy.onComponentTagBody(PanelMarkupSourcingStrategy.java:112) at org.apache.wicket.Component.internalRenderComponent(Component.java:2491) at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1593) at org.apache.wicket.Component.internalRender(Component.java:2296) at org.apache.wicket.Component.render(Component.java:2227) at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1454) at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1654) at org.apache.wicket.Page.onRender(Page.java:858) at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:126) at org.apache.wicket.Component.internalRender(Component.java:2296) at org.apache.wicket.Component.render(Component.java:2227) at org.apache.wicket.Page.renderPage(Page.java:998) at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:124) at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:236) at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:202) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:914) at org.apache.wicket.request.RequestHandlerExecutor.execute(RequestHandlerExecutor.java:65) at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:282) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:253) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:221) at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:275) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:206) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:299) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:118) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:158) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:204) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:92) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:77) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) 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:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:543) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:615) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:818) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1623) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunn


Solution

  • I resolved the exception after replacing TreeTable class to TableTree class.

    Please refer to below code:

        private final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("<root>");
    DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);
    
            ITreeProvider<DefaultMutableTreeNode> modelProvider = new TreeModelProvider<DefaultMutableTreeNode>(treeModel, false) {
                private static final long serialVersionUID = 1L;
                @Override
                public IModel<DefaultMutableTreeNode> model(DefaultMutableTreeNode object) {
                    return Model.of(object);
                }
            };
            
            TableTree<DefaultMutableTreeNode, String> myTestTree = new TableTree<DefaultMutableTreeNode, String>("myTestTreeTable", createColumns(), modelProvider, Long.MAX_VALUE) {
                private static final long serialVersionUID = 1L;
                @Override
                protected Component newContentComponent(String id, IModel<DefaultMutableTreeNode> model) {
                    //return new CheckedFolder<DefaultMutableTreeNode>(id, this, model);
                    return new Folder<DefaultMutableTreeNode>(id, this, model);
                }
            };
            
            //myTestTree.getTable().addTopToolbar(new HeadersToolbar<>(myTestTree.getTable(), null));
            //myTestTree.getTable().addBottomToolbar(new NoRecordsToolbar(myTestTree.getTable()));
            myTestTree.setOutputMarkupId(true);
            myTestTree.add(new WindowsTheme());
            //myTestTree.setItemReuseStrategy(new ReuseIfModelsEqualStrategy());
            //myTestTree.getTable().add(AttributeModifier.replace("class", "table table-striped table-condensed"));
            myTestTree.getTable().add(AttributeModifier.replace("style", "width: 100%; background-color:white;"));
            addOrReplace(myTestTree);
    

    Tree table date is displaying perfectly but table column heading's name is not displaying in the page. Please refer the column creation code.

        private List<? extends IColumn<DefaultMutableTreeNode, String>> createColumns() {
        columns.add(new TreeColumn<>(new Model("Tree"), "obj.text"));
        columns.add(new PropertyColumn<>(new Model("FileStatus"), "FileStatus", "obj.fileStatus"));
        columns.add(new PropertyColumn<>(new Model("StartDate"), "StartDate", "obj.startDate"));
        columns.add(new PropertyColumn<>(new Model("LastDate"), "LastDate", "obj.lastDate"));
        columns.add(new PropertyColumn<>(new Model("Count"), "Count", "obj.count"));
        return columns;
    }