Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Java EE 综合讨论区
打印话题 寄给朋友 订阅主题 |
作者 | 使用数据源时遇到的问题(NameNotFoundException),请帮忙看一下,谢谢!!! |
eponpanda
发贴: 2 积分: 0 |
于 2006-07-26 17:31
我使用的是weblogic8.1,配置了连接池和数据源,其中数据源的JNDI是jdbc/bn,在jsp中使用该数据源时出现问题,现将jsp程序和出现的异常贴在后面,请各位帮忙看一下,谢谢!!!! jsp程序: <%@ page contentType="text/html; charset=gb2312" %> <%@ page import="javax.naming.Context"%> <%@ page import="javax.sql.DataSource"%> <%@ page import="javax.naming.InitialContext"%> <%@ page import="java.sql.*"%> <% DataSource ds = null; try{ Context initCtx = new InitialContext(); Context envCtx = (Context)initCtx.lookup("java:comp/env"); ds = (DataSource)envCtx.lookup("jdbc/bn"); if(ds != null){ out.println("已经获得datasource!"); out.println("<br>"); Connection con = ds.getConnection(); Statement stmt=con.createStatement(); ResultSet rst=stmt.executeQuery("select * from contact"); while(rst.next()){ out.println("<br>userName:" + rst.getString("userName") + "</br>"); } } else{ out.println("连接失败!"); } }catch(Exception e){ e.printStackTrace(); } %> 异常: <2006-7-26 下午17时09分08秒 CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Client VM Version 1.4.1_05-b01 from Sun Microsystems Inc.> <2006-7-26 下午17时09分09秒 CST> <Info> <Configuration Management> <BEA-150016> <This server is being started as the administration server.> <2006-7-26 下午17时09分09秒 CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 8.1 SP2 Fri Dec 5 15:01:51 PST 2003 316284 WebLogic XMLX Module 8.1 SP2 Fri Dec 5 15:01:51 PST 2003 316284 > <2006-7-26 下午17时09分09秒 CST> <Notice> <Management> <BEA-140005> <Loading domain configuration from configuration repository at G:\weblogic\user_projects\domains\libdomain\.\config.xml.> javax.naming.NameNotFoundException: While trying to look up jdbc/bn in java:comp/env.; remaining name 'jdbc/bn' at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:858) at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150) at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:237) at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:336) at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45) at jsp_servlet.__conpool._jspService(__conpool.java:143) at weblogic.servlet.jsp.JspBase.service(JspBase.java:33) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:446) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
why edited on 2006-07-26 18:12
一个程序员的奋斗历程 |
话题树型展开 |
人气 | 标题 | 作者 | 字数 | 发贴时间 |
8594 | 使用数据源时遇到的问题(NameNotFoundException),请帮忙看一下,谢谢!!! | eponpanda | 3446 | 2006-07-26 17:31 |
7624 | Re:使用数据源时遇到的问题(NameNotFoundException),请帮忙看一下,谢谢!!! | wdx04 | 178 | 2006-07-30 12:36 |
已读帖子 新的帖子 被删除的帖子 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |