Hey Will,

Sorry about using the same Subject line.  Trying to understand possible 
changes.  Maybe you can let me know if you see anything fishy.  I am not using 
the ClasspathResourceloader as far as I know as I didn't need it in 1.4.

I keep the velocity jar under /WEB-INF/lib.
I keep the templates not in jars all under /WEB-INF/templates

In velocity.properties I have:
    file.resource.loader.path = /WEB-INF/templates


This is in web.xml:

  <!-- Define Velocity template compiler -->
  <servlet>
    <servlet-name>velocity</servlet-name>
    
<servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</servlet-class>

    <init-param>
      <param-name>org.apache.velocity.toolbox</param-name>
      <param-value>/WEB-INF/toolbox.xml</param-value>
   </init-param>

    <init-param>
      <param-name>org.apache.velocity.properties</param-name>
      <param-value>/WEB-INF/velocity.properties</param-value>
   </init-param>
   <load-on-startup>10</load-on-startup>
  </servlet>

  <!-- Map *.vm files to Velocity -->
  <servlet-mapping>
    <servlet-name>velocity</servlet-name>
    <url-pattern>*.vm</url-pattern>
  </servlet-mapping>



In toolbox.xml I have:

<toolbox>
  <tool>
      <key>errors</key>
      <scope>request</scope>
      <class>org.apache.velocity.tools.struts.ErrorsTool</class>
  </tool>
  <tool>
     <key>actionmsgs</key>
     <scope>request</scope>
     <class>org.apache.velocity.tools.struts.ActionMessagesTool</class>
  </tool>
  <tool>
     <key>link</key>
     <scope>request</scope>
     <class>org.apache.velocity.tools.struts.SecureLinkTool</class>
  </tool>
  <tool>
     <key>msg</key>
     <scope>request</scope>
     <class>org.apache.velocity.tools.struts.MessageTool</class>
  </tool>
  <tool>
     <key>form</key>
     <scope>request</scope>
     <class>org.apache.velocity.tools.struts.FormTool</class>
  </tool>
  <tool>
     <key>tiles</key>
     <scope>request</scope>
     <class>org.apache.velocity.tools.struts.TilesTool</class>
  </tool>
<!--
  <tool>
      <key>date</key>
      <scope>application</scope>
      <class>org.apache.velocity.tools.generic.DateTool</class>
  </tool>
-->

</toolbox>





----- Original Message -----
From: Will Glass-Husain <[EMAIL PROTECTED]>
Date: Wednesday, April 13, 2005 4:32 pm
Subject: Re: Problem with decimal in most recent snapshot

> What resource loader are you using?
> 
> We changed the way ClasspathResourceloader works in 1.5-dev.
> 
> If you're using ClasspathResourceloader, where is the velocity jar 
> and where 
> are your templates?
> 
> WILL
> 
> ----- Original Message ----- 
> From: <[EMAIL PROTECTED]>
> To: "Velocity Users List" <[email protected]>
> Sent: Wednesday, April 13, 2005 1:19 PM
> Subject: Re: Problem with decimal in most recent snapshot
> 
> 
> > Ok I am back with another problem with trunk version I am 
> currently trying 
> > to diagnose.  When I use Velocity to merge a template on the web 
> site, 
> > Velocity is acting correctly.  When I am merging Velocity 
> internally in a 
> > servlet to send formatted email, I am getting a NPE in velocity. 
>  When I 
> > go back to using 1.4, no NPE and email is sent perfectly.  I 
> need to do 
> > more diagnosis.
> >
> > Template looks like:
> > ....
> > <body>
> > #parse("$!header")
> > #parse("$!body")
> > #parse("$!footer")
> > </body>
> > ....
> >
> >
> > Email code looks like (no variables in context are null as show 
> in error 
> > at bottom):
> >
> >            while (keys.hasNext())
> >            {   // Making attributes available to the template.
> >                key = (String)keys.next();
> >                context.put(key, contextProperties.get(key));
> > System.err.println("VARIABLE PUT INTO CONTEXT: " + key + " = " + 
> > contextProperties.get(key));
> >            }
> >        }
> >
> >        StringWriter resultWriter = new StringWriter();
> >
> >        try
> >        {
> > System.err.println("THE TEMPLATE PATH IS: " + templatePath);
> >            Template template = Velocity.getTemplate(templatePath);
> >            template.merge(context, resultWriter);
> >        }
> >
> >
> >
> >
> >
> >
> >
> > VARIABLE PUT INTO CONTEXT: header = 
> > /WEB-
> INF/templates/pub/common/email/default/defaultEmailMenuHeader.vm> 
> VARIABLE PUT INTO CONTEXT: footer = 
> > /WEB-
> INF/templates/pub/common/email/default/defaultEmailMenuFooter.vm> 
> VARIABLE PUT INTO CONTEXT: requestData = [GuestFName 
> > 
> GuestLName|http://www.jb.com/action/pub/member/receiveemailconfirmation/setup?email=lavalamp%jb.com&mid=10001]>
>  VARIABLE PUT INTO CONTEXT: body = 
> > /WEB-INF/templates/pub/member/registration/emailregconfirm.vm
> > THE TEMPLATE PATH IS: 
> > /WEB-INF/templates/pub/common/email/default/defaultEmailTemplate.vm
> > ERROR [http8080-Processor2] 
> > TemplateToStringManagerBD.getContentAsString() - VelocityEngine 
> failed to 
> > merge the template.
> > java.lang.NullPointerException
> >        at 
> > 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:835)>
>         at 
> > 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:817)>
>         at 
> > 
> org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:285)>
>         at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:469)
> >        at 
> > 
> com.jb.commonmvc.view.template.velocity.TemplateToStringManagerBD.getContentAsString(TemplateToStringManagerBD.java:120)>
>         at 
> > 
> com.jb.commonmvc.transport.email.EmailTemplate.emailTemplate(EmailTemplate.java:37)>
> >
> >
> > -----------------------------------------------------------------
> ----
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: velocity-user-
> [EMAIL PROTECTED]> 
> 
> 
> -------------------------------------------------------------------
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to