<<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
<?xml version="1.0" encoding="UTF-8"?> <beans default-autowire="autodetect" xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <bean id="IMSApplication" class="com.gdais.incidents.IMSApplication"/> <bean id="placeholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="ignoreUnresolvablePlaceholders" value="false" /> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> <property name="ignoreResourceNotFound" value="false" /> <property name="locations"> <list> <value>classpath*:/application.properties</value> </list> </property> </bean> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass"> <value>${jdbc.driver}</value> </property> <property name="jdbcUrl"> <value>${jdbc.url}</value> </property> <property name="user"> <value>${jdbc.username}</value> </property> <property name="password"> <value>${jdbc.password}</value> </property> <property name="initialPoolSize"><value>${hibernate.c3p0.initialPoolSize}</value></property> <property name="minPoolSize"><value>${hibernate.c3p0.minPoolSize}</value></property> <property name="maxPoolSize"><value>${hibernate.c3p0.maxPoolSize}</value></property> <property name="acquireRetryAttempts"><value>${hibernate.c3p0.acquireRetryAttempts}</value></property> <property name="acquireIncrement"><value>${hibernate.c3p0.acquireIncrement}</value></property> <property name="idleConnectionTestPeriod"><value>${hibernate.c3p0.idleConnectionTestPeriod}</value></property> <property name="maxIdleTime"><value>${hibernate.c3p0.maxIdleTime}</value></property> <property name="maxConnectionAge"><value>${hibernate.c3p0.maxConnectionAge}</value></property> <property name="preferredTestQuery"><value>${hibernate.c3p0.preferredTestQuery}</value></property> <property name="testConnectionOnCheckin"><value>${hibernate.c3p0.testConnectionOnCheckin}</value></property> </bean> <bean id="interceptor" class="org.hibernate.EmptyInterceptor"> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="hibernateProperties"> <props> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.connection.pool_size">5</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.cglib.use_reflection_optimizer">true</prop> <!--<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> <prop key="hibernate.hibernate.cache.use_query_cache">true</prop>--> </props> </property> <property name="entityInterceptor" ref="interceptor"/> <property name="packagesToScan"> <list> <value>com.gdais.incidents.model</value> <value>com.gdais.incidents.controller</value> </list> </property> </bean> <tx:annotation-driven transaction-manager="txManager" /> <!-- setup transaction manager --> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <context:component-scan base-package="com.gdais.incidents" /> </beans>
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org