Tomcat: javax.naming.NoInitialContextException
问题 I have a webservice with Java Servlets on a Tomcat server. In my Servlet I use a database pool like this: envContext = new InitialContext(); DataSource ds = (DataSource) envContext.lookup( "java:/comp/env/jdbc/Database" ); con = ds.getConnection(); For initialisation I have this in my web.xml: <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/Database</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> Then there is