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: