title: Exception loading a really simple context
body: <p>I had an application accessing an Oracle Database working. Then, I wanted to configure database access using spring, and here's the result. It cannot find the context values: </p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: El nombre myDB no este asociado a este contexto
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:610)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:744)
  Caused by: javax.naming.NameNotFoundException: El nombre myDb no este asociado a este contexto
      at org.apache.naming.NamingContext.lookup(NamingContext.java:819)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156)
      at javax.naming.InitialContext.lookup(InitialContext.java:411)
      at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
      at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
      at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
      at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201)
      at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
      ... 21 more
  
  jun 27, 2014 2:03:50 PM org.apache.catalina.core.StandardContext listenerStart
  Grave: Excepción enviando evento inicializado de contexto a instancia de escuchador de clase org.springframework.web.context.ContextLoaderListener
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: El nombre myDb no este asociado a este contexto
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:610)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:744)
  Caused by: javax.naming.NameNotFoundException: El nombre myDb no este asociado a este contexto
      at org.apache.naming.NamingContext.lookup(NamingContext.java:819)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156)
      at javax.naming.InitialContext.lookup(InitialContext.java:411)
      at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
      at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
      at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
      at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201)
      at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
      ... 21 more
  
  jun 27, 2014 2:03:50 PM org.apache.catalina.core.StandardContext startInternal
  Grave: Error listenerStart
  jun 27, 2014 2:03:51 PM org.apache.catalina.session.StandardManager doLoad
  Grave: IOException al cargar sesiones persistidas: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.tomcat.dbcp.dbcp.BasicDataSource
  java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.tomcat.dbcp.dbcp.BasicDataSource
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1354)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
      at java.util.HashMap.readObject(HashMap.java:1184)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
      at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:500)
      at com.vaadin.server.VaadinSession.readObject(VaadinSession.java:1340)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
      at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1595)
      at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:1060)
      at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:282)
      at org.apache.catalina.session.StandardManager.load(StandardManager.java:202)
      at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:489)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5476)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:744)
  Caused by: java.io.NotSerializableException: org.apache.tomcat.dbcp.dbcp.BasicDataSource
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      at java.util.HashMap.writeObject(HashMap.java:1133)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1671)
      at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1077)
      at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:430)
      at org.apache.catalina.session.StandardManager.unload(StandardManager.java:351)
      at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:516)
      at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
      at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5655)
      at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
      at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1575)
      at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1564)
      ... 4 more
  
  jun 27, 2014 2:03:51 PM org.apache.catalina.session.StandardManager startInternal
  Grave: Excepción cargando sesiones desde almacenamiento persistente
  java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.tomcat.dbcp.dbcp.BasicDataSource
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1354)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
      at java.util.HashMap.readObject(HashMap.java:1184)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
      at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:500)
      at com.vaadin.server.VaadinSession.readObject(VaadinSession.java:1340)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
      at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1595)
      at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:1060)
      at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:282)
      at org.apache.catalina.session.StandardManager.load(StandardManager.java:202)
      at org.apache.catalina.session.StandardManager.startInternal(StandardManager.java:489)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5476)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:744)
  Caused by: java.io.NotSerializableException: org.apache.tomcat.dbcp.dbcp.BasicDataSource
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      at java.util.HashMap.writeObject(HashMap.java:1133)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1495)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
      at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1671)
      at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1077)
      at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:430)
      at org.apache.catalina.session.StandardManager.unload(StandardManager.java:351)
      at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:516)
      at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
      at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5655)
      at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
      at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1575)
      at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1564)
      ... 4 more
  </code></pre>
  
  <p>I have read thousands of tutorials and blogs at the time, and can't find the error, this is why I post here. First the application: </p>
  
  <pre><code>    try{
          Context initContext = new InitialContext();
          Context envContext = (Context) initContext.lookup("java:/comp/env");
          dataSource = (DataSource)envContext.lookup("jdbc/myDb");
      }catch(Exception e){e.printStackTrace();}
  </code></pre>
  
  <p>Then the applicationContext.xml: </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:osgix="http://www.springframework.org/schema/osgi-compendium"
      xmlns:ctx="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:sec="http://www.springframework.org/schema/security" xmlns:jee="http://www.springframework.org/schema/jee"
      xmlns:cache="http://www.springframework.org/schema/cache"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
      http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
      http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
      http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
      http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"&gt;
  
      &lt;!-- activate annotation support --&gt;
      &lt;ctx:annotation-config /&gt;
      &lt;cache:annotation-driven/&gt;
  
      &lt;jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/myDb" /&gt;
  
      &lt;bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager"&gt;
          &lt;property name="caches"&gt;
              &lt;set&gt;
                  &lt;bean
                      class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean"&gt;
                      &lt;property name="name" value="resourceTypes" /&gt;
                  &lt;/bean&gt;
              &lt;/set&gt;
          &lt;/property&gt;
      &lt;/bean&gt; 
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>And finally the context.xml: </p>
  
  <pre><code>&lt;!-- The contents of this file will be loaded for each web application --&gt;
  &lt;Context&gt;
      &lt;!-- Default set of monitored resources --&gt;
      &lt;WatchedResource&gt;WEB-INF/web.xml&lt;/WatchedResource&gt;       
  
     &lt;Resource name="jdbc/myDb" auth="Container"
                type="javax.sql.DataSource" driverClass="oracle.jdbc.driver.OracleDriver" 
                url="jdbc:oracle:thin:@localhost:1521:VDC0W" 
                username="usuario" password="pass" 
                maxActive="100" maxIdle="40" maxWait="-1"
                accessToUnderlyingConnectionAllowed="true" /&gt;
  
  &lt;/Context&gt;
  </code></pre>
  
  <p>As you will see it's super simple the definition... Still I've been getting that horrible exception for one whole day... I'm desperated... :( </p>
  
  <p>I'm using eclipse and a tomcat server. Now I set the debug mode so that I can debug the application, but the exception comes when deploying. </p>