Tomcat's context configuration finally took care of Tomcat today, Conf/context.xml is a tomcat common environment configuration;

Source: Internet
Author: User
Tags auth
Tomcat's context configuration is finally getting rid of Tomcat's contexts today, Conf/context.xml is a tomcat common environment configuration; If you add <context path= "/test" to the Server.xml Docbase= "D:/test" debug= "0" reloadable= "false"/>, then Myapp/meta-inf/context.xml is useless (replaced by the context of the server.xml), Jndi data sources or other resources can be directly set inside, such as:      <context path= "/frame docbase=" c:/java/jboss-4.0.1sp1/server/ Default/deploy/webroot.war "debug=" 0 "reloadable=" false ">      <resource name=" UserTransaction "auth=" Container "                                              type= " Javax.transaction.UserTransaction "                                              factory= "Org.objectweb.jotm.UserTransactionFactory"                                                jotm.timeout= "/>     "       < Resource name= "sharkdb" type= "Javax.sql.DataSource"                                                                                 password= "HelloWorld" Driverclassname= " Com.microsoft.jdbc.sqlserver.SQLServerDriver "                                        maxidle= "2" maxwait= "5000" username= "sa"                                         url= "jdbc:microsoft:sqlserver:// 192.168.0.193:1433;databasename=test_cyber3; Selectmethod=cursor "maxactive=" 4 "/>                                             <resource name= "Cyberwaydb" type= " Javax.sql.DataSource "                                                                               password= "HelloWorld" Driverclassname= " Com.microsoft.jdbc.sqlserver.SQLServerDriver "                                        maxidle= "2" maxwait= "5000" username= "sa"                                         url= "JDBC: Microsoft:sqlserver://192.168.0.193:1433;databasenaMe=test_cyber3 "maxactive=" 4 "/>             </ context>; if the addition of Jndi or other:  in the <GlobalNamingResources> is to be referenced in the app, the following two ways of referencing can be used, as follows: in Web-inf/web.xml the <resource-ref>      <description>db connection</description>       <res-ref-name>jdbc/TestDB</res-ref-name>      < res-type>javax.sql.datasource</res-type>      <res-auth>Container</ res-auth>  </resource-ref>b: In Yoursapp/meta-inf/context.xml, as follows: <?xml version= ' 1.0 ' encoding= ' Utf-8 ' ><context path= "/yoursapp" docbase= "Yoursapp" debug= "5"    reloadable= "true" crosscontext= " True "><resourcelink name=" Mysqldbconpool "global=" Mysqldbconpool "type=" Javax.sql.DataSource "/> </ Context>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.