You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jakub 1983 <jj...@gmail.com> on 2013/04/17 11:35:22 UTC

conf/Catalina/localhost/myWebApp.xml context file disappears

when I copy new version of myWebApp.war into webapps directory my context
from
conf/Catalina/localhost/ disappears (this context was manually created by
me),

maybe tomcat first deletes war, and also delete corresponding context file,
is there any way to prevent it ?
how should such update be done ?
  a) in developer mode (on my local mashine, when I want to copy from
console)
  b) in production mode, not so frequently

regards
Jakub

Re: conf/Catalina/localhost/myWebApp.xml context file disappears

Posted by Jakub 1983 <jj...@gmail.com>.
Andre, thx for you reply.

My war has no /META-INF/context.xml, here is piece of server.xml:

      <Host name="localhost"  appBase="C:\test\catalina_base\webapps"
            unpackWARs="true" autoDeploy="true" deployOnStartup="true"
deployXML="false">


even with deployXML="false" my jdbc.context if removed from
C:\test\catalina_base\conf\Catalina\localhost

Regards
Jakub



On Wed, Apr 17, 2013 at 2:14 PM, André Warnier <aw...@ice-sa.com> wrote:

> Jakub 1983 wrote:
>
>> when I copy new version of myWebApp.war into webapps directory my context
>> from
>> conf/Catalina/localhost/ disappears (this context was manually created by
>> me),
>>
>> maybe tomcat first deletes war, and also delete corresponding context
>> file,
>> is there any way to prevent it ?
>> how should such update be done ?
>>   a) in developer mode (on my local mashine, when I want to copy from
>> console)
>>   b) in production mode, not so frequently
>>
>>
> Hi.
> I do not know the answer to your question, so I tried to figure it out
> using the on-line Tomcat 7.0 documentation.
> And I couldn't, really.
>
> I suppose that it has something to do with the "xmlBase" and "copyXML" and
> "deployXML" attributes of the <Host>, here : http://tomcat.apache.org/**
> tomcat-7.0-doc/config/host.**html<http://tomcat.apache.org/tomcat-7.0-doc/config/host.html>
> (and also with the "Deployer" page at http://tomcat.apache.org/**
> tomcat-7.0-doc/deployer-howto.**html<http://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html>
> )
>
> But I'll be damned if I understand how these things interact for your case
> above.
> Maybe I missed the crucial clue somewhere though..
>
> Maybe an additional question to you : does your .war file contain a
> "/META-INF/context.xml" file ?
>
> Note: there is a hint that if you set <Host .. deployXML="false" ..>, this
> overwriting (or deleting) may not happen.  But it is not very clear.
> And since it is at the <Host> level, it would apply to all applications of
> that Host, not just the one you are talking about.
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<us...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: conf/Catalina/localhost/myWebApp.xml context file disappears

Posted by André Warnier <aw...@ice-sa.com>.
Jakub 1983 wrote:
> when I copy new version of myWebApp.war into webapps directory my context
> from
> conf/Catalina/localhost/ disappears (this context was manually created by
> me),
> 
> maybe tomcat first deletes war, and also delete corresponding context file,
> is there any way to prevent it ?
> how should such update be done ?
>   a) in developer mode (on my local mashine, when I want to copy from
> console)
>   b) in production mode, not so frequently
> 

Hi.
I do not know the answer to your question, so I tried to figure it out using the on-line 
Tomcat 7.0 documentation.
And I couldn't, really.

