我经常在生产日志中发现这个错误-“找不到id为'text'的组件”。我无法复制它。这个错误的原因是什么?如何修复?
在代码中,我有一个面板toolbarpanel,其中包含id=“exit”的其他面板,该面板包含id=“text”的标签。
我发现类似的问题,但它不能解决我的问题找不到id为“fooppopup”的组件
工具栏面板.java
public ToolBarPanel(String id, String pageName, String userName, List<ToolbarMenuItem> menuItems, final Class<?> thisPage) {
super(id);
setOutputMarkupId(true);
// some piece of code here ...
// 1st exit is ID, AlfaAjaxLink extends Panel
add(new AlfaAjaxLink("exit", "exit") {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
dialog.setInitialHeight(130).setInitialWidth(270);
dialog.show(target);
}
});
ListView<ToolbarMenuItem> menu = new ListView<ToolbarMenuItem>("menuItems", menuItems) {
@Override
protected void populateItem(ListItem<ToolbarMenuItem> item) {
final ToolbarMenuItem menuItem = item.getModelObject();
String cssClassName = menuItem.getPage().equals(thisPage) ? "selected-toolbar-menu-item" : "toolbar-menu-item";
item.add(new AlfaAjaxLink("menuItem", menuItem.getName(), cssClassName, "FFFFFF") {
@Override
public void onClick(AjaxRequestTarget target) {
setResponsePage(getResponsePage(menuItem));
}
});
}
};
add(menu);
}
alfaajaxlink.java(扩展按钮)
public AlfaAjaxLink(String id, String text) {
this(id, text, null, null);
}
public AlfaAjaxLink(String id, String text, String cssClassName, String textColor) {
super(id);
init(text, cssClassName, textColor);
}
private void init(String text, String cssClassName, String textColor) {
AjaxLink button = createAjaxLink();
label = createLabel(text);
if (textColor != null) {
label.add(AttributeModifier.replace("style", "color : #" + textColor));
}
if (cssClassName != null) {
button.add(AttributeModifier.replace("class", cssClassName));
}
button.add(label);
add(button);
}
protected Label createLabel(String text) {
// here is ID text
return new Label("text", text);
}
主页.java
public class HomePage extends AAppBasePage {
private static final long serialVersionUID = -6944890517661999946L;
public HomePage() {
super("Home Page");
setOutputMarkupId(true);
if (getUsersDebtorType() != null) {
throw new RestartResponseException(MyClass.class);
} else {
add(new Label("text", "SomeText"));
}
}
}
主页.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:wicket="http://wicket.sourceforge.net/">
<wicket:extend>
<div class="rsftextlabel"><div wicket:id="text"></div></div>
</wicket:extend>
</html>
工具栏面板.html
<html xmlns:wicket="http://wicket.sourceforge.net/">
<wicket:panel>
<div wicket:id="logoutDialog"></div>
<div style="width : 100%">
<TABLE cellSpacing="0" cellPadding="2px" width="100%" border="0">
<TBODY>
<TR>
<td><img width="48px" height="48px" wicket:id="logo"></img></td>
<TD align="left" width="100%">
<table>
<tr>
<td style="font-size: 18px;">My application</td>
<td style="font-size: 18px;"> / </td>
<td style="font-size: 18px;"><div wicket:id="pageName"></div></td>
</tr>
</table>
</TD>
<TD vAlign="middle" noWrap>
<table>
<tr>
<td><table>
<tr><td colspan="2"><div wicket:id="surname"></div></td></tr>
<tr><td><div wicket:id="name"></div></td><td><div wicket:id="patronymic"></div></td></tr>
</table></td>
<td> </td>
<td valign="center"><div wicket:id="exit"></div></td>
</tr>
</table>
</td>
</TR>
</TBODY>
</TABLE>
</div>
<div style="margin-top: 10px; margin-bottom: 1px; background-color: #A3A3A3; widht: 150%; margin-left: -10px; margin-right: -10px; height : 5px;"></div>
<div style="width : 100%">
<span wicket:id="menuItems">
<a wicket:id="menuItem"></a>
</span>
</div>
</wicket:panel>
</html>
按钮.html
<html xmlns:wicket="http://wicket.sourceforge.net/">
<wicket:panel>
<a wicket:id="button" class="alfa-button">
<span wicket:id="text" class="alfa-button-text"></span>
<wicket:child/>
</a>
</wicket:panel>
</html>
日志
ERROR [org.apache.wicket.DefaultExceptionMapper] (default task-189) Unexpected error occurred: Unable to find component with id 'text' in [TransparentWebMarkupContainer [Component id = _wicket_extend44]]
Expected: '_wicket_child31:_wicket_extend32:_wicket_child43:_wicket_extend44.text'.
Found with similar names: 'toolBarPanel:exit', toolBarPanel:exit:button:text', toolBarPanel:menuItems:0:menuItem:button:text', toolBarPanel:menuItems:1:menuItem:button:text', toolBarPanel:menuItems:2:menuItem:button:text', toolBarPanel:menuItems:3:menuItem:button:text', toolBarPanel:menuItems:4:menuItem:button:text', toolBarPanel:menuItems:5:menuItem:button:text', toolBarPanel:menuItems:6:menuItem:button:text', toolBarPanel:menuItems:7:menuItem:button:text', toolBarPanel:menuItems:8:menuItem:button:text'
MarkupStream: [markup = file:/JBOSS/AppServer_FSSP_J7/standalone/tmp/vfs/temp/temp8f5ee2f7c4f4e6b2/content-e7709a14d279cc75/ru/cinimex/alfa/fssp/ui/wicket/pages/HomePage.html
<wicket:extend>
<div class="rsftextlabel"><div wicket:id="text"></div></div>
</wicket:extend>, index = 2, current = '<div wicket:id="text">' (line 0, column 0)]
at org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:526) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1473) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1592) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1567) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1521) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:72) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.internalRenderComponent(Component.java:2563) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1530) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.internalRender(Component.java:2393) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.render(Component.java:2321) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1428) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1592) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1567) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1521) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:72) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.internalRenderComponent(Component.java:2563) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1530) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.internalRender(Component.java:2393) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.render(Component.java:2321) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1428) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1592) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1567) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1521) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:72) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.internalRenderComponent(Component.java:2563) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1530) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.internalRender(Component.java:2393) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.render(Component.java:2321) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1428) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1592) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1567) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1521) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:72) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.internalRenderComponent(Component.java:2563) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1530) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.internalRender(Component.java:2393) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.render(Component.java:2321) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1428) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1592) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Page.onRender(Page.java:907) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:140) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.internalRender(Component.java:2393) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Component.render(Component.java:2321) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.Page.renderPage(Page.java:1035) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:118) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:198) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) [wicket-request-1.5.10.jar:1.5.10]
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188) [wicket-core-1.5.10.jar:1.5.10]
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244) [wicket-core-1.5.10.jar:1.5.10]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:55)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1504)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:99) [undertow-servlet-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830) [undertow-core-2.0.28.SP1-redhat-00001.jar:2.0.28.SP1-redhat-00001]
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_144]
2条答案
按热度按时间tgabmvqs1#
alfaajaxlink不是问题所在。
搜索
<div class="rsftextlabel">
在标记文件中。这个<div>
元素包含有问题的<div wicket:id="text"></div>
. 似乎没有为它添加java组件。ycl3bljg2#
不幸的是,1.5已经很旧了,它错过了许多针对这样的用例所做的改进和bug修复。我认为你所面临的问题已经用这个补丁解决了:
https://issues.apache.org/jira/browse/wicket-5580