Rick,

On 3/29/24 09:48, Rick Noel wrote:
Can someone tell me why I need to have my database source defined in
both my context.xml and server.xml? I thought we are suppose to
define it in only one location?
It's definitely not a requirement to specify it in both places.

I can only log into my app if I have it defined in both my context.xml and server.xml

Below  is my database resource   as defined in server.xml..........

I have xxx out postgres URL for security reasons

<GlobalNamingResources>



                  <Resource  name="jdbc/app-pool" auth="Container"
                                       type="javax.sql.DataSource"  
driverClassName="org.postgresql.Driver"
                                       url="jdbc:postgresql://xxxxxxxxxxx"
                                       username="postgres" 
password="postgres4now"
                                       maxTotal="30"  maxIdle="30" 
maxWaitMillis="-1"
                                       removeAbandonedOnBorrow="true" 
removeAbandonedTimeout="90"
                                       testOnBorrow="true"  validationQuery="select 1" 
validationQueryTimeout="30000"
                                       testWhileIdle="true"  
timeBetweenEvictionRunsMillis="60000"
                                       testOnReturn="true"
            />


   </GlobalNamingResources>



Below is my database resource   as defined in context.xml


<Context    >

     <Resources allowLinking="true" />



    <Resource  name="jdbc/app-pool" auth="Container"
                      type="javax.sql.DataSource"  
driverClassName="org.postgresql.Driver"
                      url="jdbc:postgresql://xxxxxxxxxx
                      username="postgres" password="postgres4now"
                      maxTotal="30"  maxIdle="30" maxWaitMillis="-1"
                      removeAbandonedOnBorrow="true" removeAbandonedTimeout="90"
                        testOnBorrow="true"  validationQuery="select 1" 
validationQueryTimeout="30000"
                        testWhileIdle="true"  
timeBetweenEvictionRunsMillis="60000"
                        testOnReturn="true"
            />

Which context.xml are you talking about? The one in CATALINA_BASE/context.xml or the one in your application's META-INF/context.xml?

Have you defined your <Context> in CATALINA_BASE/conf/server.xml, or are you using only META-INF/context.xml?

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to