1. 程式人生 > >javax.naming.NameNotFoundException: Name jdbc is not bound in this Context錯誤待解決中

javax.naming.NameNotFoundException: Name jdbc is not bound in this Context錯誤待解決中

     前兩天 MyEclipse啟動tomcat時,顯示了以下的錯誤:、

  1. 資訊: Installing web application at context path /MyZhiNengTuanDemo from URL file:C:/Tomcat 5.0/webapps/MyZhiNengTuanDemo
  2. 2008-9-19 22:54:00 org.apache.catalina.core.StandardContext start
  3. 嚴重: Error filterStart
  4. 2008-9-19 22:54:00 org.apache.catalina.core.StandardContext start
  5. 嚴重: Context startup failed due to previous errors

上網找了很多資料,沒有解決。今天在執行程式時,又出現了以下的錯誤:

  1. 嚴重: Context initialization failed
  2. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Invocation of init method failed; nested exception 
    is javax.naming.NameNotFoundException: Name jdbc is not bound inthis Context
  3. Caused by: javax.naming.NameNotFoundException: Name jdbc is not bound inthis Context
  4.     at org.apache.naming.NamingContext.lookup(NamingContext.java:768)
  5.     at org.apache.naming.NamingContext.lookup(NamingContext.java:138)
  6.     at org.apache.naming.NamingContext.lookup(NamingContext.java:779)
  7.     at org.apache.naming.NamingContext.lookup(NamingContext.java:138)
  8.     at org.apache.naming.NamingContext.lookup(NamingContext.java:779)
  9.     at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
  10.     at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
  11.     at javax.naming.InitialContext.lookup(InitialContext.java:351)
  12.     at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:123)
  13.     at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
  14.     at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:121)
  15.     at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:146)
  16.     at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:93)
  17.     at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
  18.     at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:197)
  19.     at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:184)
  20.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1198)
  21.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1167)
  22.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
  23.     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
  24.     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
  25.     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
  26.     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
  27.     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)
  28.     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
  29.     at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:245)
  30.     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188)
  31.     at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:82)
  32.     at javax.servlet.GenericServlet.init(GenericServlet.java:211)
  33.     at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029)
  34.     at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)
  35.     at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)
  36.     at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)
  37.     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
  38.     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
  39.     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
  40.     at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
  41.     at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
  42.     at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
  43.     at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
  44.     at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
  45.     at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
  46.     at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
  47.     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
  48.     at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
  49.     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
  50.     at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
  51.     at org.apache.catalina.core.StandardService.start(StandardService.java:480)
  52.     at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
  53.     at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
  54.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  55.     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  56.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  57.     at java.lang.reflect.Method.invoke(Method.java:585)
  58.     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
  59.     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)

依然在網上找不到答案,所以我只好先擱在那,因為,雖然出了這個錯誤,但不會影響到程式的執行。我覺得以上的兩種錯誤是由同樣的地方引起的。估計在配置上有了什麼衝突。

    加油~