javax.naming.NameNotFoundException: Name jdbc is not bound in this Context錯誤待解決中
阿新 • • 發佈:2019-02-08
前兩天 MyEclipse啟動tomcat時,顯示了以下的錯誤:、
- 資訊: Installing web application at context path /MyZhiNengTuanDemo from URL file:C:/Tomcat 5.0/webapps/MyZhiNengTuanDemo
- 2008-9-19 22:54:00 org.apache.catalina.core.StandardContext start
- 嚴重: Error filterStart
- 2008-9-19 22:54:00 org.apache.catalina.core.StandardContext start
- 嚴重: Context startup failed due to previous errors
上網找了很多資料,沒有解決。今天在執行程式時,又出現了以下的錯誤:
- 嚴重: Context initialization failed
- 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
- Caused by: javax.naming.NameNotFoundException: Name jdbc is not bound inthis Context
- at org.apache.naming.NamingContext.lookup(NamingContext.java:768)
- at org.apache.naming.NamingContext.lookup(NamingContext.java:138)
- at org.apache.naming.NamingContext.lookup(NamingContext.java:779)
- at org.apache.naming.NamingContext.lookup(NamingContext.java:138)
- at org.apache.naming.NamingContext.lookup(NamingContext.java:779)
- at org.apache.naming.NamingContext.lookup(NamingContext.java:151)
- at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
- at javax.naming.InitialContext.lookup(InitialContext.java:351)
- at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:123)
- at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
- at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:121)
- at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:146)
- at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:93)
- at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
- at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:197)
- at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:184)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1198)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1167)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
- at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
- at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
- at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
- at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:285)
- at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
- at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:245)
- at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188)
- at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:82)
- at javax.servlet.GenericServlet.init(GenericServlet.java:211)
- at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029)
- at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)
- at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)
- at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)
- at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
- at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
- at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
- at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
- at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
- at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
- at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
- at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
- at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
- at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
- at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
- at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
- at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
- at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
- at org.apache.catalina.core.StandardService.start(StandardService.java:480)
- at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
- at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:585)
- at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
- at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
依然在網上找不到答案,所以我只好先擱在那,因為,雖然出了這個錯誤,但不會影響到程式的執行。我覺得以上的兩種錯誤是由同樣的地方引起的。估計在配置上有了什麼衝突。
加油~