You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Saad Zia <sa...@globalnorthstar.com> on 2004/11/04 13:57:51 UTC

too many files open error

Hi.

i am experiencing a problem when generating a velocity template. suppose i
am printing it multiple times, over and over. what happens is that after a
very large number, something like after printing the same template over and
over 18,000 plus times, the error thrown on Tomcat is that :

 java.io.IOException: Too many open files
 java.io.IOException: Too many open files
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at
org.apache.commons.collections.ExtendedProperties.<init>(ExtendedPro
erties.java:470)
        at
org.apache.commons.collections.ExtendedProperties.<init>(ExtendedPro
erties.java:452)
        at
org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.jav
:473)
        at
org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:93)


could it be that velocity is not releasing the handle of the template passed
to it ? any suggestions or resolutions ?

thx.


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: too many files open error

Posted by Simon Christian <si...@stoutstick.com>.
Hi Saad,

 From your error log it would appear that you're initialising a new 
VelocityEngine each time you're rendering out a template. This is 
probably not a great idea in itself as it's much more efficient to 
re-use a single instance wherever possible (cached templates & macros, 
no need to  re-examine configuration files).

Of course that may not be the direct cause of the problem, and if it is 
the indirect cause it suggests that either (a) you're not dereferencing 
instances correctly or (b) there's a bug in Velocity. Difficult to say 
which one from here!

- simon


Saad Zia wrote:
> Hi.
> 
> i am experiencing a problem when generating a velocity template. suppose i
> am printing it multiple times, over and over. what happens is that after a
> very large number, something like after printing the same template over and
> over 18,000 plus times, the error thrown on Tomcat is that :
> 
>  java.io.IOException: Too many open files
>  java.io.IOException: Too many open files
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at java.io.FileInputStream.<init>(FileInputStream.java:66)
>         at
> org.apache.commons.collections.ExtendedProperties.<init>(ExtendedPro
> erties.java:470)
>         at
> org.apache.commons.collections.ExtendedProperties.<init>(ExtendedPro
> erties.java:452)
>         at
> org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.jav
> :473)
>         at
> org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:93)
> 
> 
> could it be that velocity is not releasing the handle of the template passed
> to it ? any suggestions or resolutions ?
> 
> thx.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org