As Brett said below, this file would be in
/src/main/webapp/WEB-INF/applicationContext.xml. Files in
/src/main/resources ultimately end up as classpath resources, not
servlet context resources and XmlWebApplicationContext defaults to
ServletContextResource if not resource prefix is provided. To load the
file from the classpath, you should be able to do something like this:

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
</context-param>

Justin

-----Original Message-----
From: don hosek [mailto:[email protected]] On Behalf Of Don Hosek
Sent: Tuesday, April 28, 2009 6:26 PM
To: Maven Users List
Subject: Re: jetty:run class path

It's being loaded using

        <context-param>
                <param-name>contextConfigLocation></param-name>
                <param-value>applicationContext.xml</param-value>
        </context-param>

in the web.xml file. My servlet.xml is under WEB-INF and that doesn't
seem to be the problem. The relevant bit of logs appears to be

INFO: Loading XML bean definitions from ServletContext resource [/WEB-
INF/applicationContext.xml] Apr 27, 2009 8:38:53 PM
org.springframework.web.context.ContextLoader
initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException:  
IOException parsing XML document from ServletContext resource [/WEB-
INF/applicationContext.xml]; nested exception is
java.io.FileNotFoundException: Could not open ServletContext resource
[/WEB-INF/applicationContext.xml]
        at
org
.springframework
.beans
.factory
.xml
.XmlBeanDefinitionReader
.loadBeanDefinitions(XmlBeanDefinitionReader.java:349)


On 28 Apr 2009, at 14.50, Brett Randall wrote:

> Which mechanism are you using in Spring to load the context?  What 
> error/stack-trace do you get?
>
> Note that if you are using Spring MVC and a DispatcherServlet, it 
> expects by default to find the context file under WEB-INF directly, so

> your source path would be 
> src/main/webapp/WEB-INF/myservlet-servlet.xml .
>
> Brett
>
> On Wed, Apr 29, 2009 at 7:17 AM, Don Hosek <[email protected]>
> wrote:
>
>> Hmm, I've got a spring application context XML file stored in 
>> src/main/resources But it's not being found in the classpath when I 
>> do mvn jetty:run. Checking the target/classes directory when I run 
>> it, I see the file there, but it's not being found by the jetty 
>> container. What should I be doing?
>>
>> -dh
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to