When I arrived at the '#' technique, it was by reading the code for
org.apache.catalina.startup.HostConfig to see how it processed the
context fragments ( I heart open source).  Looking at the same class, it
looks like it uses the name of the war file to name the context fragment
if it's copying the fragment from the META-INF directory.  The 'path'
attribute is only used if the Context element is inline in the
server.xml.  You could try is deploying the Context configuration
seperately in a file called servlet#myservlet.xml in the configuration
base, and pointing to your war file in the Context's docBase attribute.
I know this works, because it's how I manage things.

If you need to bundle the context information into the war file and also
specify a multiple level path, then I think the HostConfig class would
have to be changed to parse the '#' in the war file's name to '/' (in
HostConfig.deployWARs(File appBase, String[] files), for example).

Benjamin J. Armintor
Operations Systems Specialist
ITS-Systems: Mainframe Group
University of Texas - Austin
tele: (512) 232-6562
email: [EMAIL PROTECTED]
 


-----Original Message-----
From: Durfee, Bernard [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 21, 2005 9:03 AM
To: Tomcat Users List
Subject: RE: Major bug in deployer!!


Thanks for the response Doug. Can you describe how to do this remotely?
I tried renaming 'context.xml' to 'servlet#myservlet.xml' in the WAR
file, but as I expected the deployer did not find the file. I'm not sure
where this is described in the documentation, the only significant item
I could find was...

"You may define as many Context elements as you wish. Each such Context
MUST have a unique context path, which is defined by the path
attribute."

...and...

"Please note that for tomcat 5, unlike tomcat 4.x, it is NOT recommended
to place <Context> elements directly in the server.xml file."

...but neither mention the usage of the '#' character or that the 'path'
attribute is ignored and the name of the WAR file is used instead as the
context path. I am pretty sure this is the case because I just changed
my 'context.xml' file to...

...
<Context path="/something-other-than-myservlet" reloadable="true"> ...

...and when I deployed the servlet 'myservlet.war' Tomcat simply created
a 'myservlet.xml' file and used 'myservlet' as the context path. To me
it seems like a problem when the documentation discourages the inclusion
of a <context> in the 'server.xml' file and yet does not respect the
'path' attribute in the <context> element.

So my question remains... Is there a workaround for this problem that
will allow me to deploy my web application using the deployer when my
web application context path needs to be '/servlet/myservlet'? Yes, the
context NEEDS to be '/servlet/myservlet'!

Bernard Durfee

-----Original Message-----
From: Parsons Technical Services [mailto:[EMAIL PROTECTED]

Sent: Thursday, January 20, 2005 6:17 PM
To: Tomcat Users List
Subject: Re: Major bug in deployer!!


This is the default action of the 5.5 path and is noted on the context 
documentation. The way to fix this is to name the context.xml as 
servlet#myservlet.xml

Doug


----- Original Message ----- 
From: "Durfee, Bernard" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[email protected]>
Sent: Thursday, January 20, 2005 10:48 AM
Subject: Major bug in deployer!!


I am trying to use the Tomcat manager to deploy a web application packed
in a WAR file. In my WAR file I have a directory named 'META-INF' and in
that directory I have a file named 'context.xml'. The 'context.xml' file
looks like...

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/servlet/myservlet" reloadable="true">
    ...
</Context>

...so I am telling Tomcat to send all URLs ending with
'/servlet/myservlet' to the web application being deployed. I do a
browse, point to the WAR file and then press 'Deploy'. Tomcat then
copies the WAR file to '/webapps' and copies the 'context.xml' file to
'conf/.../myservlet.xml'.

So far so good.

Now when I go to the manager listing the web applications I see
'/myservlet' in the 'Applications' column. Uh oh! Seems that the 'path'
attribute in the 'context.xml' file is being completely ignored! So
right now I am forced to put the <Context> element in the 'server.xml'
file directly, in which Tomcat respects the 'path' attribute.

So my question is... Is there a workaround for this problem that will
allow me to deploy my web application using the deployer when my web
application context path needs to be '/servlet/myservlet'? Yes, the
context NEEDS to be '/servlet/myservlet'!

I have tried this in 5.5.4, 5.5.6 and 5.5.7 with the same results. The
deployer would make life on our network admin MUCH easier because I
would be able to deploy new versions of the web application without
bugging him to install them manually. Thanks in advance!!

Bernard Durfee

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





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


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


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

Reply via email to