Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

java.io.FileNotFoundException: velocity.log (Too many open files)  when i use velocity to send emails

Thread view: 
bond - 27 Jun 2007 23:57 GMT
Hi,
I am using velocity templates to generate emails in a stand alone
application.
During the life cycle of the application, i generate 5 emails. But i
am facing a problem now:

If i run this stand alone application say more than 3 times
continuosly, i get the below error and mails are not being sent after
that.If i restart the server, start the application, then the mails
will be sent without any problems for next 3 runs. Is it a bug with
Velocity itself or bug in the way i implemented it?

I googled it and found many people face same problem. But couldn't get
any solution for it. So thought this is the right place to post it.

PANIC : error configuring SimpleLog4JLogSystem :
java.io.FileNotFoundException: velocity.log (Too many open files)

log4j:WARN No appenders could be found for logger
(org.apache.velocity.runtime.log.SimpleLog4JLogSys tem).

log4j:WARN Please initialize the log4j system properly.

Can any one please help me to overcome this problem?

I am using the log4J for logging instead of AvalonLogSystem.

Here is the steps what i do for sending emails:
1. Initialize the velocity --- > Velocity.init(p); where 'p' is the
properties file.
this is done once per life cycle of the application.

2.Create the new instance of velocitycontext for each mail --->

VelocityContext context = new VelocityContext();

put the data to context.

So in my case i have 3 different mails whcih need to be sent. So i
have created 3 instances of VelocityContext. Is it creating the
problem?

Please note that, if i run my application once in a day, it works
fine.
I feel it is some thing to do with the way Velocity does the file
handling....

Please help me to overcome this problem.

Thanks in advance,
Mark Jeffcoat - 28 Jun 2007 05:00 GMT
> If i run this stand alone application say more than 3 times
> continuosly, i get the below error and mails are not being sent after
> that.If i restart the server, start the application, then the mails
> will be sent without any problems for next 3 runs. Is it a bug with
> Velocity itself or bug in the way i implemented it?

I use Velocity in a production setting, constructing a few
hundred messages per day. I know which way I'm betting.

> I googled it and found many people face same problem. But couldn't get
> any solution for it. So thought this is the right place to post it.
[quoted text clipped - 6 lines]
>
> log4j:WARN Please initialize the log4j system properly.

Well, you can solve your log4j problem by putting a good
log4j.properties in your classpath. I suspect that Velocity
is trying to tell you more about what's going wrong, and you
might get more information that way. But that's not what's
causing you to run out of file handles.

> Can any one please help me to overcome this problem?
>
[quoted text clipped - 10 lines]
>
> put the data to context.

That should be fine. Something's missing: what do you
merge the context with? Most people load their template
from files; I'm guessing something's going wrong there.

If you can, by chopping out everything extraneous, get
this failure to appear in less than 100 lines of code or
so, just post the whole thing, and I'll be happy to take
a look.

Signature

Mark Jeffcoat
Austin, TX



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.