`

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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics