Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

generate static page using freemarker error, is data value too large?  RSS feed

 
Han Jie
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone

I make a demo to generate static page(html) here using freemarker and use NewsDB to simulate database.

The question is below

In this line : private final static int total = 100000; the value 1,000 is ok, the value 10,000 is ok too. But if the 100,000, the pages after 22,178(22178.html) is not gererated here. I try many times and it also appears when 22,178(the index of the page)page will generate.

And the exception here is below:

java.io.FileNotFoundException: D:\Tomcat6026\webapps\freemarkerdemo\news\news_22178.html (无法创建目录或文件。) it means that failed to create directory or file
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at com.nana.util.FTL2HTMLUtil.createHTML(FTL2HTMLUtil.java:31)
at com.nana.util.MyTask.run(MyTask.java:36)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
D:\Tomcat6026\webapps\freemarkerdemo\news\news_22179.html
java.io.FileNotFoundException: D:\Tomcat6026\webapps\freemarkerdemo\news\news_22179.html (无法创建目录或文件。)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at com.nana.util.FTL2HTMLUtil.createHTML(FTL2HTMLUtil.java:31)
at com.nana.util.MyTask.run(MyTask.java:36)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)

The question make me in trouble for one day.
And the most important is that now I have no idea to sovle it. Why the pageindex(from 1 to 22,177) is ok here, but after 22,177 the problem happens?

The directory (news) is generated here indeed, because I found it in WebRoot in my app demo here.

If there are problems in my codes, the value 1,000 or 10,000(in this line : private final static int total = 100000;) have no problems. Why?

Can anyone give my some advices?

Thanks in advances!

HanJie

The codes are below:






 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What file system are you using? However, it seems to me that FAT32's limit 65K and NTFS is essentially unlimited. I assume you're not simply running out of disk space?

If it's really that consistent, I'd experiment by deleting the first 1000 or so files before trying to create that 22,178th one. Also try a run where you output the files to 10 different directories. (Using a modulo on the number would be a quick way to do that.) Those results should give us more information to work with.
 
Han Jie
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Greg

Thank you so much for your suggesstions which I have followed.

The file system on my desktop pc on which my application demo was is FAT32 indeed as you said. And I have moved the application demo to my portable computer on which windows XP is, and the file system is NTFS as you said above.I test it again,it works and no above problems in my post here.100,000 records are all ok.They all generate to their proper html pages.

The capacity size of the 100,000 generated html pages now is 400M totally, but the capacity size is 3G almost before. I don't know whether it is related to the file system type? I don't know why, but the result is what I want really.The other suggessions are useful for me too.

Thank you for your help again finally.

Regards

HanJie
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!