java:comp is not bound in this Context

转帖:
http://my.opera.com/relogout/blog/2006/10/12/java-comp-is-not-bound-in-this-context 在配置DBCP时遇到了JNDI的问题,java:comp is not bound in this Context ,下面这个buddy描述的问题和我一样:

Hi
I am trying to use connection pooling to establish adatabase connection. I am using Tomcat webserver. I have dbcp-coommon.*.jar and database connector jars in catalina lib. I have configured server.xml and web.xml as explained in the Tomcat sie. But I am not getting the initial lookup of (java:comp/env) I get the error as
javax.naming.NameNotFoundException: Name java:comp is not bound in this Context.

I have tried creating a seperate context in catalina\localhost. But still the error is same. Any idea... Reply please


在这里就死活过不去了。
查阅了很多资料,都是推荐检查web.xml和server.xml
很多人的问题是因为没有配置好web.xml里的内容

<resource-ref>
<description>JDBC Datasource</description>
<res-ref-name>jdbc/DT</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


看到了下面的帖子解决了问题

I have done eveything right but i had some other jar files in web-inf/classes/lib which i removed to get everything right. The jar files that interfere are naming-common.jar,naming-java.jar,naming-resources.jar,naming-factory.jar.

Hope it will work for u too


把虚拟目录下的naming-*.jar统统删除,$Tomcat$/common/lib/下的naming-*.jar不要动,restart tomcat就搞定了。令我迷茫了很久的问题就这样搞定了,是因为相同的jar包混淆了吗?
希望大家以后都不会出现这种问题。。。。。。

解决问题的帖子地址贴出来:http://forum.java.sun.com/thread.jspa?threadID=647982&messageID=3856064
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值