Hi Mark,

Please see my responses below. Thanks.

Best Regards,
Andy Ee
 
 

-----Original Message-----
From: Mark Thomas [mailto:ma...@apache.org] 
Sent: Monday, August 17, 2009 7:04 PM
To: Tomcat Users List
Subject: Re: Multi-Level Context Paths

Andy Ee wrote:
> There is a new requirement to setup multi-level context path as in I need
> the URL to be  <http://localhost:8080/sg/server/test/>

Remove all the old files you no longer want:
$CATALINA_BASE/webapps/test.war
$CATALINA_BASE/conf/Catalina/localhost/test.xml
$CATALINA_BASE/conf/Catalina/localhost/sg#server#test.xml


Andy: Yes, I have deleted all the unnecessary war files as well as the xml
files.


Rename your WAR to sg#server#test.war

Place your renamed war in:
$CATALINA_BASE/webapps/

Any META-INF/context.xml will be extracted to:
$CATALINA_BASE/conf/Catalina/localhost/sg#server#test.xml

Andy: Yes, there is a file under my unpackaged sg#server#test.war. The file
is /usr/local/apache-tomcat/webapps/sg#server#test/META-INF/context.xml and
its content is:

<Context path="/test" debug="99" reloadable="true"
    antiJARLocking="true" antiResourceLocking="false">

    <!--Resource name="jdbc/moneysend" auth="Container"
type="javax.sql.DataSource"
              maxActive="100" maxIdle="30" maxWait="10000"
              driverClassName="oracle.jdbc.driver.OracleDriver"
              username="MS3_STL" password="password"
              url="jdbc:oracle:thin:@192.168.0.37:1521:MS3"
              defaultAutoCommit="true" removeAbandoned="true"
              removeAbandonedTimeout="60" logAbandoned="true"/-->
</Context>

I noticed that the context path is still /test. I have removed path="/test"
from the Context element. I done the same for
/usr/local/apache-tomcat/conf/Catalina/localhost/sg#server#test.xml and
restarted Tomcat.


Under catalina.log, I saw new errors:

INFO: Undeploying context [/sg/server/test]
Aug 17, 2009 7:30:09 PM org.apache.catalina.core.StandardContext
resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base
/usr/local/apache-tomcat/webapps/sg#server#test does not exist or is not a
readable directory
        at
org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:14
2)
        at
org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java
:4048)
        at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
91)
        at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
        at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
        at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556
)
        at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
        at
org.apache.catalina.startup.HostConfig.check(HostConfig.java:1274)
        at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296)
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:119)
        at
org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:
1337)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
hildren(ContainerBase.java:1601)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
hildren(ContainerBase.java:1610)
        at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(Cont
ainerBase.java:1590)
        at java.lang.Thread.run(Thread.java:619)
Aug 17, 2009 7:30:09 PM org.apache.catalina.core.StandardContext start
SEVERE: Error in resourceStart()
Aug 17, 2009 7:30:09 PM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
Aug 17, 2009 7:30:09 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/sg/server/test] startup failed due to previous errors
Aug 17, 2009 7:30:09 PM org.apache.catalina.core.StandardContext stop
INFO: Container
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/sg/server/te
st] has not been started
Error occurred during initialization of VM
java.lang.Error: Properties init: Could not determine current working
directory.
        at java.lang.System.initProperties(Native Method)
        at java.lang.System.initializeSystemClass(System.java:1070)



> <Context path="/test" debug="99" reloadable="true"

As stated in the docs for the context element, you should not specify
the path attribute in this case.

> java.lang.IllegalArgumentException: Document base
> /usr/local/apache-tomcat/webapps/sg#server#test does not exist or is not a
> readable directory

If Tomcat finds:
$CATALINA_BASE/conf/Catalina/localhost/sg#server#test.xml

It expects to find a matching war
$CATALINA_BASE/webapps/sg#server#test.war
or directory
$CATALINA_BASE/webapps/sg#server#test

Mark



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



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

Reply via email to