title: applicationContext could path could not be resolved
body: <p>i am getting this error, when i define the the applicationContext inside my spring simple database connection code.</p>
  
  <p>but when i place the applicationContext where the java (DatabaseTestConnection.java) resides, it connects without any issues.</p>
  
  <blockquote>
    <p>Exception in thread "main"
    org.springframework.beans.factory.BeanDefinitionStoreException:
    IOException parsing XML document from class path resource
    [applicationContext.xml]; nested exception is
    java.io.FileNotFoundException: class path resource
    [applicationContext.xml] cannot be opened because it does not exist</p>
  </blockquote>
  
  <h2>Source</h2>
  
  <p><strong>applicationContext.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:p="http://www.springframework.org/schema/p"
     xmlns:aop="http://www.springframework.org/schema/aop"
     xmlns:tx="http://www.springframework.org/schema/tx"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"&gt;
  
  &lt;!--bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
        p:location="/WEB-INF/jdbc.properties" /&gt;
  
  &lt;bean id="dataSource"
  class="org.springframework.jdbc.datasource.DriverManagerDataSource"
  p:driverClassName="${jdbc.driverClassName}"
  p:url="${jdbc.url}"
  p:username="${jdbc.username}"
  p:password="${jdbc.password}" /--&gt;
  
  &lt;bean id="databaseTestConnection" class="DatabaseTestConnection"&gt;
  &lt;property name="dataSource" ref="externalDataSource"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="externalDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" scope="singleton"     destroy-method="close"&gt;
  &lt;property name="driverClassName" value="sun.jdbc.odbc.JdbcOdbcDriver"/&gt;
  &lt;property name="url" value="jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb, *.accdb);DBQ=C://Users//gopc//Documents//odbc_sql.accdb"/&gt;
  &lt;property name="username" value=""/&gt;
  &lt;property name="password" value=""/&gt;
  &lt;/bean&gt;
  
  &lt;!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc) --&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>DatabaseTestConnection.java</strong></p>
  
  <pre><code>import java.util.*;
  import org.springframework.beans.factory.xml.XmlBeanFactory;
  import org.springframework.core.io.ClassPathResource;
  
  import javax.sql.DataSource;
  import org.springframework.jdbc.core.JdbcTemplate;
  
  public class DatabaseTestConnection {
  
  private JdbcTemplate jt;
  
  public void setDataSource(DataSource dataSource) {
      this.jt = new JdbcTemplate(dataSource);
  }
  
  
  /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {
      XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
      DatabaseTestConnection bn = (DatabaseTestConnection) bf.getBean("databaseTestConnection");
      int count = bn.jt.queryForInt("select count(*) from log_entry");
      System.out.println("cgk count:" + count);
  
      List &lt;Map &lt;String,Object&gt; &gt; ob = bn.jt.queryForList("select * from log_entry", args);
      System.out.println("cgk size:" + ob.size());
      for (Map&lt;String,Object&gt; entry: ob )
      {
          System.out.println("ID:" + entry.get("ID"));
          System.out.println("DateCol:" + entry.get("DateCol"));
          System.out.println("Completed:" + entry.get("Completed"));
      }
  
  }
  }
  </code></pre>