velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Mitchell <david.mitch...@factorylogic.com>
Subject velocity is deleting my templates!
Date Thu, 03 Apr 2003 18:12:40 GMT

Im having a very strange problem with velocity. 

Im using the torque generator to create java database access layer classes
for each of the 400-odd tables in our application's schema. The templates to
create these files are replacing old crufty perl code that was previously
being used to generate all these files. The existing architecture for this
layer creates 10 java classes (and hence I have 10 templates) per table. Its
not great, I know, but I have to replicate the existing structure before
reducing it any.

My platform is ant 1.5.1, torque generator 3.1, java 1.4.1, running on win2k
pro. Ive also tried an older version of torque, as well as both velocity-1.3
(which comes with torque generator), and velocity-dev-1.4, built fresh from
the CVS tree.

The torque generator is using a derivative of the Texen ant task to run a
control template on each table in an xml schema description.

My problem is that after generating exactly 2018 files, velocity quits out,
complaining that it can't find my template, and furthermore, the template it
was looking for gets DELETED! I even tried write-protecting the file, which
keeps it from getting deleted, but velocity still dies after generating the
2018th file.

I didnt find anything in the mailing list archives about this kind of issue,
and I also tried looking at the velocity source code, but I doubt I will be
able to localize the problem in any reasonable amount of time.

I was able to easily replicate the problem by creating the following two
test templates:

(control.vm)

#foreach ($i in [1..5000])
	$generator.parse("npl/test.vm","$velocityCount","table","")
#end

(test.vm)

testing testing

I run the templates as follows:

>ant -f build-torque.xml -debug npl-model

(after a whole ream of output comes out, it dies with the following
traceback, after which, indeed, the template "test.vm" has been deleted from
the disk!)

org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource 'npl/test.vm'
        at
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(Resour
ceManagerImpl.java:499)
        at
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(Resourc
eManagerImpl.java:382)
        at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java
:882)
        at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java
:864)
        at
org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:512)
        at
org.apache.velocity.texen.Generator.getTemplate(Generator.java:334) at
org.apache.velocity.texen.Generator.parse(Generator.java:403)
        at org.apache.velocity.texen.Generator.parse(Generator.java:374) 
	at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source) 
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(Ub
erspectImpl.java:305)
        at
org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:242
)
        at
org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.ja
va:218)
        at
org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.jav
a:263)
        at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94)
        at
org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:216)
        at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirect

.... and so on....

 In the output folder, I have 2018 files, named 1 through 2018.

 Anyone out there have any idea what I can do?

 yours,
 David Mitchell


+---------------------------------------------------------+ 
This message may contain confidential and/or privileged information.  If you
are not the addressee or authorized to receive this for the addressee, you
must not use, copy, disclose or take any action based on this message or any
information herein.  If you have received this message in error, please
advise the sender immediately by reply e-mail and delete this message.
Thank you for your cooperation.
+---------------------------------------------------------+

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


Mime
View raw message