Any ideas why I'm getting the following error when running unit tests? The
first test doesn't get the error, which makes me think that something is not
being closed, shut down, etc. properly.
First the error listing, after that is my test harness.
(messages about scanning for classes removed)
INFO : 10:16:04,311: net.sourceforge.stripes.util.Log.info(Log.java:172):
Stripes Initialization Complete. Version: 1.5.1, Build: 1102
MockServletContext: Initializing Spring root WebApplicationContext
INFO : 10:16:04,311:
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189):
Root WebApplicationContext: initialization started
INFO : 10:16:04,311:
org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:411):
Refreshing
org.springframework.web.context.support.xmlwebapplicationcont...@4865ce:
display name [Root WebApplicationContext]; startup date [Thu Sep 24 10:16:04
PDT 2009]; root of context hierarchy
INFO : 10:16:04,311:
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:323):
Loading XML bean definitions from URL
[file:/C:/users/rusty/workspaces/spring_samples/sample005/target/classes/spring/applicationContext.xml]
INFO : 10:16:04,343:
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:426):
Bean factory for application context
[org.springframework.web.context.support.xmlwebapplicationcont...@4865ce]:
org.springframework.beans.factory.support.defaultlistablebeanfact...@747fa2
INFO : 10:16:04,343:
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:414):
Pre-instantiating singletons in
org.springframework.beans.factory.support.defaultlistablebeanfact...@747fa2:
defining beans
[org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,dateDao,desiredDateFactory,dateService,dateFormBacker,desiredDateValidator];
root of factory hierarchy
DEBUG: 10:16:04,343:
com.objecteffects.sample.web.dto.DateFormBacker.generateDaysOfWeek(DateFormBacker.java:106):
minDayOfWeek: 1
DEBUG: 10:16:04,343:
com.objecteffects.sample.web.dto.DateFormBacker.generateDaysOfWeek(DateFormBacker.java:107):
maxDayOfWeek: 7
INFO : 10:16:04,343:
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:209):
Root WebApplicationContext: initialization completed in 32 ms
DEBUG: 10:16:04,343:
com.objecteffects.sample.web.action.StartActionBeanTest.testSubmit(StartActionBeanTest.java:62):
called
ERROR: 10:16:04,343: net.sourceforge.stripes.util.Log.error(Log.java:78):
net.sourceforge.stripes.exception.StripesRuntimeException: Something is trying
to access the current Stripes configuration but the current request was never
routed through the StripesFilter! As a result the appropriate Configuration
object cannot be located. Please take a look at the exact URL in your browser's
address bar and ensure that any requests to that URL will be filtered through
the StripesFilter according to the filter mappings in your web.xml.
at
net.sourceforge.stripes.controller.StripesFilter.getConfiguration(StripesFilter.java:161)
at net.sourceforge.stripes.util.CryptoUtil.encrypt(CryptoUtil.java:123)
at
net.sourceforge.stripes.mock.MockRoundtrip.setSourcePage(MockRoundtrip.java:234)
at
net.sourceforge.stripes.mock.MockRoundtrip.<init>(MockRoundtrip.java:160)
at
net.sourceforge.stripes.mock.MockRoundtrip.<init>(MockRoundtrip.java:93)
at
net.sourceforge.stripes.mock.MockRoundtrip.<init>(MockRoundtrip.java:79)
at
com.objecteffects.sample.web.action.StartActionBeanTest.testSubmit(StartActionBeanTest.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
public abstract class StripesTestHarness {
private MockServletContext context;
@Before
public void setUpNonTrivialObjects() {
this.context = new MockServletContext("test");
final Map<String, String> filterParams = new HashMap<String, String>();
filterParams.put("ActionBeanContext.Class",
"com.objecteffects.sample.web.action.StartActionBeanContextFake");
filterParams.put("Extension.Packages",
"net.sourceforge.stripes.integration.spring");
filterParams.put("ActionResolver.Packages",
"com.objecteffects.sample.web.action");
filterParams.put("Interceptor.Classes",
"net.sourceforge.stripes.integration.spring.SpringInterceptor,"
+
"net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor");
this.context.addFilter(StripesFilter.class, "StripesFilter",
filterParams);
// spring configuration file
this.context.addInitParameter("contextConfigLocation",
"classpath*:spring/applicationContext.xml");
// bind context with an initializer
final ContextLoaderListener springContextListener = new
ContextLoaderListener();
springContextListener.contextInitialized(new
ServletContextEvent(this.context));
// add stripes dispatcher
this.context.setServlet(DispatcherServlet.class, "StripesDispatcher",
null);
}
protected MockServletContext getServletContext() {
return (this.context);
}
}
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users