当前位置: 代码迷 >> Java Web开发 >> 请问javax.naming.NameNotFoundException: Name evn is not bound in this Context
  详细解决方案

请问javax.naming.NameNotFoundException: Name evn is not bound in this Context

热度:598   发布时间:2016-04-17 12:34:48.0
请教javax.naming.NameNotFoundException: Name evn is not bound in this Context
配了一天都没出来 请帮我看看
server.xml
<context>
<Resource 
name="jdbc/shop" 
auth="Container" 
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
username="sa" 
password="" 
driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=shop"
/>
</context>

javabean

public conDB()throws NamingException,SQLException{
Context context=new InitialContext();
DataSource ds=(DataSource)context.lookup("java:comp/env/jdbc/shop");
con=ds.getConnection();

各位请问 错误在哪儿?为什么会报javax.naming.NameNotFoundException: Name evn is not bound in this Context这个错~~ 谢谢

------解决方案--------------------
有兴趣也可看下我的BLOG,有全局数据源配置的配置方法.

http://blog.csdn.net/gl74gs48/archive/2007/10/19/1832585.aspx
------解决方案--------------------
异常是你自己写的还是贴过来的?如果是贴过来的那就是java:comp/env/jdbc/shop写错了,写成了evn
  相关解决方案