Attachments don't come through these lists. -- Jeremy Thomerson http://www.wickettraining.com
On Tue, Nov 17, 2009 at 3:14 PM, Loritsch, Berin C. < [email protected]> wrote: > I've got the part that injects a Spring WebApplicationContext into the > WicketTester already (Source attached). I should be using the application > class, if I'm not then something has changed unbeknownst to me. Is there > any place it would swap out what I told it to use for what it decided on its > own to use? > > -----Original Message----- > From: Igor Vaynberg [mailto:[email protected]] > Sent: Tuesday, November 17, 2009 4:05 PM > To: [email protected] > Subject: Re: Spring/Wicket/Hibernate testing driving me banana nuts > > i see you are using MockWebApplication in your tests. this application > does not install the SpringComponentInjector and so @SpringBean has no > effect. > > you should either give wickettester an instance of your actual > application class, or create a mock one that installs > springcomponentinjector. > > -igor > > On Tue, Nov 17, 2009 at 1:00 PM, Loritsch, Berin C. > <[email protected]> wrote: > > <<application.xml>> I initially had a setup that worked with both a Web > > context and a JUnit context. The problem was the amount of hand coding > > and adjusting of the Spring context the approach needed. I finally got > > the Spring's transaction interceptor working with the auto-wiring (the > > key is using an interface). So now my problem is that while I've saved > > myself the headache of making changes to a bunch of files every time I > > add a new service, my unit tests are now failing. > > > > I've traced the failure to a specific class that is decorated with the > > InjectorHolder--although I believe that is merely because it is the > > first component that does any Hibernate requests. I'll include the > > stacktrace at the bottom of the message. > > > > I had to remove the line that specified that sessions would be thread > > bound in Hibernate to take advantage of the Spring managed transactions, > > and adding that configuration item back in makes no difference for the > > tests. I'm hoping I'm just missing something simple, but all my > > Googling is turning up dead ends. Any help out there? > > > > > > > > > > > > > > > > > > org.apache.wicket.WicketRuntimeException: Error attaching this container > > for rendering: [MarkupContainer [Component id = content]] > > at > > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer > > .java:1739) > > at > > org.apache.wicket.Component.onBeforeRender(Component.java:3854) > > at > > org.apache.wicket.Component.internalBeforeRender(Component.java:1061) > > at org.apache.wicket.Component.beforeRender(Component.java:1095) > > at > > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer > > .java:1727) > > at > > org.apache.wicket.Component.onBeforeRender(Component.java:3854) > > at org.apache.wicket.Page.onBeforeRender(Page.java:1501) > > at > > com.gdais.incidents.view.SiteTemplate.onBeforeRender(SiteTemplate.java:3 > > 3) > > at > > org.apache.wicket.Component.internalBeforeRender(Component.java:1061) > > at org.apache.wicket.Component.beforeRender(Component.java:1095) > > at > > org.apache.wicket.Component.prepareForRender(Component.java:2223) > > at > > org.apache.wicket.Component.prepareForRender(Component.java:2260) > > at org.apache.wicket.Page.renderPage(Page.java:893) > > at > > org.apache.wicket.request.target.component.BookmarkablePageRequestTarget > > .respond(BookmarkablePageRequestTarget.java:262) > > at > > org.apache.wicket.request.AbstractRequestCycleProcessor.respond(Abstract > > RequestCycleProcessor.java:105) > > at > > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java > > :1258) > > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) > > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428) > > at org.apache.wicket.RequestCycle.request(RequestCycle.java:594) > > at > > org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(M > > ockWebApplication.java:478) > > at > > org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(M > > ockWebApplication.java:390) > > at > > org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTeste > > r.java:301) > > at > > com.gdais.incidents.view.TestTriagePanel.assertTriageNotAvailableFor(Tes > > tTriagePanel.java:33) > > at > > com.gdais.incidents.view.TestTriagePanel.testTriagePanelNotForAdministra > > tor(TestTriagePanel.java:27) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > > a:39) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > > Impl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at junit.framework.TestCase.runTest(TestCase.java:164) > > at junit.framework.TestCase.runBare(TestCase.java:130) > > at junit.framework.TestResult$1.protect(TestResult.java:106) > > at junit.framework.TestResult.runProtected(TestResult.java:124) > > at junit.framework.TestResult.run(TestResult.java:109) > > at junit.framework.TestCase.run(TestCase.java:120) > > at junit.framework.TestSuite.runTest(TestSuite.java:230) > > at junit.framework.TestSuite.run(TestSuite.java:225) > > at > > org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUn > > it3TestReference.java:130) > > at > > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja > > va:38) > > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe > > stRunner.java:460) > > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe > > stRunner.java:673) > > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun > > ner.java:386) > > at > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu > > nner.java:196) > > Caused by: org.hibernate.HibernateException: No Hibernate Session bound > > to thread, and configuration does not allow creation of > > non-transactional one here > > at > > org.springframework.orm.hibernate3.SpringSessionContext.currentSession(S > > pringSessionContext.java:63) > > at > > org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryIm > > pl.java:622) > > at > > com.gdais.incidents.util.SessionFactoryAware.getCurrentSession(SessionFa > > ctoryAware.java:31) > > at > > com.gdais.incidents.util.SessionFactoryAware.findAll(SessionFactoryAware > > .java:61) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > > a:39) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > > Impl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at > > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection( > > AopUtils.java:307) > > at > > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAo > > pProxy.java:198) > > at $Proxy15.findAll(Unknown Source) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > > a:39) > > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > > Impl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at > > org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitP > > roxyFactory.java:416) > > at org.apache.wicket.proxy.$Proxy19.findAll(Unknown Source) > > at > > com.gdais.incidents.view.model.TriageListModel.load(TriageListModel.java > > :26) > > at > > com.gdais.incidents.view.model.TriageListModel.load(TriageListModel.java > > :1) > > at > > org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetach > > ableModel.java:122) > > at > > org.apache.wicket.Component.getDefaultModelObject(Component.java:1655) > > at > > org.apache.wicket.markup.html.list.ListView.getViewSize(ListView.java:22 > > 1) > > at > > org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:525 > > ) > > at > > org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(Abstra > > ctRepeater.java:131) > > at > > org.apache.wicket.Component.internalBeforeRender(Component.java:1061) > > at org.apache.wicket.Component.beforeRender(Component.java:1095) > > at > > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer > > .java:1727) > > ... 41 more > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] >
