Hello, this is my first post on the list... 
 
I have a problem using Cactus test suites with my servlet (which is 
inherited from VelocityViewServlet) and I wonder if it could be due to the 
way I'm using Velocity API.
I've summarized some informations below.
 
1) Servlet get a reference to a context object from handleRequest 
method.
2) Servlet instanciate a "module" class, call my init(Context ctx) 
method which hold a reference of that Context : this.innerContext = 
(VelocityContext)ctx;
3) Context is used as usual (put() calls)
4) When work is done, the produce() method is called with writer = 
response.getWriter():
public void produce(java.io.Writer writer)
{
  Velocity.mergeTemplate(templateDir + 
this.innerTemplateFileName,"Cp1252",this.innerContext,writer);
}
 
5) Return to servlet code, which return NULL to the caller 
 
Problem is : when running under Cactus (as a Cactus test) the 
Velocity.mergeTemplate call throws a NullPointerException.
I step debugged, everything is ok (I've checked : writer object, 
innerContext object,filenames) 
 
Stepping into Velocity API I can go as far as this method 
(RuntimeInstance.java)
public Template getTemplate(String name, String  encoding) throws 
ResourceNotFoundException, ParseErrorException, Exception
{
    return (Template) resourceManager.getResource(name, 
ResourceManager.RESOURCE_TEMPLATE, encoding);
}
 
Stepping into getResource method is not possible...
 
So I have no idea of what is going wrong...
 
Any help appreciated, thank you


Note : I'm having problem to enable logging from velocity.properties (opposed 
to loadConfiguration) so I can't provide a log trace.

 

                
---------------------------------
 Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail

Reply via email to