You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "DHARNA, AJAY [AG/1000]" <aj...@monsanto.com> on 2007/01/24 06:07:43 UTC

Path element in context.xml

Hi, 
I had posted this question earlier on the users mailing list and got no
response, so I am going to try and re-post it again and also post it on the
dev mailing list.

I have recently upgrade from tomcat 5.0.28 to 5.5.20 and everything seems to
be working fine for most of my apps except for the ones that have context
with multi-level path. Also I should mention that I am not unpacking any of
my war files. (unpackWARs="false" autoDeploy="true")

I deployed my app - foo.war which had the following context in
foo.war/meta-inf/context.xml 

<Context path="/some/foo" docBase="foo.war" debug="0" privileged="true"
reloadable="true"/> 


In the Tomcat Manager Application List, I only see the path /foo and also in
the <TOMCAT_CONF>/Catalina/hostname there is a file called foo.xml. If I try
to hit the url  < <http://localhost:8080/some/foo>
http://localhost:8080/some/foo>  <http://localhost:8080/some/foo>
http://localhost:8080/some/foo - it doesn't work.

I did some reach on this issue and found a similar issue in bugzilla ( <
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38198>
http://issues.apache.org/bugzilla/show_bug.cgi?id=38198>

 <http://issues.apache.org/bugzilla/show_bug.cgi?id=38198>
http://issues.apache.org/bugzilla/show_bug.cgi?id=38198) that mentioned that
the path element is no longer being used and it mentions that I should
rename the context.xml file to contain the path. According to Bug#:38198 in
bugzilla - the fix is to rename the foo.xml file to be some#foo.xml and
remove the path. So I renamed the file in
<TOMCAT_CONF>/Catalina/hostname/foo.xml to
<TOMCAT_CONF>/Catalina/hostname/some#foo.xml and it now contains the

following: 

<Context docBase="foo.war" debug="0" privileged="true" reloadable="true"/> 

When I do this and start up tomcat, I get the following error: 

SEVERE: Error starting static Resources 
java.lang.IllegalArgumentException: Document base
C:\www\tomcat_5.5.20\webapps\some\foo does not exist or is not a readable
directory

        at
org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:14

0) 
        at
org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java

:3848) 
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4019) 
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7

59) 
        at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) 
        at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) 
        at 
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608)


        at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535

) 
        at 
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470) 
        at 
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122) 
        at 
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310) 
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor

t.java:119) 
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021) 
        at 
org.apache.catalina.core.StandardHost.start(StandardHost.java:718) 
        at 
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013) 
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) 
        at 
org.apache.catalina.core.StandardService.start(StandardService.java:450) 
        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:709) 
        at org.apache.catalina.startup.Catalina.start(Catalina.java:551) 
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39

) 
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl

.java:25) 
        at java.lang.reflect.Method.invoke(Method.java:585) 
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294) 
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432) 
Jan 19, 2007 3:58:06 PM org.apache.catalina.core.StandardContext start 
SEVERE: Error in resourceStart() 
Jan 19, 2007 3:58:06 PM org.apache.catalina.core.StandardContext start 
SEVERE: Error getConfigured 
Jan 19, 2007 3:58:06 PM org.apache.catalina.core.StandardContext start 
SEVERE: Context [/some/foo] startup failed due to previous errors 
Jan 19, 2007 3:58:06 PM org.apache.catalina.core.StandardContext stop 
INFO: Container
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/some/foo] 
has not been started 


I also tried changing the docBase to be the absolute path of the war file: 

some#foo.xml 
<Context docBase="C:\www\tomcat_5.5.20\webapps\foo.war" debug="0"
privileged="true" reloadable="true"/> 

But I get the same result as above. 

Could someone please tell me how they are able to get this to work with 5.5 
- what changes do I need to make so that when I deploy my war - foo.war, it
show up in the Tomcat Manager Application List with path /some/foo

Thanks for your help 
Ajay. 


