java - Exception loading a really simple context -


i had application accessing oracle database working. then, wanted configure database access using spring, , here's result. cannot find context values:

org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': invocation of init method failed; nested exception javax.naming.namenotfoundexception: el nombre mydb no este asociado este contexto     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1482)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:521)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:458)     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:295)     @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:223)     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:292)     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194)     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:610)     @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:932)     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:479)     @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:389)     @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:294)     @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:112)     @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4973)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5467)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1559)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1549)     @ java.util.concurrent.futuretask.run(futuretask.java:262)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:744) caused by: javax.naming.namenotfoundexception: el nombre mydb no este asociado este contexto     @ org.apache.naming.namingcontext.lookup(namingcontext.java:819)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:153)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:830)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:153)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:830)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:153)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:830)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:167)     @ org.apache.naming.selectorcontext.lookup(selectorcontext.java:156)     @ javax.naming.initialcontext.lookup(initialcontext.java:411)     @ org.springframework.jndi.jnditemplate$1.doincontext(jnditemplate.java:154)     @ org.springframework.jndi.jnditemplate.execute(jnditemplate.java:87)     @ org.springframework.jndi.jnditemplate.lookup(jnditemplate.java:152)     @ org.springframework.jndi.jnditemplate.lookup(jnditemplate.java:178)     @ org.springframework.jndi.jndilocatorsupport.lookup(jndilocatorsupport.java:95)     @ org.springframework.jndi.jndiobjectlocator.lookup(jndiobjectlocator.java:105)     @ org.springframework.jndi.jndiobjectfactorybean.lookupwithfallback(jndiobjectfactorybean.java:201)     @ org.springframework.jndi.jndiobjectfactorybean.afterpropertiesset(jndiobjectfactorybean.java:187)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1541)     @ 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 instancia de escuchador de clase org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.beancreationexception: error creating bean name 'datasource': invocation of init method failed; nested exception javax.naming.namenotfoundexception: el nombre mydb no este asociado este contexto     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1482)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:521)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:458)     @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:295)     @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:223)     @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:292)     @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194)     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:610)     @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:932)     @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:479)     @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:389)     @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:294)     @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:112)     @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4973)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5467)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1559)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1549)     @ java.util.concurrent.futuretask.run(futuretask.java:262)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:744) caused by: javax.naming.namenotfoundexception: el nombre mydb no este asociado este contexto     @ org.apache.naming.namingcontext.lookup(namingcontext.java:819)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:153)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:830)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:153)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:830)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:153)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:830)     @ org.apache.naming.namingcontext.lookup(namingcontext.java:167)     @ org.apache.naming.selectorcontext.lookup(selectorcontext.java:156)     @ javax.naming.initialcontext.lookup(initialcontext.java:411)     @ org.springframework.jndi.jnditemplate$1.doincontext(jnditemplate.java:154)     @ org.springframework.jndi.jnditemplate.execute(jnditemplate.java:87)     @ org.springframework.jndi.jnditemplate.lookup(jnditemplate.java:152)     @ org.springframework.jndi.jnditemplate.lookup(jnditemplate.java:178)     @ org.springframework.jndi.jndilocatorsupport.lookup(jndilocatorsupport.java:95)     @ org.springframework.jndi.jndiobjectlocator.lookup(jndiobjectlocator.java:105)     @ org.springframework.jndi.jndiobjectfactorybean.lookupwithfallback(jndiobjectfactorybean.java:201)     @ org.springframework.jndi.jndiobjectfactorybean.afterpropertiesset(jndiobjectfactorybean.java:187)     @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1541)     @ 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     @ java.io.objectinputstream.readobject0(objectinputstream.java:1354)     @ java.io.objectinputstream.defaultreadfields(objectinputstream.java:1990)     @ java.io.objectinputstream.readserialdata(objectinputstream.java:1915)     @ java.io.objectinputstream.readordinaryobject(objectinputstream.java:1798)     @ java.io.objectinputstream.readobject0(objectinputstream.java:1350)     @ java.io.objectinputstream.readobject(objectinputstream.java:370)     @ java.util.hashmap.readobject(hashmap.java:1184)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ java.io.objectstreamclass.invokereadobject(objectstreamclass.java:1017)     @ java.io.objectinputstream.readserialdata(objectinputstream.java:1893)     @ java.io.objectinputstream.readordinaryobject(objectinputstream.java:1798)     @ java.io.objectinputstream.readobject0(objectinputstream.java:1350)     @ java.io.objectinputstream.defaultreadfields(objectinputstream.java:1990)     @ java.io.objectinputstream.defaultreadobject(objectinputstream.java:500)     @ com.vaadin.server.vaadinsession.readobject(vaadinsession.java:1340)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ java.io.objectstreamclass.invokereadobject(objectstreamclass.java:1017)     @ java.io.objectinputstream.readserialdata(objectinputstream.java:1893)     @ java.io.objectinputstream.readordinaryobject(objectinputstream.java:1798)     @ java.io.objectinputstream.readobject0(objectinputstream.java:1350)     @ java.io.objectinputstream.readobject(objectinputstream.java:370)     @ org.apache.catalina.session.standardsession.readobject(standardsession.java:1595)     @ org.apache.catalina.session.standardsession.readobjectdata(standardsession.java:1060)     @ org.apache.catalina.session.standardmanager.doload(standardmanager.java:282)     @ org.apache.catalina.session.standardmanager.load(standardmanager.java:202)     @ org.apache.catalina.session.standardmanager.startinternal(standardmanager.java:489)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5476)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1559)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1549)     @ java.util.concurrent.futuretask.run(futuretask.java:262)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:744) caused by: java.io.notserializableexception: org.apache.tomcat.dbcp.dbcp.basicdatasource     @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1183)     @ java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1547)     @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1508)     @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1431)     @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1177)     @ java.io.objectoutputstream.writeobject(objectoutputstream.java:347)     @ java.util.hashmap.writeobject(hashmap.java:1133)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ java.io.objectstreamclass.invokewriteobject(objectstreamclass.java:988)     @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1495)     @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1431)     @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1177)     @ java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1547)     @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1508)     @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1431)     @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1177)     @ java.io.objectoutputstream.writeobject(objectoutputstream.java:347)     @ org.apache.catalina.session.standardsession.writeobject(standardsession.java:1671)     @ org.apache.catalina.session.standardsession.writeobjectdata(standardsession.java:1077)     @ org.apache.catalina.session.standardmanager.dounload(standardmanager.java:430)     @ org.apache.catalina.session.standardmanager.unload(standardmanager.java:351)     @ org.apache.catalina.session.standardmanager.stopinternal(standardmanager.java:516)     @ org.apache.catalina.util.lifecyclebase.stop(lifecyclebase.java:232)     @ org.apache.catalina.core.standardcontext.stopinternal(standardcontext.java:5655)     @ org.apache.catalina.util.lifecyclebase.stop(lifecyclebase.java:232)     @ org.apache.catalina.core.containerbase$stopchild.call(containerbase.java:1575)     @ 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     @ java.io.objectinputstream.readobject0(objectinputstream.java:1354)     @ java.io.objectinputstream.defaultreadfields(objectinputstream.java:1990)     @ java.io.objectinputstream.readserialdata(objectinputstream.java:1915)     @ java.io.objectinputstream.readordinaryobject(objectinputstream.java:1798)     @ java.io.objectinputstream.readobject0(objectinputstream.java:1350)     @ java.io.objectinputstream.readobject(objectinputstream.java:370)     @ java.util.hashmap.readobject(hashmap.java:1184)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ java.io.objectstreamclass.invokereadobject(objectstreamclass.java:1017)     @ java.io.objectinputstream.readserialdata(objectinputstream.java:1893)     @ java.io.objectinputstream.readordinaryobject(objectinputstream.java:1798)     @ java.io.objectinputstream.readobject0(objectinputstream.java:1350)     @ java.io.objectinputstream.defaultreadfields(objectinputstream.java:1990)     @ java.io.objectinputstream.defaultreadobject(objectinputstream.java:500)     @ com.vaadin.server.vaadinsession.readobject(vaadinsession.java:1340)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ java.io.objectstreamclass.invokereadobject(objectstreamclass.java:1017)     @ java.io.objectinputstream.readserialdata(objectinputstream.java:1893)     @ java.io.objectinputstream.readordinaryobject(objectinputstream.java:1798)     @ java.io.objectinputstream.readobject0(objectinputstream.java:1350)     @ java.io.objectinputstream.readobject(objectinputstream.java:370)     @ org.apache.catalina.session.standardsession.readobject(standardsession.java:1595)     @ org.apache.catalina.session.standardsession.readobjectdata(standardsession.java:1060)     @ org.apache.catalina.session.standardmanager.doload(standardmanager.java:282)     @ org.apache.catalina.session.standardmanager.load(standardmanager.java:202)     @ org.apache.catalina.session.standardmanager.startinternal(standardmanager.java:489)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5476)     @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1559)     @ org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1549)     @ java.util.concurrent.futuretask.run(futuretask.java:262)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ java.lang.thread.run(thread.java:744) caused by: java.io.notserializableexception: org.apache.tomcat.dbcp.dbcp.basicdatasource     @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1183)     @ java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1547)     @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1508)     @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1431)     @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1177)     @ java.io.objectoutputstream.writeobject(objectoutputstream.java:347)     @ java.util.hashmap.writeobject(hashmap.java:1133)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ java.io.objectstreamclass.invokewriteobject(objectstreamclass.java:988)     @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1495)     @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1431)     @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1177)     @ java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1547)     @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1508)     @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1431)     @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1177)     @ java.io.objectoutputstream.writeobject(objectoutputstream.java:347)     @ org.apache.catalina.session.standardsession.writeobject(standardsession.java:1671)     @ org.apache.catalina.session.standardsession.writeobjectdata(standardsession.java:1077)     @ org.apache.catalina.session.standardmanager.dounload(standardmanager.java:430)     @ org.apache.catalina.session.standardmanager.unload(standardmanager.java:351)     @ org.apache.catalina.session.standardmanager.stopinternal(standardmanager.java:516)     @ org.apache.catalina.util.lifecyclebase.stop(lifecyclebase.java:232)     @ org.apache.catalina.core.standardcontext.stopinternal(standardcontext.java:5655)     @ org.apache.catalina.util.lifecyclebase.stop(lifecyclebase.java:232)     @ org.apache.catalina.core.containerbase$stopchild.call(containerbase.java:1575)     @ org.apache.catalina.core.containerbase$stopchild.call(containerbase.java:1564)     ... 4 more 

