gpt4 book ai didi

Java: Wicket 口无法找到组件

转载 作者:行者123 更新时间:2023-11-30 06:16:43 25 4
gpt4 key购买 nike

尝试重新打包由其他开发人员维护的内容并遇到 wicket 组件问题。老实说,只是在正确的方向上寻找一个点来缩小这里实际发生的事情的范围。我无权访问我已反编译的仅编译的 war 的源代码。这看起来在他们完美的环境中运行时运行正常,但我需要运行稍微不同的 java 版本。

从这个错误看来,它只是找不到“feature”组件。我怎样才能回溯这个?反编译 ServerStatusPage 的类我只看到“features”作为一个变量。有没有一种快速的方法可以暂时删除状态页面的违规区域并重新打包 war 文件?当我尝试时,我最终遇到了更多问题,说我排除了应该存在的组件。

运行时的完整错误如下:

2018-02-28 23:04:02,603 ERROR [wicket.RequestCycle] (default task-23) Unable to find component with id 'feature' in [MarkupContainer [Component id = 0, page = extensis.esp.webadmin.pages.serverstatus.ServerStatusPage, path = 7:features:0.ListItem, isVisible = true, isVersioned = true]]. This means that you declared wicket:id=feature in your markup, but that you either did not add the component to your page at all, or that the hierarchy does not match.
[markup = vfs:/content/ROOT.war/WEB-INF/classes/extensis/esp/webadmin/pages/serverstatus/ServerStatusPage.html, index = 34, current = '<span wicket:id="feature">' (line 52, column 6)]: wicket.markup.MarkupException: Unable to find component with id 'feature' in [MarkupContainer [Component id = 0, page = extensis.esp.webadmin.pages.serverstatus.ServerStatusPage, path = 7:features:0.ListItem, isVisible = true, isVersioned = true]]. This means that you declared wicket:id=feature in your markup, but that you either did not add the component to your page at all, or that the hierarchy does not match.
[markup = vfs:/content/ROOT.war/WEB-INF/classes/extensis/esp/webadmin/pages/serverstatus/ServerStatusPage.html, index = 34, current = '<span wicket:id="feature">' (line 52, column 6)]
at wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:290) [wicket.jar:]
at wicket.MarkupContainer.renderNext(MarkupContainer.java:1381) [wicket.jar:]
at wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:982) [wicket.jar:]
at wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:917) [wicket.jar:]
at wicket.Component.renderComponent(Component.java:1712) [wicket.jar:]
at wicket.MarkupContainer.onRender(MarkupContainer.java:927) [wicket.jar:]
at wicket.Component.render(Component.java:1526) [wicket.jar:]
at wicket.markup.html.list.ListView.renderItem(ListView.java:680) [wicket.jar:]
at wicket.markup.html.list.ListView.onRender(ListView.java:641) [wicket.jar:]
at wicket.Component.render(Component.java:1526) [wicket.jar:]
at wicket.MarkupContainer.renderNext(MarkupContainer.java:1334) [wicket.jar:]
at wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:982) [wicket.jar:]
at wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:917) [wicket.jar:]
at wicket.Component.renderComponent(Component.java:1712) [wicket.jar:]
at wicket.MarkupContainer.onRender(MarkupContainer.java:927) [wicket.jar:]
at wicket.Component.render(Component.java:1526) [wicket.jar:]
at wicket.MarkupContainer.renderNext(MarkupContainer.java:1334) [wicket.jar:]
at wicket.MarkupContainer.renderAll(MarkupContainer.java:944) [wicket.jar:]
at wicket.Page.onRender(Page.java:864) [wicket.jar:]
at wicket.Component.render(Component.java:1526) [wicket.jar:]
at wicket.Page.renderPage(Page.java:413) [wicket.jar:]
at wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:226) [wicket.jar:]
at wicket.request.compound.DefaultResponseStrategy.respond(DefaultResponseStrategy.java:49) [wicket.jar:]
at wicket.request.compound.AbstractCompoundRequestCycleProcessor.respond(AbstractCompoundRequestCycleProcessor.java:66) [wicket.jar:]
at wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:902) [wicket.jar:]
at wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:929) [wicket.jar:]
at wicket.RequestCycle.step(RequestCycle.java:1010) [wicket.jar:]
at wicket.RequestCycle.steps(RequestCycle.java:1084) [wicket.jar:]
at wicket.RequestCycle.request(RequestCycle.java:454) [wicket.jar:]
at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219) [wicket.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) [undertow-core-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) [undertow-core-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50) [undertow-core-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) [undertow-core-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.3.15.Final.jar:1.3.15.Final]
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174) [undertow-servlet-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) [undertow-core-1.3.15.Final.jar:1.3.15.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793) [undertow-core-1.3.15.Final.jar:1.3.15.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [rt.jar:1.8.0_141]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [rt.jar:1.8.0_141]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_141]

正在处理的html文件是:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="refresh" content="15">
<meta http-equiv="Cache-Control" content="no-store, no-cache, max-age=0, must-revalidate">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="NO-CACHE">
<meta http-equiv="Content-Type" CONTENT="text/html; charset=utf-8">

<script language="JavaScript"><!--
function setIFrameContents(frameName, contents) {
var iFrame = window.frames[frameName];
iFrame.document.open();
iFrame.document.write(contents);
iFrame.document.close();
}
//--></script>


<title wicket:id="pagetitle">Status</title>
<link rel="stylesheet" type="text/css" href="main.css" />
</head>

<body>

<div class="main">

<div class="header"></div>

<div class="nav-and-content">

<div class="navbar">
<span wicket:id="navBar"></span>
</div> <!--end nav bar div-->

<div class="lockButton">
<form wicket:id="lockUnlockForm">
<input wicket:id="lockButton" type="image" src=""/>
<input wicket:id="unlockButton" type="image" src=""/>
</form>
</div>

<div class="content">
<p>
<span class="title" wicket:id="title">Status</span>
<span class="error" wicket:id="feedback">Error verbiage if any goes here.</span>
</p>

<br/>

<span wicket:id="features">
<span wicket:id="feature"></span>
</span>

</div> <!-- end content -->

<div class="clear"></div>

</div> <!-- end nav-and-content -->



<div class="footer"></div>

<div class="langs" wicket:id="localeSelectPanel"></div>

</div> <!--end main div-->

</body>
</html>

谢谢,请原谅我对此的无知。

最佳答案

使用 ListView 的代码应如下所示:

ListView lv = new ListView("features", listOfFeatures) {
@Override protected void onPopulate(ListItem<Feature> li) {
li.add(new FeaturePanel("feature", li.getModel()));
}

}

在您的异常消息组件中0是列表项。似乎由于某种原因行 li.add(new FeaturePanel("feature"));没有执行,所以0没有 ID 为 feature 的 child .

由于您没有附加调试器的源代码,因此不会有太大帮助,但至少您将能够看到组件树中的内容。只需在 MarkupContainer.renderNext(MarkupContainer.java:1381) 处放置一个断点,然后检查 children 的值是多少。成员字段时this是一个 id= 0 的 ListItem .

从类名中我可以说这是 Wicket 1.3 或更早版本,而且这是 Wicket 的非常旧的版本!

关于Java: Wicket 口无法找到组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49040331/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com