---------------------------------------------------------------------------------------------------------
This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited.


All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment.
---------------------------------------------------------------------------------------------------------


Re: Path element in context.xml

Posted by Andre Prasetya <an...@gmail.com>.
This question being asked many times by many people.

Context path="xxx" is not supposed to be used unless you mention it at
server.xml but its strongly discouraged.CMIIW

so far i only use the war name as its deploy path like foo.war will map to
localhost:8080/foo/<servlet mapping>


On 1/24/07, DHARNA, AJAY [AG/1000] <aj...@monsanto.com> wrote:
>
> Hi,
> I had posted this question earlier on the users mailing list and got no
> response, so I am going to try and re-post it again and also post it on
> the
> dev mailing list.
>
> I have recently upgrade from tomcat 5.0.28 to 5.5.20 and everything seems
> to
> be working fine for most of my apps except for the ones that have context
> with multi-level path. Also I should mention that I am not unpacking any
> of
> my war files. (unpackWARs="false" autoDeploy="true")
>
> I deployed my app - foo.war which had the following context in
> foo.war/meta-inf/context.xml
>
> <Context path="/some/foo" docBase="foo.war" debug="0" privileged="true"
> reloadable="true"/>
>
>
> In the Tomcat Manager Application List, I only see the path /foo and also
> in
> the <TOMCAT_CONF>/Catalina/hostname there is a file called foo.xml. If I
> try
> to hit the url  < <http://localhost:8080/some/foo>
> http://localhost:8080/some/foo>  <http://localhost:8080/some/foo>
> http://localhost:8080/some/foo - it doesn't work.
>
> I did some reach on this issue and found a similar issue in bugzilla ( <
> <http://issues.apache.org/bugzilla/show_bug.cgi?id=38198>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=38198>
>
> <http://issues.apache.org/bugzilla/show_bug.cgi?id=38198>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=38198) that mentioned
> that
> the path element is no longer being used and it mentions that I should
> rename the context.xml file to contain the path. According to Bug#:38198
> in
> bugzilla - the fix is to rename the foo.xml file to be some#foo.xml and
> remove the path. So I renamed the file in
> <TOMCAT_CONF>/Catalina/hostname/foo.xml to
> <TOMCAT_CONF>/Catalina/hostname/some#foo.xml and it now contains the
>
> following:
>
> <Context docBase="foo.war" debug="0" privileged="true" reloadable="true"/>
>
> When I do this and start up tomcat, I get the following error:
>
> SEVERE: Error starting static Resources
> java.lang.IllegalArgumentException: Document base
> C:\www\tomcat_5.5.20\webapps\some\foo does not exist or is not a readable
> directory
>
>         at
> org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java
> :14
>
> 0)
>         at
> org.apache.catalina.core.StandardContext.resourcesStart(
> StandardContext.java
>
> :3848)
>         at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4019)
>         at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java
> :7
>
> 59)
>         at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
>         at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
>         at
> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java
> :608)
>
>
>         at
> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java
> :535
>
> )
>         at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
>         at
> org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
>         at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
>         at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent
> (LifecycleSuppor
>
> t.java:119)
>         at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
>         at
> org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
>         at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
>         at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
>         at
> org.apache.catalina.core.StandardService.start(StandardService.java:450)
>         at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
>         at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
> :39
>
> )
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl
>
> .java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
>         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
> Jan 19, 2007 3:58:06 PM org.apache.catalina.core.StandardContext start
> SEVERE: Error in resourceStart()
> Jan 19, 2007 3:58:06 PM org.apache.catalina.core.StandardContext start
> SEVERE: Error getConfigured
> Jan 19, 2007 3:58:06 PM org.apache.catalina.core.StandardContext start
> SEVERE: Context [/some/foo] startup failed due to previous errors
> Jan 19, 2007 3:58:06 PM org.apache.catalina.core.StandardContext stop
> INFO: Container
> org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/some/foo]
> has not been started
>
>
> I also tried changing the docBase to be the absolute path of the war file:
>
> some#foo.xml
> <Context docBase="C:\www\tomcat_5.5.20\webapps\foo.war" debug="0"
> privileged="true" reloadable="true"/>
>
> But I get the same result as above.
>
> Could someone please tell me how they are able to get this to work with
> 5.5
> - what changes do I need to make so that when I deploy my war - foo.war,
> it
> show up in the Tomcat Manager Application List with path /some/foo
>
> Thanks for your help
> Ajay.
>
>
>
> ---------------------------------------------------------------------------------------------------------
> This e-mail message may contain privileged and/or confidential
> information, and is intended to be received only by persons entitled to
> receive such information. If you have received this e-mail in error, please
> notify the sender immediately. Please delete it and all attachments from any
> servers, hard drives or any other media. Other use of this e-mail by you is
> strictly prohibited.
>
>
> All e-mails and attachments sent and received are subject to monitoring,
> reading and archival by Monsanto. The recipient of this e-mail is solely
> responsible for checking for the presence of "Viruses" or other "Malware".
> Monsanto accepts no liability for any damage caused by any such code
> transmitted by or accompanying this e-mail or any attachment.
>
> ---------------------------------------------------------------------------------------------------------
>
>
>


