在同一个应用程序中,我有
项目A
和项目B
。 项目B
实现了一个组件,该组件也在项目A
中使用。在运行项目A
的测试时,我得到以下堆栈跟踪:org.apache.wicket.WicketRuntimeException: Exception in rendering component: [UploadPanel [Component id = content]]
at org.apache.wicket.Component.internalRenderComponent(Component.java:2589)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1663)
at org.apache.wicket.Component.internalRender(Component.java:2380)
at org.apache.wicket.Component.render(Component.java:2308)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1521)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1724)
at org.apache.wicket.Page.onRender(Page.java:879)
at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:141)
at org.apache.wicket.Component.internalRender(Component.java:2380)
at org.apache.wicket.Component.render(Component.java:2308)
at org.apache.wicket.Page.renderPage(Page.java:1018)
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.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider$1.respond(BaseWicketTester.java:2766)
at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:714)
at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:653)
at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:883)
at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:900)
at org.apache.wicket.util.tester.BaseWicketTester.startComponentInPage(BaseWicketTester.java:1462)
at org.apache.wicket.util.tester.BaseWicketTester.startComponentInPage(BaseWicketTester.java:1382)
at (FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.RuntimeException: An error occurred while getting the model object for Component: [EmailLink [Component id = dataexchange.email.link, page = org.apache.wicket.util.tester.BaseWicketTester$StartComponentInPage, path = 1:content:dataexchange.email.link.EmailLink, isVisible = true, isVersioned = true, markup = [markup = file:/C:/dev/projects/Project A/web/content/upload/UploadPanel.html
<a href="#" wicket:id="dataexchange.email.link"><wicket:message key="massmeldupload.desc.3"/></a>, index = 0, current = '<a href="#" wicket:id="dataexchange.email.link">' (line 0, column 0)]]]
at org.apache.wicket.Component.getDefaultModelObject(Component.java:1631)
at org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1654)
at Project B.web.comp.EmailLink.onComponentTag(EmailLink.java:36)
at org.apache.wicket.Component.internalRenderComponent(Component.java:2521)
at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1663)
at org.apache.wicket.Component.internalRender(Component.java:2380)
at org.apache.wicket.Component.render(Component.java:2308)
at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1521)
at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1724)
at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1699)
at org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer.java:799)
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:2565)
... 49 more
Caused by: java.util.MissingResourceException: Unable to find property: 'teaser.contact.dataexchange.email' for component: content:dataexchange.email.link [class=Project B.EmailLink]. Locale: null, style: null
at org.apache.wicket.Localizer.getString(Localizer.java:268)
at org.apache.wicket.model.ResourceModel$AssignmentWrapper.load(ResourceModel.java:129)
at org.apache.wicket.model.ResourceModel$AssignmentWrapper.load(ResourceModel.java:99)
at org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:134)
at org.apache.wicket.Component.getDefaultModelObject(Component.java:1626)
... 62 more
属性teaser.contact.dataexchange.email
在项目B
中定义,但在项目A
中从未定义。
对于生产环境,所有这些属性都将写入一个数据库,然后从那里读取,这只是测试失败了。我该如何解决这个问题?