DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30875>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30875

Dynamic processing by Catalina of webapp's context.xml fails using ./bin/startup.sh

           Summary: Dynamic processing by Catalina of webapp's context.xml
                    fails using ./bin/startup.sh
           Product: Tomcat 5
           Version: 5.0.27
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Catalina
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


According to the documentation, the proper way to create application context is by 
including a file 
named "context.xml" in the META-INF directory of a webapp.  

It appears that Tomcat 5.0.27 only recognizes such a context file when the war is 
deployed using the 
Manager tool's "DEPLOY" feature.   When "DEPLOY" is used, Catalina properly recognizes 
the context 
and dynamically creates $CATALINA_HOME/conf/Catalina/localhost/<appname>.xml   If 
Tomcat is 
started with the same war file in the webapps dir, the context file is not found and a 
_directory_ is 
created at $CATALINA_HOME/conf/Catalina/localhost/<appname>.xml.

This bug is _related_ but not identical to BUG #29688.


Use Case to create bug
--------------------------
1. Stop Tomcat using  $CATALINA_HOME/bin/shutdown.sh. 
2. Make sure $CATALINA_HOME/conf/Catalina/localhost/<webapp>.xml is deleted.
3. Clear all references to the webapp  $CATALINA_HOME/webapps by deleting the dir 
<appname> and 
the file <appname>.war
3. Clear all the logs in $CATALINA_HOME/logs
4. Place the webapp's WAR file in $CATALINA_HOME/webapps.  The webapp war has the 
following basic 
structure:
    <appname>.war
         index.jsp
         /META-INF
              context.xml
         /WEB-INF
              web.xml
              /lib
              /classes
5. Start Tomcat by running  $CATALINA_HOME/bin/startup.sh
6. Navigate to the application's URL


Excerpt from /logs/catalina.out
---------------------------
Aug 26, 2004 1:27:06 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 11130 ms
Aug 26, 2004 1:27:15 PM org.apache.catalina.core.StandardHostDeployer remove
INFO: Removing web application at context path /srp
Aug 26, 2004 1:27:15 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL 
file:/usr/local/jakarta-tomcat-5.0.27/conf/Catalina/
localhost/srp.xml
Aug 26, 2004 1:27:15 PM org.apache.catalina.startup.HostConfig deployDescriptors
SEVERE: Error deploying configuration descriptor srp.xml
java.io.IOException: java.io.FileNotFoundException: 
/usr/local/jakarta-tomcat-5.0.27/conf/Catalina/
localhost/srp.xml (No such file or directory)
        at 
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:494)
        at org.apache.catalina.core.StandardHost.install(StandardHost.java:863)
        at 
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:482)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1068)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:327)
        at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at 
org.apache.catalina.core.StandardHost.backgroundProcess(StandardHost.java:800)
        at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.
java:1619)
        at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.
java:1628)
        at 
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:
1608)
        at java.lang.Thread.run(Thread.java:552)


context.xml from META-INF
--------------------------
<Context path="/srp" docBase="srp"  debug="1" reloadable="true">
  <Resource name="jdbc/srp" type="javax.sql.DataSource" auth="Container"/>
    <ResourceParams name="jdbc/srp">
      <parameter>
        <name>maxWait</name>
        <value>5000</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>20</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>test</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>test</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:microsoft:sqlserver://192.168.1.17:1433;databaseName=srp</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>2</value>
      </parameter>
    </ResourceParams>
</Context>




Disclaimer:
---------------------------
I and my coworker spent 2 days debugging this.   We read all of the Tomcat 5 
documentation, the 
newsgroup bug reports, and reviewed all the outstanding Tomcat 5 bugs in bugzilla.  We 
tried all 
manner of context configurations and locations.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to