i have read thousands of tutorials , blogs @ time, , can't find error, why post here. first application:

    try{         context initcontext = new initialcontext();         context envcontext = (context) initcontext.lookup("java:/comp/env");         datasource = (datasource)envcontext.lookup("jdbc/mydb");     }catch(exception e){e.printstacktrace();} 

then applicationcontext.xml:

<?xml version="1.0" encoding="utf-8"?> <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">      <!-- activate annotation support -->     <ctx:annotation-config />     <cache:annotation-driven/>      <jee:jndi-lookup id="datasource" jndi-name="java:comp/env/jdbc/mydb" />      <bean id="cachemanager" class="org.springframework.cache.support.simplecachemanager">         <property name="caches">             <set>                 <bean                     class="org.springframework.cache.concurrent.concurrentmapcachefactorybean">                     <property name="name" value="resourcetypes" />                 </bean>             </set>         </property>     </bean>   </beans> 

and context.xml:

<!-- contents of file loaded each web application --> <context>     <!-- default set of monitored resources -->     <watchedresource>web-inf/web.xml</watchedresource>            <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" />  </context> 

as see it's super simple definition... still i've been getting horrible exception 1 whole day... i'm desperated... :(

i'm using eclipse , tomcat server. set debug mode can debug application, exception comes when deploying.

in web apps web.xml

       <resource-ref>               <description>oracle datasource example</description>               <res-ref-name>jdbc/mydb</res-ref-name>               <res-type>javax.sql.datasource</res-type>               <res-auth>container</res-auth>        </resource-ref> 

and in application context:

<jee:jndi-lookup id="datasource" jndi-name="jdbc/mydb" /> 

finally in code:

try{         context initcontext = new initialcontext();         datasource = (datasource)initcontext.lookup("jdbc/mydb");     }catch(exception e){e.printstacktrace();} 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -