You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Federico Fissore <fi...@celi.it> on 2010/07/02 14:36:22 UTC

embedded tomcat, "work" folder wipe out issue

hello all

first mail to the list: please forward me to any RTFM you may think useful

I've embedded tomcat so to have multiple webapps running with separate 
java processes (each embedded tomcat runs its own webapp, listening to a 
different tcp port), because of some memory issues we have.

having some issues with jsps not being recompiled after an upgrade of a 
webapp (that takes a restart of its tomcat), we scripted the wipe out of 
that context "work" folder

say the folder is 
/opt/tomcats/work/StandardHost[localhost].StandardContext[/myWebApp]Engine/... 
after tomcat has stopped, we delete the "myWebApp]Engine" folder so to 
oblige the starting tomcat to recompile every jsp

that USUALLY works fine BUT some times I got a "JasperException: Unable 
to load class for JSP", with the root cause being 
"ClassNotFoundException: org.apache.jsp.WEB_002dINF.jsp.systemCheck_jsp"

I checked for that file in the work folder and it's there! both the 
.java and .class files

Restarting tomcat, until now, solved the issue

what do you think is going on?

thank you in advance

federico

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


Re: embedded tomcat, "work" folder wipe out issue

Posted by Mark Thomas <ma...@apache.org>.
On 03/07/2010 10:13, 赵顺 wrote:
> It seems like the bug
> https://issues.apache.org/bugzilla/show_bug.cgi?id=49539
> the tomcat delete workdir while startup with errors

The configuration in that bug report is completely invalid. If you use 
an invalid configuration, then there is always the chance it will have 
side-effects you don't want.

Mark

>
> On Sat, Jul 3, 2010 at 4:03 PM, Federico Fissore<fi...@celi.it>  wrote:
>
>> Christopher Schultz, il 02/07/2010 23:00, ha scritto:
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Federico,
>>>
>>> On 7/2/2010 8:36 AM, Federico Fissore wrote:
>>>
>>>> I've embedded tomcat so to have multiple webapps running with separate
>>>> java processes (each embedded tomcat runs its own webapp, listening to a
>>>> different tcp port), because of some memory issues we have.
>>>>
>>>
>>> Have you considered simply using CATALINA_BASE to run separate Tomcats?
>>> That would likely be easier than writing an embedded Tomcat wrapper, etc.
>>>
>>>
>> yes, but embedding tomcat is part of a wider plan of building an internal
>> management system
>>
>>
>>> Are you sure Tomcat is completely shut down when you perform the delete?
>>> If not, Tomcat might have some in-memory notion of what's on the disk,
>>> and get confused when the files suddenly disappear.
>>>
>>
>> yes, i'm sure. work wipe out occurs in the shutdown hook of the embedded
>> tomcat and when it terminates the related java process no
>> longer exists (just like when you kill a process on linux)
>>
>>
>>
>>> Have you tried undeploying the webapp and re-deploying? That should
>>> cause Tomcat to clear it's own work directory for that webapp.
>>>
>>>
>> as said, when we wipe out, tomcat is running no more, so it couldn't clear
>> the folder on its own
>>
>> thanks for the reply
>>
>> federico
>>
>> ---------------------------------------------------------------------
>> 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: embedded tomcat, "work" folder wipe out issue

Posted by Federico Fissore <fi...@celi.it>.
Pid, il 03/07/2010 16:08, ha scritto:
> Is that really the path in use?
>
> /opt
>   /tomcats
>    /work
>     /StandardHost[localhost].StandardContext[
>      /myWebApp]Engine
>       /localhost
>        /myWebApp
>
> Looks a little weird to me, the square brackets are split across
> directories and there's a reference to myWebApp and localhost in two places.
>

you are right. the path is weird. wasn't intentional but generated. btw 
I've changed it to
/opt/tomcats/work/myWebApp/localhost/myWebApp (the last two folders are 
generated by tomcat)

thanks for pointing that out

federico

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


Re: embedded tomcat, "work" folder wipe out issue

Posted by Pid <pi...@pidster.com>.
On 03/07/2010 12:11, Federico Fissore wrote:
> 赵顺, il 03/07/2010 10:13, ha scritto:
>> It seems like the bug
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=49539
>> the tomcat delete workdir while startup with errors
>>
> 
> uhm no, in this case it's me that it's clearing the work folder and btw
> I have some fifty webapps that runs smootly, restarting and continuously
> redeploying every day. just sometimes one or two (at random manifest the
> problem)
> 
> Really looks like a concurrency problem to me: too random but hard to
> spot (I have 12 server with 4 to 10 tomcats running and it's not always
> the same server suffering the problem)
> 
> in the meanwhile, digging into log files, I've found a
> Jul 3, 2010 6:36:09 AM org.apache.jasper.EmbeddedServletOptions <init>
> SEVERE: The scratchDir you specified:

> /opt/tomcats/work/StandardHost[localhost].StandardContext[/myWebApp]Engine/localhost/myWebApp

Is that really the path in use?

/opt
 /tomcats
  /work
   /StandardHost[localhost].StandardContext[
    /myWebApp]Engine
     /localhost
      /myWebApp

Looks a little weird to me, the square brackets are split across
directories and there's a reference to myWebApp and localhost in two places.


p

> is unusable.
> Jul 3, 2010 6:36:09 AM org.apache.coyote.http11.Http11Protocol init
> 
> I've checked the permissions and they are all ok (every tomcat runs with
> same user privileges and they own the whole folder structure)
> 
> federico
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



Re: embedded tomcat, "work" folder wipe out issue

Posted by Federico Fissore <fi...@celi.it>.
赵顺, il 03/07/2010 10:13, ha scritto:
> It seems like the bug
> https://issues.apache.org/bugzilla/show_bug.cgi?id=49539
> the tomcat delete workdir while startup with errors
>

uhm no, in this case it's me that it's clearing the work folder and btw 
I have some fifty webapps that runs smootly, restarting and continuously 
redeploying every day. just sometimes one or two (at random manifest the 
problem)

Really looks like a concurrency problem to me: too random but hard to 
spot (I have 12 server with 4 to 10 tomcats running and it's not always 
the same server suffering the problem)

in the meanwhile, digging into log files, I've found a
Jul 3, 2010 6:36:09 AM org.apache.jasper.EmbeddedServletOptions <init>
SEVERE: The scratchDir you specified: 
/opt/tomcats/work/StandardHost[localhost].StandardContext[/myWebApp]Engine/localhost/myWebApp 
is unusable.
Jul 3, 2010 6:36:09 AM org.apache.coyote.http11.Http11Protocol init

I've checked the permissions and they are all ok (every tomcat runs with 
same user privileges and they own the whole folder structure)

federico

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


Re: embedded tomcat, "work" folder wipe out issue

Posted by 赵顺 <cn...@gmail.com>.
It seems like the bug
https://issues.apache.org/bugzilla/show_bug.cgi?id=49539
the tomcat delete workdir while startup with errors

On Sat, Jul 3, 2010 at 4:03 PM, Federico Fissore <fi...@celi.it> wrote:

> Christopher Schultz, il 02/07/2010 23:00, ha scritto:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Federico,
>>
>> On 7/2/2010 8:36 AM, Federico Fissore wrote:
>>
>>> I've embedded tomcat so to have multiple webapps running with separate
>>> java processes (each embedded tomcat runs its own webapp, listening to a
>>> different tcp port), because of some memory issues we have.
>>>
>>
>> Have you considered simply using CATALINA_BASE to run separate Tomcats?
>> That would likely be easier than writing an embedded Tomcat wrapper, etc.
>>
>>
> yes, but embedding tomcat is part of a wider plan of building an internal
> management system
>
>
>> Are you sure Tomcat is completely shut down when you perform the delete?
>> If not, Tomcat might have some in-memory notion of what's on the disk,
>> and get confused when the files suddenly disappear.
>>
>
> yes, i'm sure. work wipe out occurs in the shutdown hook of the embedded
> tomcat and when it terminates the related java process no
> longer exists (just like when you kill a process on linux)
>
>
>
>> Have you tried undeploying the webapp and re-deploying? That should
>> cause Tomcat to clear it's own work directory for that webapp.
>>
>>
> as said, when we wipe out, tomcat is running no more, so it couldn't clear
> the folder on its own
>
> thanks for the reply
>
> federico
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
                   致
       礼!


              赵顺cnjoyfun@gmail.com

Re: embedded tomcat, "work" folder wipe out issue

Posted by Federico Fissore <fi...@celi.it>.
Christopher Schultz, il 02/07/2010 23:00, ha scritto:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Federico,
>
> On 7/2/2010 8:36 AM, Federico Fissore wrote:
>> I've embedded tomcat so to have multiple webapps running with separate
>> java processes (each embedded tomcat runs its own webapp, listening to a
>> different tcp port), because of some memory issues we have.
>
> Have you considered simply using CATALINA_BASE to run separate Tomcats?
> That would likely be easier than writing an embedded Tomcat wrapper, etc.
>

yes, but embedding tomcat is part of a wider plan of building an 
internal management system

>
> Are you sure Tomcat is completely shut down when you perform the delete?
> If not, Tomcat might have some in-memory notion of what's on the disk,
> and get confused when the files suddenly disappear.

yes, i'm sure. work wipe out occurs in the shutdown hook of the embedded 
tomcat and when it terminates the related java process no
longer exists (just like when you kill a process on linux)


>
> Have you tried undeploying the webapp and re-deploying? That should
> cause Tomcat to clear it's own work directory for that webapp.
>

as said, when we wipe out, tomcat is running no more, so it couldn't 
clear the folder on its own

thanks for the reply

federico

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


Re: embedded tomcat, "work" folder wipe out issue

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

Federico,

On 7/2/2010 8:36 AM, Federico Fissore wrote:
> I've embedded tomcat so to have multiple webapps running with separate
> java processes (each embedded tomcat runs its own webapp, listening to a
> different tcp port), because of some memory issues we have.

Have you considered simply using CATALINA_BASE to run separate Tomcats?
That would likely be easier than writing an embedded Tomcat wrapper, etc.

> having some issues with jsps not being recompiled after an upgrade of a
> webapp (that takes a restart of its tomcat), we scripted the wipe out of
> that context "work" folder
> 
> say the folder is
> /opt/tomcats/work/StandardHost[localhost].StandardContext[/myWebApp]Engine/...
> after tomcat has stopped, we delete the "myWebApp]Engine" folder so to
> oblige the starting tomcat to recompile every jsp

Are you sure Tomcat is completely shut down when you perform the delete?
If not, Tomcat might have some in-memory notion of what's on the disk,
and get confused when the files suddenly disappear.

Have you tried undeploying the webapp and re-deploying? That should
cause Tomcat to clear it's own work directory for that webapp.

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

iEYEARECAAYFAkwuU1cACgkQ9CaO5/Lv0PCiewCeKJln6FZmFtAv9fv6wCEPDu7b
rAEAoKNXlXtWZF+IMgym5e8dLBwI4W/Y
=5fG3
-----END PGP SIGNATURE-----

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


Re: embedded tomcat, "work" folder wipe out issue

Posted by Federico Fissore <fi...@celi.it>.
Konstantin Kolinko, il 05/07/2010 16:59, ha scritto:
> 2010/7/2 Federico Fissore<fi...@celi.it>:
>> hello all
>>
>> first mail to the list: please forward me to any RTFM you may think useful
>>
>
>>
>> BUT some times I got a "JasperException: Unable to
>> load class for JSP", with the root cause being "ClassNotFoundException:
>> org.apache.jsp.WEB_002dINF.jsp.systemCheck_jsp"
>>
>
> What exact Tomcat version (x.y.z) are you using?


6.0.26


>
> Are you sure that you have stopped the old Tomcat instance, and that
> you are not running several instances in parallel?

Yes I'm sure: before I start the new one, I check for the PID of the 
process to disappear.

I am running several instances in parallel, each with a separate java 
process, each listening on a different tcp port. That's my aim


>
>> I checked for that file in the work folder and it's there! both the .java
>> and .class files
>
> What are timestamps of those files? Are they recently generated and
> compiled, as you would expect?


Yes, they are regenerated and recompiled. The funny thing is that you 
can see the error page (ClassNotFound...), delete those files, refresh 
the page and seeing the files being re-generated and re-compiled BUT 
still getting a ClassNotFound...

best regards

federico

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


Re: embedded tomcat, "work" folder wipe out issue

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/7/2 Federico Fissore <fi...@celi.it>:
> hello all
>
> first mail to the list: please forward me to any RTFM you may think useful
>

>
> BUT some times I got a "JasperException: Unable to
> load class for JSP", with the root cause being "ClassNotFoundException:
> org.apache.jsp.WEB_002dINF.jsp.systemCheck_jsp"
>

What exact Tomcat version (x.y.z) are you using?

Are you sure that you have stopped the old Tomcat instance, and that
you are not running several instances in parallel?

> I checked for that file in the work folder and it's there! both the .java
> and .class files

What are timestamps of those files? Are they recently generated and
compiled, as you would expect?

Best regards,
Konstantin Kolinko

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


Re: embedded tomcat, "work" folder wipe out issue

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

Federico,

On 7/12/2010 3:26 AM, Federico Fissore wrote:
> I still think that working with embedded tomcats sharing a common base
> work folder has some issues: one could be that in several places in the
> code I've found statements like
> 
> if (!new File("something").exists()) {
>     new File("something").mkdirs();
> }
> 
> with the mkdirs not being checked for success.
> Maybe we could switch to individual .mkdir() to create the individual
> folders, checking if they have been successfully created?

Patches are always welcome. Go ahead and submit a bug report in bugzilla
and, if you'd like, submit a patch. Bug reports with patches are much
more likely to be fixed than those without.

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

iEYEARECAAYFAkw/HwkACgkQ9CaO5/Lv0PBREQCbBJsCda+zDQWEo+yYFJ0SYB2t
OjkAoLJxfLZbRqAybToEHcdmLmNfjIUU
=I4C6
-----END PGP SIGNATURE-----

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


Re: embedded tomcat, "work" folder wipe out issue

Posted by Federico Fissore <fi...@celi.it>.
hello all

after a week of testing, I've changed the wipe out proc from wiping out 
both files and folders to just files, and since then it's worked (hope 
Murphy is not subscribed to this mailing list)

My opinion (if anyone could be interested) follows:
I still think that working with embedded tomcats sharing a common base 
work folder has some issues: one could be that in several places in the 
code I've found statements like

if (!new File("something").exists()) {
	new File("something").mkdirs();
}

with the mkdirs not being checked for success.
Maybe we could switch to individual .mkdir() to create the individual 
folders, checking if they have been successfully created?

My two eurocent

Thanks everybody for your help!

Federico Fissore

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