Configure Tomcat5 data source experience

xiaoxiao2021-03-06  43

In the Admin Console, you will build a new Context, then configure DataSource below, because it is configured in the page environment, everything is very simple. Then it is tested in JSP to see if the DataSource configuration is successful. Try {INITIALCONTEXT CTX = new initialContext (); context envctx = (context) CTX.lookup ("Java: Comp / ENV");

DS = ("JDBC / SQLSERVER"); connection conn = ds.getConnection (); statement stmt = conn.createstatement (); ........} catch (exception ex) {OUT .print ("Error, INFO =" ex.getMessage ()); EX.PrintStackTrace ();} Perform error: javax.naming.namenotFoundException: Name Java: Comp is Not Bound in this context View Tomat's Server. XML, Web.xml also has Web.xml, how to report this fault. Finally, you can only delete the data source configuration, manually to configure the data source. At first system configuration data source in ... ... in Server.xml, each app is referenced by ... , total It will report an error. It's really unfortunate, CCTV5 live ACMILAN is really borus, MD in the first half of CHEVO, but just put DataSource in the ... inside you deployed, it will not report This is wrong. Context can be placed directly in the host in Tomcat_Home / Server.xml Context definition If it is deployed in the Admin Console, it is in Tomcat_Home / Conf / The data source is defined in Catalina / LocalHost / YourWebapp.xml, so you don't have to use Resource-Ref to reference the data source. Or definition in your application's web-inf / web.xml, in short, DataSource's definition is best to be defined inside your web application, otherwise it will report the above fault, don't know if it is Tomcat itself. The problem.

转载请注明原文地址:https://www.9cbs.com/read-86919.html

New Post(0)