title: Application deployed on tomcat unable to find jdbc
body: <p>I have a problem with my java application, when I deploy it on tomcat the deploy fail there's a lot of excpetion, all speaking about jdbc and naming of some resources but I can't fidn whats wrong in my configuration</p>
  
  <p>This is my web.xml</p>
  
  <pre><code>&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
       version="3.0"&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/spring/applicationContext-bootstrap.xml&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;filter&gt;
      &lt;filter-name&gt;characterEncodingFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;encoding&lt;/param-name&gt;
          &lt;param-value&gt;UTF-8&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;characterEncodingFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;LsdfManager&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/spring/mvc-servlet.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;LsdfManager&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;session-config&gt;
      &lt;session-timeout&gt;
          30
      &lt;/session-timeout&gt;
  &lt;/session-config&gt;
  
  &lt;resource-ref&gt;
      &lt;description&gt;dsLsdfDB&lt;/description&gt;
      &lt;res-ref-name&gt;jdbc/LSDFdatabase&lt;/res-ref-name&gt;
      &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
      &lt;res-auth&gt;Container&lt;/res-auth&gt;
  &lt;/resource-ref&gt;
  </code></pre>
  
  <p></p>
  
  <p>this is my context.xml, I also tryed to use the same value for name and global, but the errors remains</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context path="/LsdfManager"&gt;
      &lt;ResourceLink auth="Container" global="jdbc/GlobalLsdfDB" name="jdbc/LSDFdatabase" type="javax.sql.DataSource"/&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>the persistence.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="1.0"
  xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
       http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"&gt;
  
  &lt;persistence-unit name="LSDFPersistenceUnit" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
      &lt;class&gt;it.lsdf.manager.dbo.Anagraphics&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.Configurations&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.MailQueue&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.Messages&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.Quote&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.Roles&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.SchoolHours&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.Schools&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.SportCenters&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.SportCentersHours&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.Teams&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.TeamHours&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.TeamsManagers&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.Users&lt;/class&gt;
      &lt;class&gt;it.lsdf.manager.dbo.UsersRoles&lt;/class&gt;
      &lt;properties&gt;
          &lt;property name="eclipselink.weaving" value="false" /&gt;
          &lt;property name="eclipselink.cache.shared.default" value="false" /&gt;
      &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p></p>
  
  <p>and the spring configuration</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:jee="http://www.springframework.org/schema/jee"
     xmlns:p="http://www.springframework.org/schema/p"
     xmlns:tx="http://www.springframework.org/schema/tx"
     xmlns:sec="http://www.springframework.org/schema/security"
     xmlns:cache="http://www.springframework.org/schema/cache"
     xmlns:context="http://www.springframework.org/schema/context"
     xmlns:metrics="http://www.ryantenney.com/schema/metrics"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.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/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
        http://www.ryantenney.com/schema/metrics http://www.ryantenney.com/schema/metrics/metrics-3.0.xsd
     "&gt;
  &lt;context:spring-configured /&gt;
  &lt;context:annotation-config /&gt;
  
  &lt;!-- &lt;import resource="securityContext.xml" /&gt;
  &lt;context:component-scan base-package="it.lsdf.manager"/&gt;
  --&gt;
  
  &lt;!-- DATABASE --&gt;
  &lt;jee:jndi-lookup id="LSDFDatasource" jndi-name="jdbc/LSDFdatabase" expected-type="javax.sql.DataSource" lookup-on-startup="true" /&gt;
  
  &lt;bean id="entityManagerFactoryLSDF" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
      &lt;property name="persistenceUnitName" value="LSDFPersistenceUnit" /&gt;
      &lt;property name="dataSource" ref="LSDFDatasource" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="lsdfTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
      &lt;property name="entityManagerFactory" ref="entityManagerFactoryLSDF" /&gt;
  &lt;/bean&gt;   
  
  &lt;!-- DATABASE --&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>mvc-servlet.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:context="http://www.springframework.org/schema/context"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
  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-4.1.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd"&gt;
  
  
  &lt;!-- Register the annotated components in the container eg : annotated controllers --&gt;
  &lt;context:component-scan base-package="it.lsdf.manager" /&gt;
  
  &lt;bean id="velocityConfig"
      class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"&gt;
      &lt;property name="resourceLoaderPath"&gt;
          &lt;value&gt;/&lt;/value&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  
  &lt;bean id="viewResolver"
      class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver"&gt;
      &lt;property name="cache" value="true" /&gt;
      &lt;property name="prefix" value="/WEB-INF/layout/" /&gt;
      &lt;property name="layoutUrl" value="/WEB-INF/layout/home/content.vm" /&gt;
      &lt;property name="suffix" value=".vm" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p></p>
  
  <p>and this is the connection resource that i put in server.xml on tomcat conf inside GlobalNamingResources tag</p>
  
  <pre><code>&lt;Resource auth="Container" 
      driverClassName="com.mysql.jdbc.Driver" 
      initialSize="10" 
      maxIdle="100" 
      maxTotal="2000" 
      maxWaitMillis="5000" 
      minIdle="10" 
      name="jdbc/LSDFdatabase" 
      password="{MySql.password}" 
      testOnBorrow="true" 
      type="javax.sql.DataSource" 
      url="jdbc:mysql://{MySql.ipAddress}:3306/LSDF_MANAGER" 
      username="{MySql.username}" 
      validationQuery="SELECT 1" 
      validationQueryTimeout="5000"/&gt;
  </code></pre>
  
  <p>and here the tomcat logs</p>
  
  <pre><code>AVVERTENZA: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactoryLSDF' defined in ServletContext resource [/WEB-INF/spring/applicationContext-bootstrap.xml]: Cannot resolve reference to bean 'LSDFDatasource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'LSDFDatasource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/LSDFdatabase] is not bound in this Context. Unable to find [jdbc].
  set 01, 2017 9:40:25 AM org.springframework.web.context.ContextLoader initWebApplicationContext
  GRAVE: Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactoryLSDF' defined in ServletContext resource [/WEB-INF/spring/applicationContext-bootstrap.xml]: Cannot resolve reference to bean 'LSDFDatasource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'LSDFDatasource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/LSDFdatabase] is not bound in this Context. Unable to find [jdbc].
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1486)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1231)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4643)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5105)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:740)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:716)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:978)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:497)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1644)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
      at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1479)
      at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:727)
      at org.apache.catalina.manager.ManagerServlet.doPut(ManagerServlet.java:422)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:663)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:592)
      at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:348)
      at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:52)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1374)
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'LSDFDatasource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/LSDFdatabase] is not bound in this Context. Unable to find [jdbc].
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
      ... 60 more
  Caused by: javax.naming.NameNotFoundException: Name [jdbc/LSDFdatabase] is not bound in this Context. Unable to find [jdbc].
      at org.apache.naming.NamingContext.lookup(NamingContext.java:817)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:173)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:163)
      at javax.naming.InitialContext.lookup(InitialContext.java:417)
      at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
      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:179)
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:104)
      at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106)
      at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:231)
      at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:217)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579)
      ... 67 more
  
  set 01, 2017 9:40:25 AM org.apache.catalina.core.StandardContext listenerStart
  GRAVE: Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactoryLSDF' defined in ServletContext resource [/WEB-INF/spring/applicationContext-bootstrap.xml]: Cannot resolve reference to bean 'LSDFDatasource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'LSDFDatasource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/LSDFdatabase] is not bound in this Context. Unable to find [jdbc].
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1486)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1231)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1081)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:856)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4643)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5105)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:740)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:716)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:978)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:497)
      at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1644)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287)
      at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
      at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1479)
      at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:727)
      at org.apache.catalina.manager.ManagerServlet.doPut(ManagerServlet.java:422)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:663)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:592)
      at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:348)
      at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:52)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1374)
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'LSDFDatasource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/LSDFdatabase] is not bound in this Context. Unable to find [jdbc].
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
      ... 60 more
  Caused by: javax.naming.NameNotFoundException: Name [jdbc/LSDFdatabase] is not bound in this Context. Unable to find [jdbc].
      at org.apache.naming.NamingContext.lookup(NamingContext.java:817)
      at org.apache.naming.NamingContext.lookup(NamingContext.java:173)
      at org.apache.naming.SelectorContext.lookup(SelectorContext.java:163)
      at javax.naming.InitialContext.lookup(InitialContext.java:417)
      at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
      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:179)
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:104)
      at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106)
      at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:231)
      at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:217)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579)
      ... 67 more
  
  set 01, 2017 9:40:25 AM org.apache.catalina.core.StandardContext startInternal
  GRAVE: One or more listeners failed to start. Full details will be found in the appropriate container log file
  set 01, 2017 9:40:25 AM org.apache.catalina.core.StandardContext startInternal
  GRAVE: Context [/lsdfManager] startup failed due to previous errors
  set 01, 2017 9:40:25 AM org.apache.catalina.core.ApplicationContext log
  INFORMAZIONI: Closing Spring root WebApplicationContext
  Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
  set 01, 2017 9:40:25 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
  AVVERTENZA: The web application [lsdfManager] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
   java.lang.Object.wait(Native Method)
   java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
   com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
  set 01, 2017 9:40:25 AM org.apache.catalina.startup.HostConfig deployWAR
  INFORMAZIONI: Deployment of web application archive [C:\Users\ivan.notarstefano\Documents\Ivan\sistema\apache-tomcat-9.0.0.M26\webapps\lsdfManager.war] has finished in [3,716] ms
  </code></pre>
  
  <p>Anyone can help me?</p>