-- 
-Andre-

People see things the way they are and say "why ?" I see things that never
were and say "Why not ?"

Re: Deploy WAR file with multi-level context path (was: Re: Path element in context.xml)

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Markus Schönhaber wrote:

> I've done some more research but didn't find a way to deploy a WAR file so
> that the application is accessible via a multi-level context path.
> Is there a way to achieve this?

There is, as Chris explains:
http://issues.apache.org/bugzilla/show_bug.cgi?id=41447#c3

Regards
  mks

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Deploy WAR file with multi-level context path (was: Re: Path element in context.xml)

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Markus Schönhaber wrote:
> Markus Schönhaber wrote:
> > So, name your WAR file "some#foo.war".
>
> I'm wrong. Although I seemed to remember that I once did it that way,
> trying to do it failed for me on 5.5.20 too (should have tried *before*
> answering). So, if I didn't overlook something very obvious, your Bugzilla
> report propably isn't invalid either.

I've done some more research but didn't find a way to deploy a WAR file so 
that the application is accessible via a multi-level context path.
Is there a way to achieve this?

Regards
  mks

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Path element in context.xml

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Markus Schönhaber wrote:

> So, name your WAR file "some#foo.war".

I'm wrong. Although I seemed to remember that I once did it that way, trying 
to do it failed for me on 5.5.20 too (should have tried *before* answering).
So, if I didn't overlook something very obvious, your Bugzilla report propably 
isn't invalid either.

Regards
  mks

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Path element in context.xml

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
DHARNA, AJAY [AG/1000] wrote:

> I had posted this question earlier on the users mailing list and got no
> response, so I am going to try and re-post it again and also post it on the
> dev mailing list.

The dev list is no place for user specific questions. Don't post this there.

> I have recently upgrade from tomcat 5.0.28 to 5.5.20 and everything seems
> to be working fine for most of my apps except for the ones that have
> context with multi-level path. Also I should mention that I am not
> unpacking any of my war files. (unpackWARs="false" autoDeploy="true")
>
> I deployed my app - foo.war which had the following context in
> foo.war/meta-inf/context.xml
>
> <Context path="/some/foo" docBase="foo.war" debug="0" privileged="true"
> reloadable="true"/>

First, read
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
and notice that the "path" attribute of <Context> must not be set (with one 
exception which is irrelevant here). Atm, it's value is silently ignored.

I don't see the description how multi-level context paths can be achieved in 
the 5.5 docs. But the following snippet from the 6.0 docs also applies to 
5.5:
"Multi-level context paths may be defined using #, e.g. context#path.xml."

So, name your WAR file "some#foo.war".

Regards
  mks

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org