users@jersey.java.net

Problems using JerseyTest

From: tarjei <tarjei_at_nu.no>
Date: Tue, 06 Oct 2009 15:53:53 +0200

Hi,

I'm trying to use the JerseyTest framework but I got a problem building
the WebAppDescriptor.

The code I call is:
                 super(new WebAppDescriptor.Builder(
                                 "com.example.web"
                                 )
          .contextPath("/")
          //.contextParam("contextConfigLocation",
"classpath:applicationContext.xml")
          .contextParam("contextConfigLocation",
                          "classpath:applicationContext-HSQLdb.xml,
classpath:applicationContext-service.xml,
classpath:applicationContext-security.xml")
          /*
          .contextParam("contextConfigLocation",
"classpath:applicationContext-resources.xml")
          .contextParam("contextConfigLocation",
"classpath:applicationContext-service.xml")
          .contextParam("contextConfigLocation",
"classpath:applicationContext-security.xml")
          .contextParam("contextConfigLocation",
"classpath:applicationContext-tx.xml")
          */
          .servletClass(SpringServlet.class)
          .contextListenerClass(ContextLoaderListener.class)
          .build());


And I get the error:

Oct 6, 2009 3:40:42 PM
com.sun.jersey.spi.spring.container.servlet.SpringServlet getContext
INFO: Creating new child context from
classpath:applicationContext-HSQLdb.xml,
classpath:applicationContext-service.xml,
classpath:applicationContext-security.xml
15:40:42.364 [http9998-WorkerThread(0)] INFO
o.s.w.c.s.XmlWebApplicationContext - Refreshing
org.springframework.web.context.support.XmlWebApplicationContext_at_1ed620:
display name [Root WebApplicationContext]; startup date [Tue Oct 06
15:40:42 CEST 2009]; parent:
org.springframework.web.context.support.XmlWebApplicationContext_at_df48c4
15:40:42.364 [http9998-WorkerThread(0)] INFO
o.s.b.f.x.XmlBeanDefinitionReader - Loading XML bean definitions from
class path resource [applicationContext-HSQLdb.xml,
classpath:applicationContext-service.xml,
classpath:applicationContext-security.xml]
Oct 6, 2009 3:40:42 PM
com.sun.jersey.spi.spring.container.servlet.SpringServlet initiate
SEVERE: Exception occurred when intialization
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from class path resource
[applicationContext-HSQLdb.xml,
classpath:applicationContext-service.xml,
classpath:applicationContext-security.xml]; nested exception is
java.io.FileNotFoundException: class path resource
[applicationContext-HSQLdb.xml,
classpath:applicationContext-service.xml,
classpath:applicationContext-security.xml] cannot be opened because it
does not exist
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
        at
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
        at
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
        at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
        at
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
        at
com.sun.jersey.spi.spring.container.servlet.SpringServlet.getChildContext(SpringServlet.java:121)
        at
com.sun.jersey.spi.spring.container.servlet.SpringServlet.getContext(SpringServlet.java:111)
        at
com.sun.jersey.spi.spring.container.servlet.SpringServlet.initiate(SpringServlet.java:97)
        at
com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:242)
        at
com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:466)
        at
com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:182)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:281)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:442)
        at javax.servlet.GenericServlet.init(GenericServlet.java:241)


What is the correct syntax to have multiple applicationContext files? I
cannot use applicationContext* as I want a spesific configuration here.

kind regards,
Tarjei

-- 
Tarjei Huse
Mobil: 920 63 413