users@jersey.java.net

Re: Spring jersey request scope issue

From: golfingal72 <coxl_at_oclc.org>
Date: Thu, 27 May 2010 11:21:08 -0700 (PDT)

Hi,

I am running into the exact same problem. I was wondering if the code
example about adding a context listener could be specific... also, if there
is a web.xml file for a junit test, where does it go within the maven
directory structure? is it required? I tried this:

       Map<String, String> contextParams = new HashMap<String, String>();
        contextParams.put("contextConfigLocation",
"classpath:test-context.xml");
        ApplicationDescriptor appDescriptor = new ApplicationDescriptor()
           .setContextPath("classpath:test-context.xml")
          
.setRootResourcePackageName("org.oclc.merlins.availability.service.sru")
          
.setServletClass(com.sun.jersey.spi.spring.container.servlet.SpringServlet.class)
          
.setContextListenerClassName("org.springframework.web.context.ContextLoaderListener")
          
.setContextListenerClassName("org.springframework.web.context.request.RequestContextListener")
           .setContextParams(contextParams);
        super.setupTestEnvironment(appDescriptor);

and I get this:
SEVERE: Exception occurred when intialization
java.lang.IllegalStateException: No WebApplicationContext found: no
ContextLoaderListener registered?
        at
org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.jav
a:70)
        at
com.sun.jersey.spi.spring.container.servlet.SpringServlet.initiate(SpringServlet.java:73)
        at
com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:242)
        at
com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:449)
        at
com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:169)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:281)

thanks much,
Lisa

-- 
View this message in context: http://jersey.576304.n2.nabble.com/Re-Spring-jersey-request-scope-issue-tp5073495p5109934.html
Sent from the Jersey mailing list archive at Nabble.com.