Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Resources in context.xml not being refreshed

    The MySQL server which I am pointing to works correctly in Dev mode but not when deployed on tomcat server.

    Here are the contents of my "context.xml"

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <Context reloadable="true">
    
    
        <Resource name="jdbc/CSODatabase" 
            type="javax.sql.DataSource"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://cities.emnet.net:3306/csorepository"
            username="xxx"
            password="xxx"
            testOnBorrow="true"
            validationQuery="SELECT 1" />
    
    	<!--
    	<Resource name="jdbc/CSODatabase" 
    	        type="javax.sql.DataSource"
    	        driverClassName="com.mysql.jdbc.Driver"
    	        url="jdbc:mysql://localhost:3306/csorepository"
    	        username="xxx"
    	        password="xxx"
    	        testOnBorrow="true"
    	        validationQuery="SELECT 1" />
    	 -->
    <!-- 
            <Resource name="jdbc/CSODatabase" 
    	        type="javax.sql.DataSource"
    	        driverClassName="com.mysql.jdbc.Driver"
    	        url="jdbc:mysql://50.21.180.198:3306/csorepository"
    	        username="xxx"
    	        password="xxx"
    	        testOnBorrow="true"
    	        validationQuery="SELECT 1"
    	        defaultAutoCommit="false"/>
    
            <WatchedResource>path/to/watched/resource</WatchedResource>
     -->   
    
            
     </Context>
    As you can see, it should be pointing to cities.emnet.net, however when I deploy it, it still points to 50.21.180.198:3306

    #2
    First, the bad:
    Why would you think this an appropriate forum for a Apache Tomcat specific question? There are plenty of Tomcat issue related sites, so look there first.
    Why would you not provide version information? Tomcat is up to version 8, but 5.5, 6, and 7 are still popular.

    Second, the possible answer:
    Review the Tomcat documentation for your version.

    The precedence of context files
    - conf/context.xml
    - conf/Catalina/localhost/csoapp.xml (which is copied from webapps/csoapp/META-INF/context.xml sometimes)
    - webapps/csoapp/META-INF/context.xml

    If you are using the /META-INF/context.xml
    - older versions say this: "... Once this file exists, it will not be replaced if a new WAR with a newer /META-INF/context.xml is placed in the host's appBase."
    - newer versions deal with the context.xml file with the context.copyXML, host.copyXML, and host.deployXML attributes and are defaulted to false to provide better security, so no updates once it exists.

    So check the conf/Catalina/localhost/csoapp.xml to see if it is being updated. If not, then that is the problem and can be fixed with adjustments to context.copyXML, host.copyXML, and host.deployXML attributes.

    If csoapp.xml is being updated, then check the conf/context.xml to make sure it is not overriding the other files. Also, a Resource can be defined in conf/server.xml, but that is discouraged and should be overridden by one of the other config files.

    Hope this helps, but if it doesn't find a better forum for this issue.

    Comment

    Working...
    X