当前位置: 代码迷 >> Java Web开发 >> Name jdbc is not bound in this Context 怎么解决?
  详细解决方案

Name jdbc is not bound in this Context 怎么解决?

热度:908   发布时间:2010-10-21 12:04:46.0
Name jdbc is not bound in this Context 怎么解决?
报错 如下:::
程序代码:
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    at org.apache.naming.NamingContext.lookup(NamingContext.java:769)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
    at com.ziwu.util.Common.obtainDataSrc(Common.java:83)
    at com.ziwu.util.Common.produceDBHashMap(Common.java:50)
    at com.ziwu.util.Common.init(Common.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1099)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1061)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1024)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:140)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346)
    at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:308)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:252)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:221)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:115)
    at javax.servlet.GenericServlet.init(GenericServlet.java:211)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3951)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4225)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
    at org.apache.catalina.core.StandardService.start(StandardService.java:450)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
查了都说是 配置问题 ,这个项目以前是运行过的,配置是对的,不知道什么问题?
顺带一个问题:
程序代码:
[log4j]2010-10-21 11:58:52,453 ERROR [org.springframework.web.servlet.DispatcherServlet]-Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'common' defined in ServletContext resource [/WEB-INF/model-con
fig.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: dataSource is required
Caused by:
java.lang.IllegalArgumentException: dataSource is required
dataSource is required????可能是什么原因导致这个问题呢? 代码 没错

请高手 赐教啊  谢谢啦...
搜索更多相关主题的帖子: bound  Context  jdbc  Name  not  

----------------解决方案--------------------------------------------------------
  相关解决方案