You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bjoern Raupach <ra...@me.com> on 2011/10/18 14:02:41 UTC

Undeploy fails with Tomcat 7 manager application

Hi group,

we are using Tomcat 7.0.21 on Windows XP with the manager application for remote deployment.  Tomcat is configured to unpack wars. Deploying works. However undeploy fails for the following reason:
FAIL - Unable to delete [C:\Programme\Apache Software Foundation\Tomcat 7.0\webapps\mywebapp]. The continued presence of this file may cause problems.
The exploded WAR file mywebapp is still in the webapp folder. The war file gets deleted. Now, we can't even redeploy or deploy. We have to manually delete the folder mywebapp.

Any ideas?
- Björn

Re: Undeploy fails with Tomcat 7 manager application

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mike,

On 10/26/2011 2:40 AM, Mike wrote:
> Understood. Thanks! I changed the logfile location to be the log
> folder of the tomcat server and the redeploy is working (amongst 10
> redeploys only 1 failed). I am using log4j so I don't control the
> process of shutting down the logging system (at least I wouldn't
> know how to).

Use a ServletContextListener like this to both configure and shutdown
log4j:

public class Log4jListener
    implements ServletContextListener
{
    private Logger logger;

    public void contextInitialized(ServletContextEvent e)
    {
        // Trigger loading of the log4j.properties file from the
classpath.
        new PropertyConfigurator();

        logger = Logger.getLogger(this.getClass());

        logger.info("Log4j initialized");
    }

    public void contextDestroyed(ServletContextEvent e)
    {
        if(LogManager.class.getClassLoader()
           .equals(this.getClass().getClassLoader()))
        {
            logger.info("Log4j was loaded by application classloader;
shutting down.");

            LogManager.shutdown();
        }
        else
        {
            logger.info("Log4j was loaded by some other ClassLoader;
not shutting down.");
        }
    }
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6phXsACgkQ9CaO5/Lv0PBVRQCfcN9ez7DO/f74fJNTySL+gfBF
6d4AoJBTaA/Uai7kwz4hgP6QKnD2/XVI
=+G4j
-----END PGP SIGNATURE-----

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


Re: Undeploy fails with Tomcat 7 manager application

Posted by Mike <gr...@hotmail.com>.
Christopher Schultz <chris <at> christopherschultz.net> writes:
> Mike,
> 
> Sounds like you aren't properly shutting-down your logging system when
> your webapp undeploys. That would result in the file staying open and
> thus being unavailable for delete.
> 
> I agree with Pid that putting application log files into the
> deployment directory is a bad idea in general: they'll get deleted
> when you redeploy :)
> 
> -chris
> 

Understood. Thanks! I changed the logfile location to be the log folder of the 
tomcat server and the redeploy is working (amongst 10 redeploys only 1 
failed). I am using log4j so I don't control the process of shutting down the 
logging system (at least I wouldn't know how to).





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


Re: Undeploy fails with Tomcat 7 manager application

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mike,

On 10/22/2011 7:38 AM, Mike wrote:
> The logfile is created within the application deployed to the
> webapps directory of tomcat (and there within
> "[applicationName]\resources\log").
> 
> I am not trying to delete it. However, when issuing the redeploy
> command with maven the problem appears ("The continued presence of
> this file may cause problems.") and the application cannot be
> redeployed. Even when trying to undeploy the application via the
> tomcat manager (via the manager gui button "undeploy") it cannot be
> undeployed completely. Only the war file and all application files
> except the log file are removed. Only when stopping tomcat can the
> application be completely removed. After starting tomcat again I
> can deploy again successfully.

Sounds like you aren't properly shutting-down your logging system when
your webapp undeploys. That would result in the file staying open and
thus being unavailable for delete.

I agree with Pid that putting application log files into the
deployment directory is a bad idea in general: they'll get deleted
when you redeploy :)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6lsaQACgkQ9CaO5/Lv0PA5QwCdGy2ousZ4bZ0aWvX2Pg7zB0ht
0tUAoLmUQDD2Ee0u1O6R3XDsHL/Y8jUp
=4GME
-----END PGP SIGNATURE-----

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


Re: Undeploy fails with Tomcat 7 manager application

Posted by Pid <pi...@pidster.com>.
On 22/10/2011 12:38, Mike wrote:
> Mark Thomas <markt <at> apache.org> writes:
>>
>> Where is the log file created? Why are you trying to delete it?
>>
>> Mark
>>
> 
> The logfile is created within the application deployed to the webapps 
> directory of tomcat (and there within "[applicationName]\resources\log"). 
> 
> I am not trying to delete it. However, when issuing the redeploy command with 
> maven the problem appears ("The continued presence of this file may 
> cause problems.") and the application cannot be redeployed. Even when 
> trying to undeploy the application via the tomcat manager (via the manager 
> gui button "undeploy") it cannot be undeployed completely. Only the 
> war file and all application files except the log file are removed. Only 
> when stopping tomcat can the application be completely removed. After 
> starting tomcat again I can deploy again successfully. 

Writing the log file (or any file) inside the app isn't such a good
idea.  Try putting it in the tomcat/logs directory.


p



Re: Undeploy fails with Tomcat 7 manager application

Posted by Mike <gr...@hotmail.com>.
Mark Thomas <markt <at> apache.org> writes:
> 
> Where is the log file created? Why are you trying to delete it?
> 
> Mark
> 

The logfile is created within the application deployed to the webapps 
directory of tomcat (and there within "[applicationName]\resources\log"). 

I am not trying to delete it. However, when issuing the redeploy command with 
maven the problem appears ("The continued presence of this file may 
cause problems.") and the application cannot be redeployed. Even when 
trying to undeploy the application via the tomcat manager (via the manager 
gui button "undeploy") it cannot be undeployed completely. Only the 
war file and all application files except the log file are removed. Only 
when stopping tomcat can the application be completely removed. After 
starting tomcat again I can deploy again successfully. 


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


Re: Undeploy fails with Tomcat 7 manager application

Posted by Mark Thomas <ma...@apache.org>.
On 21/10/2011 09:58, Mike wrote:
> Mark Thomas <markt <at> apache.org> writes:
> 
>>
>> On 18/10/2011 13:02, Bjoern Raupach wrote:
>>> Hi group,
>>>
>>> we are using Tomcat 7.0.21 on Windows XP with the manager application for 
> remote deployment.  Tomcat is
>> configured to unpack wars. Deploying works. However undeploy fails for the 
> following reason:
>>> FAIL - Unable to delete [C:\Programme\Apache Software Foundation\Tomcat 7.0
> \webapps\mywebapp]. The
>> continued presence of this file may cause problems.
>>> The exploded WAR file mywebapp is still in the webapp folder. The war file 
> gets deleted. Now, we can't even
>> redeploy or deploy. We have to manually delete the folder mywebapp.
>>>
>>> Any ideas?
>>
>> Fix the memory leaks that are causing one or more files to be left open
>> in the unpacked web application.
>>
>> Mark
>>
> 
> Hello,
> 
> I am too having this problem because the logfile which is created by log4j 
> cannot be deleted since tomcat7 is still accessing it. I don't think this 
> would be called a memory leak!? Even when trying to delete it manually in the 
> file browser it doesn't work. After tomcat is stopped the logfile can be 
> deleted manually.
> 
> Is this a bug or can it somehow be fixed?

Where is the log file created? Why are you trying to delete it?

Mark

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


Re: Undeploy fails with Tomcat 7 manager application

Posted by Mike <gr...@hotmail.com>.
Mark Thomas <markt <at> apache.org> writes:

> 
> On 18/10/2011 13:02, Bjoern Raupach wrote:
> > Hi group,
> > 
> > we are using Tomcat 7.0.21 on Windows XP with the manager application for 
remote deployment.  Tomcat is
> configured to unpack wars. Deploying works. However undeploy fails for the 
following reason:
> > FAIL - Unable to delete [C:\Programme\Apache Software Foundation\Tomcat 7.0
\webapps\mywebapp]. The
> continued presence of this file may cause problems.
> > The exploded WAR file mywebapp is still in the webapp folder. The war file 
gets deleted. Now, we can't even
> redeploy or deploy. We have to manually delete the folder mywebapp.
> > 
> > Any ideas?
> 
> Fix the memory leaks that are causing one or more files to be left open
> in the unpacked web application.
> 
> Mark
> 

Hello,

I am too having this problem because the logfile which is created by log4j 
cannot be deleted since tomcat7 is still accessing it. I don't think this 
would be called a memory leak!? Even when trying to delete it manually in the 
file browser it doesn't work. After tomcat is stopped the logfile can be 
deleted manually.

Is this a bug or can it somehow be fixed?

Regards,

Mike






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


Re: Undeploy fails with Tomcat 7 manager application

Posted by Bjoern Raupach <ra...@me.com>.
Thanks! I will give it a try.

- Björn

On Oct 18, 2011, at 2:29 PM, Mark Thomas wrote:

> On 18/10/2011 13:23, Bjoern Raupach wrote:
>> Could you recommend a tool to show us these files? Its a JSF
>> application, so you are right, there are some properties files
>> needed.
> 
> Any Java profiler should do the job.
> 
> I use YourKit because they give free copies to Apache committers.
> 
> Mark
> 
>> 
>> On Oct 18, 2011, at 2:09 PM, Mark Thomas wrote:
>> 
>>> On 18/10/2011 13:02, Bjoern Raupach wrote:
>>>> Hi group,
>>>> 
>>>> we are using Tomcat 7.0.21 on Windows XP with the manager
>>>> application for remote deployment.  Tomcat is configured to
>>>> unpack wars. Deploying works. However undeploy fails for the
>>>> following reason: FAIL - Unable to delete [C:\Programme\Apache
>>>> Software Foundation\Tomcat 7.0\webapps\mywebapp]. The continued
>>>> presence of this file may cause problems. The exploded WAR file
>>>> mywebapp is still in the webapp folder. The war file gets
>>>> deleted. Now, we can't even redeploy or deploy. We have to
>>>> manually delete the folder mywebapp.
>>>> 
>>>> Any ideas?
>>> 
>>> Fix the memory leaks that are causing one or more files to be left
>>> open in the unpacked web application.
>>> 
>>> Mark
>>> 
>>> ---------------------------------------------------------------------
>>> 
>>> 
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> 
>> 
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Re: Undeploy fails with Tomcat 7 manager application

Posted by Mark Thomas <ma...@apache.org>.
On 18/10/2011 13:23, Bjoern Raupach wrote:
> Could you recommend a tool to show us these files? Its a JSF
> application, so you are right, there are some properties files
> needed.

Any Java profiler should do the job.

I use YourKit because they give free copies to Apache committers.

Mark

> 
> On Oct 18, 2011, at 2:09 PM, Mark Thomas wrote:
> 
>> On 18/10/2011 13:02, Bjoern Raupach wrote:
>>> Hi group,
>>> 
>>> we are using Tomcat 7.0.21 on Windows XP with the manager
>>> application for remote deployment.  Tomcat is configured to
>>> unpack wars. Deploying works. However undeploy fails for the
>>> following reason: FAIL - Unable to delete [C:\Programme\Apache
>>> Software Foundation\Tomcat 7.0\webapps\mywebapp]. The continued
>>> presence of this file may cause problems. The exploded WAR file
>>> mywebapp is still in the webapp folder. The war file gets
>>> deleted. Now, we can't even redeploy or deploy. We have to
>>> manually delete the folder mywebapp.
>>> 
>>> Any ideas?
>> 
>> Fix the memory leaks that are causing one or more files to be left
>> open in the unpacked web application.
>> 
>> Mark
>> 
>> ---------------------------------------------------------------------
>>
>> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Re: Undeploy fails with Tomcat 7 manager application

Posted by Bjoern Raupach <ra...@me.com>.
Could you recommend a tool to show us these files? Its a JSF application, so you are right, there are some properties files needed.

On Oct 18, 2011, at 2:09 PM, Mark Thomas wrote:

> On 18/10/2011 13:02, Bjoern Raupach wrote:
>> Hi group,
>> 
>> we are using Tomcat 7.0.21 on Windows XP with the manager application for remote deployment.  Tomcat is configured to unpack wars. Deploying works. However undeploy fails for the following reason:
>> FAIL - Unable to delete [C:\Programme\Apache Software Foundation\Tomcat 7.0\webapps\mywebapp]. The continued presence of this file may cause problems.
>> The exploded WAR file mywebapp is still in the webapp folder. The war file gets deleted. Now, we can't even redeploy or deploy. We have to manually delete the folder mywebapp.
>> 
>> Any ideas?
> 
> Fix the memory leaks that are causing one or more files to be left open
> in the unpacked web application.
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Re: Undeploy fails with Tomcat 7 manager application

Posted by Mark Thomas <ma...@apache.org>.
On 18/10/2011 13:02, Bjoern Raupach wrote:
> Hi group,
> 
> we are using Tomcat 7.0.21 on Windows XP with the manager application for remote deployment.  Tomcat is configured to unpack wars. Deploying works. However undeploy fails for the following reason:
> FAIL - Unable to delete [C:\Programme\Apache Software Foundation\Tomcat 7.0\webapps\mywebapp]. The continued presence of this file may cause problems.
> The exploded WAR file mywebapp is still in the webapp folder. The war file gets deleted. Now, we can't even redeploy or deploy. We have to manually delete the folder mywebapp.
> 
> Any ideas?

Fix the memory leaks that are causing one or more files to be left open
in the unpacked web application.

Mark

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