I suppose that it has something to do with the "xmlBase" and "copyXML" and "deployXML" 
attributes of the <Host>, here : http://tomcat.apache.org/tomcat-7.0-doc/config/host.html
(and also with the "Deployer" page at 
http://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html)

But I'll be damned if I understand how these things interact for your case above.
Maybe I missed the crucial clue somewhere though..

Maybe an additional question to you : does your .war file contain a 
"/META-INF/context.xml" file ?

Note: there is a hint that if you set <Host .. deployXML="false" ..>, this overwriting (or 
deleting) may not happen.  But it is not very clear.
And since it is at the <Host> level, it would apply to all applications of that Host, not 
just the one you are talking about.

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


Re: conf/Catalina/localhost/myWebApp.xml context file disappears

Posted by Jakub 1983 <jj...@gmail.com>.
Mark,
thx for investigation,
apart from users@tomcat.apache.org I have also sent previous post with
attachments to markt@apache.org

regards
Jakub


On Tue, Apr 23, 2013 at 1:04 PM, Mark Thomas <ma...@apache.org> wrote:

> On 21/04/2013 13:57, Jakub 1983 wrote:
> > Mark,
> > sorry I didn't reply so long, but my previous tomcat was messed with
> > tests and many attempts, now I did everything from start with clean
> > tomcat installation and confirm context xml disappears.
> >
> > steps to reproduce
> >
> > 1) make dir  C:\tomcat_test
> > 2) download apache-tomcat-7.0.39.zip and unpack it in C:\tomcat_test
>
> The list strips attachments but there is enough information for me to
> reproduce the behaviour with a simple webapp. (The moral here is that
> you should aim to reproduce any problem you report with as simple a
> webapp as possible. A 5 line JSP and a 3 line context.xml file is all
> that is needed for this issue.)
>
> > 3) in C:\tomcat_test unpack attached jdbc.7z
> > 4) start tomcat with startup.bat
> > 4) in c:\tomcat_test\jdbc> call ant deploy-war
>
> OK. That copies the WAR file to the appBase of a running Tomcat instance
> so with the default config it will be unpacked and deployed.
>
> > 5) open http://localhost:8080/jdbc/select.jsp result is:
> > org.apache.jasper.JasperException: An exception occurred processing JSP
> > page /select.jsp at line 22 .....
> > root cause
> > javax.servlet.ServletException: javax.naming.NameNotFoundException: Name
> > [jdbc/Test] is not bound in this Context. Unable to find [jdbc].
> > 6) into C:\tomcat_test\apache-tomcat-7.0.39\conf\Catalina\localhost
> > insert attached jdbc.xml
>
> OK. That will have no effect as although Tomcat sees the new file it
> does not redploy the webapp (arguably it should at this point - I'll
> look into that).
>
> > 7) close tomcat console
> > 8) start tomcat with startup.bat
>
> That causes Tomcat to deploy the webapp using the context.xml file.
>
> > 9) again open result is OK, config works fine, error is caused by lack
> > of h2 jar (org.apache.jasper.JasperException:
> > javax.servlet.ServletException:
> > org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver
> > class 'org.h2.Driver')
> > 10) now in notepad++ open
> > C:\tomcat_test\jdbc\src\main\webapp\select.jsp, change title to
> > <title>Simple jsp page 2</t>
> > 11) as in 4) in c:\tomcat_test\jdbc> call ant deploy-war
> > jdbc.xml disappeared from
>
> This is the interesting bit. I do see the context.xml file being deleted.
>
> I'm not sure if this is the correct behaviour or not. There are a lot of
> variables when looking at auto-deployment. I have been meaning to sit
> down and document all the possible combinations. This might be the time
> to do that.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: conf/Catalina/localhost/myWebApp.xml context file disappears

Posted by Mark Thomas <ma...@apache.org>.
On 21/04/2013 13:57, Jakub 1983 wrote:
> Mark,
> sorry I didn't reply so long, but my previous tomcat was messed with
> tests and many attempts, now I did everything from start with clean
> tomcat installation and confirm context xml disappears.
> 
> steps to reproduce
> 
> 1) make dir  C:\tomcat_test
> 2) download apache-tomcat-7.0.39.zip and unpack it in C:\tomcat_test

The list strips attachments but there is enough information for me to
reproduce the behaviour with a simple webapp. (The moral here is that
you should aim to reproduce any problem you report with as simple a
webapp as possible. A 5 line JSP and a 3 line context.xml file is all
that is needed for this issue.)

> 3) in C:\tomcat_test unpack attached jdbc.7z
> 4) start tomcat with startup.bat
> 4) in c:\tomcat_test\jdbc> call ant deploy-war

OK. That copies the WAR file to the appBase of a running Tomcat instance
so with the default config it will be unpacked and deployed.

> 5) open http://localhost:8080/jdbc/select.jsp result is:
> org.apache.jasper.JasperException: An exception occurred processing JSP
> page /select.jsp at line 22 ..... 
> root cause 
> javax.servlet.ServletException: javax.naming.NameNotFoundException: Name
> [jdbc/Test] is not bound in this Context. Unable to find [jdbc].
> 6) into C:\tomcat_test\apache-tomcat-7.0.39\conf\Catalina\localhost
> insert attached jdbc.xml

OK. That will have no effect as although Tomcat sees the new file it
does not redploy the webapp (arguably it should at this point - I'll
look into that).

> 7) close tomcat console
> 8) start tomcat with startup.bat

That causes Tomcat to deploy the webapp using the context.xml file.

> 9) again open result is OK, config works fine, error is caused by lack
> of h2 jar (org.apache.jasper.JasperException:
> javax.servlet.ServletException:
> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver
> class 'org.h2.Driver')
> 10) now in notepad++ open
> C:\tomcat_test\jdbc\src\main\webapp\select.jsp, change title to
> <title>Simple jsp page 2</t>
> 11) as in 4) in c:\tomcat_test\jdbc> call ant deploy-war
> jdbc.xml disappeared from

This is the interesting bit. I do see the context.xml file being deleted.

I'm not sure if this is the correct behaviour or not. There are a lot of
variables when looking at auto-deployment. I have been meaning to sit
down and document all the possible combinations. This might be the time
to do that.

Mark


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


Re: conf/Catalina/localhost/myWebApp.xml context file disappears

Posted by Jakub 1983 <jj...@gmail.com>.
Mark,
sorry I didn't reply so long, but my previous tomcat was messed with tests
and many attempts, now I did everything from start with clean tomcat
installation and confirm context xml disappears.

steps to reproduce

