Spring/Resin configuration problem

4.4k views Asked by At

I am wiring up a servlet thru spring running inside resin.. When the web app starts up i get

[11-02-22 12:12:36.259] {main} org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern [/WEB-INF/*-context.xml]; nested exception is java.io.FileNotFoundException: ServletContext resource [/WEB-INF/] cannot be resolved to URL because it does not exist at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java

I indeed have my spring configuration files in

WEB-INF/

as

WEB-INF/persist-context.xml

and the web.xml file does have

<servlet>
    <servlet-name>dsservlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

and

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/*-context.xml</param-value>
</context-param>

all of this works fine in jetty, but in resin (again) i get the error:

ServletContext resource [/WEB-INF/] cannot be resolved to URL because it does not exist

I have added a line in resin.conf like

<web-app id="/myapp" root-directory="$/path/to/myapps/explodedwardir"/>

Any idea what i'm doing wrong?

2

There are 2 answers

1
DwB On

Initial Answer

Note the error text: /WEB-INF/*-context.xml
Now, note your text: WEB-INF/dsservlet-servlet.xml
*-context.xml will never match *-servlet.xml

More stuff

I include the following in the Spring Dispatch Servlet (in the web.xml file) when I want the Dsipatch Servlet to reference the contextConfigLocation config-param in my web.xml.

    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value/>
    </init-param>
1
Tomasz Nurkiewicz On

Try:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:/WEB-INF/*-context.xml</param-value>
</context-param>

(adding classpath: prefix).