views:

20

answers:

1

I am trying to create a UrlMappingsTest and am getting the following error:

java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
    at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:123)
    at org.springframework.web.context.request.RequestContextHolder$currentRequestAttributes.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:121)
    at grails.test.GrailsUrlMappingsTestCase.setUp(GrailsUrlMappingsTestCase.groovy:82)
    at junit.framework.TestCase.runBare(TestCase.java:132)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    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)

My TestCase (located in test/integration) looks as follows:

class UrlMappingsTests extends grails.test.GrailsUrlMappingsTestCase {

    void testSomething() {


    }
}

The test is failing in the setup. I'm using grails 1.2.1. Has anyone seen this error before?

A: 

I believe this is the error you get when you run a GrailsUrlMappingTestCase as a unit test. I know you said that it is in the test/integration folder, but is there any way you have the same class in the unit test folder as well. Or that you copied it from one folder to the other and your project didn't get cleaned properly?

Javid Jamae
Actually yes. I started out by creating that class in the unit test folder. I have done both a grails clean and a spring source / eclipse project clean but the issue remains. Is there something I should be cleaning manually? Thanks..
ibuck