Tomcat JNDI错误

时间:2009-06-23 23:52:01

标签: java tomcat jndi

我收到此错误

Jun 23, 2009 4:49:10 PM org.apache.catalina.startup.Catalina start INFO: Server 
   startup in 5265 ms 
0 [http-8080-Processor25] ERROR Could not load security-xss-regex.txt file. [at
   app.sparx.navigate.AppNavigationControllerServlet.init(AppNavigationControllerServlet.java:45)] 
   Unable to register any web resource locators (/resources/sparx, /sparx were not found). 
   Please use the SparxResourcesServlet for serving Sparx resources. 
2328 [http-8080-Processor25] ERROR Name jdbc is not bound in this Context [at 
   net.sf.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:58)] 
2328 [http-8080-Processor25] ERROR net.sf.hibernate.exception.GenericJDBCException: Cannot
   open connection [at app.security.AppLoginAuthenticator.isUserValid(AppLoginAuthenticator.java:89)]
   and this is what I have in my server.xml file    
Resource name="sparx" 
   auth="Container" type="javax.sql.DataSource" 
   driverClassName="com.ibm.db2.jcc.DB2Driver" 
   url="jdbc:db2://192.168.0.131:50000/MAX" 
   username="db2admin" password="!!!!!!!!!" 

任何人都知道资源的确切名称应该是什么

由于

1 个答案:

答案 0 :(得分:0)

This link可能会对您有所帮助。 JNDI名称应为“jdbc / sparx”。

看起来无法打开连接,因为找不到文件security-xss-regex.txt。

那些东西不属于server.xml。 (无论如何,你不能总是依赖于能够编辑该文件。)正确的位置是META-INF / context.xml

您是否也在web.xml中声明了资源?你知道,你必须拥有它。

JDBC驱动程序JAR必须位于Tomcat 5.x的公共/ lib或Tomcat 6.x的/ lib中。

您使用的是非常旧版本的Hibernate - 以“net.sf.hibernate”开头的软件包名称很古老。是时候升级了吗?

如果您仍然遇到问题,我会尝试更换另一个数据库来代替DB2,只是为了让连接正常工作。 MySQL,Hypersonic - 除IBM产品之外的任何东西。如果你能够解决这个问题,你就会知道DB2特定的东西是个问题。