1) make dir  C:\tomcat_test
2) download apache-tomcat-7.0.39.zip and unpack it in C:\tomcat_test
3) in C:\tomcat_test unpack attached jdbc.7z
4) start tomcat with startup.bat
4) in c:\tomcat_test\jdbc> call ant deploy-war
5) open http://localhost:8080/jdbc/select.jsp result is:
org.apache.jasper.JasperException: An exception occurred processing JSP
page /select.jsp at line 22 .....
root cause
javax.servlet.ServletException: javax.naming.NameNotFoundException: Name
[jdbc/Test] is not bound in this Context. Unable to find [jdbc].
6) into C:\tomcat_test\apache-tomcat-7.0.39\conf\Catalina\localhost insert
attached jdbc.xml
7) close tomcat console
8) start tomcat with startup.bat
9) again open result is OK, config works fine, error is caused by lack of
h2 jar (org.apache.jasper.JasperException: javax.servlet.ServletException:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver
class 'org.h2.Driver')
10) now in notepad++ open C:\tomcat_test\jdbc\src\main\webapp\select.jsp,
change title to <title>Simple jsp page 2</t>
11) as in 4) in c:\tomcat_test\jdbc> call ant deploy-war
jdbc.xml disappeared from
C:\tomcat_test\apache-tomcat-7.0.39\conf\Catalina\localhost , go to 5)
result is the same as in 5)

I run it on windows 7 64 bit

regards
Jakub


On Fri, Apr 19, 2013 at 12:34 AM, Mark Thomas <ma...@apache.org> wrote:

> On 17/04/2013 23:46, Jakub 1983 wrote:
> > I call ant task
> >     <target name="deploy-war" depends="create-war">
> >         <copy file="${target.dir}/${war.file}" todir="${deploy.dir}"/>
> >     </target>
> >
> > application is called jdbc.war, and I create jdbc.xml in
> > conf/Catalina/localhost/ after I deploy war and previous jdbc.xml
> > disappears - I create it on running tomcat.
>
> When exactly do you create jdbc.xml? Can you explain, step-by-step, what
> you do starting from a clean Tomcat install when Tomcat is not running.
> I am looking for the order you:
> - start or stop Tomcat
> - copy any WAR / xml files
> - delete any WAR / xml files
> - do anything to change the timestamp of any WAR / xml files
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: conf/Catalina/localhost/myWebApp.xml context file disappears

Posted by Mark Thomas <ma...@apache.org>.
On 17/04/2013 23:46, Jakub 1983 wrote:
> I call ant task
>     <target name="deploy-war" depends="create-war">
>         <copy file="${target.dir}/${war.file}" todir="${deploy.dir}"/>
>     </target>
> 
> application is called jdbc.war, and I create jdbc.xml in
> conf/Catalina/localhost/ after I deploy war and previous jdbc.xml
> disappears - I create it on running tomcat.

When exactly do you create jdbc.xml? Can you explain, step-by-step, what
you do starting from a clean Tomcat install when Tomcat is not running.
I am looking for the order you:
- start or stop Tomcat
- copy any WAR / xml files
- delete any WAR / xml files
- do anything to change the timestamp of any WAR / xml files

Mark


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


Re: conf/Catalina/localhost/myWebApp.xml context file disappears

Posted by Jakub 1983 <jj...@gmail.com>.
I call ant task
    <target name="deploy-war" depends="create-war">
        <copy file="${target.dir}/${war.file}" todir="${deploy.dir}"/>
    </target>

application is called jdbc.war, and I create jdbc.xml in
conf/Catalina/localhost/ after I deploy war and previous jdbc.xml
disappears - I create it on running tomcat.

Regards
Jakub


On Wed, Apr 17, 2013 at 10:04 PM, Mark Thomas <ma...@apache.org> wrote:

> On 17/04/2013 10:35, Jakub 1983 wrote:
> > when I copy new version of myWebApp.war into webapps directory my context
> > from
> > conf/Catalina/localhost/ disappears (this context was manually created by
> > me),
>
> What, exactly, are you doing? For example, copy and overwrite has very
> different behaviour (at least it should) to delete then replace.
>
> How (and when) you create the context.xml file also matters as does the
> running state of Tomcat when you make any changes.
>
> Mark
>
> >
> > maybe tomcat first deletes war, and also delete corresponding context
> file,
> > is there any way to prevent it ?
> > how should such update be done ?
> >   a) in developer mode (on my local mashine, when I want to copy from
> > console)
> >   b) in production mode, not so frequently
> >
> > regards
> > Jakub
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: conf/Catalina/localhost/myWebApp.xml context file disappears

Posted by Mark Thomas <ma...@apache.org>.
On 17/04/2013 10:35, Jakub 1983 wrote:
> when I copy new version of myWebApp.war into webapps directory my context
> from
> conf/Catalina/localhost/ disappears (this context was manually created by
> me),

What, exactly, are you doing? For example, copy and overwrite has very
different behaviour (at least it should) to delete then replace.

How (and when) you create the context.xml file also matters as does the
running state of Tomcat when you make any changes.

Mark

> 
> maybe tomcat first deletes war, and also delete corresponding context file,
> is there any way to prevent it ?
> how should such update be done ?
>   a) in developer mode (on my local mashine, when I want to copy from
> console)
>   b) in production mode, not so frequently
> 
> regards
> Jakub
> 


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