so, you are using a subclass of VelocityViewServlet, right?  what
version of VelocityTools are you using?  are you getting any relevant
error messages in your logs?

i'm not sure i understand what you mean when you say the tools are
available on start-up, but not later.  what do your logs say at
startup?  what do they say later?

overriding initVelocity() should not affect the context that is
created.  what are you doing with the velocityContext object you are
creating and why are you creating it when you initialize your velocity
engine?  that doesn't seem appropriate to me.  if you must mess with
the context, it is best to do so when overriding the createContext()
method.  are you overriding createContext()?

On 1/3/06, M. Hossein Amerkashi <[EMAIL PROTECTED]> wrote:
> Thx for replies.
> Class / method are public. Using velocity with struts.
>
>
> My app is a code generator. On start-up, tools are
> available, but later are not. Reason is that I do
> initVelocity (see below) which resets the Context.
> What needs to be done? Do I need to do context
> chaining?
>
> Thanks
>
> private static void initVelocity() throws Exception {
>         if (velocityEngine == null) {
>             velocityContext = new VelocityContext();
>             Properties velocityProps = new
> Properties();
>
>             velocityEngine = new VelocityEngine();
>
>             InputStream inputStream =
> Engine.class.getResourceAsStream(Constants.VELOCITY_PEROPERTIES_FILE);
>             velocityProps.load(inputStream);
>             velocityEngine.init(velocityProps);
>         }
>     }
>
>
> --- Nathan Bubna <[EMAIL PROTECTED]> wrote:
>
> > as Stas said, make sure that both your tool class
> > and the methods you
> > wish to call from the template are declared public.
> >
> > and yeah, more info would be nice.  are you using
> > the
> > VelocityViewServlet?  are you sure your toolbox.xml
> > is being read?
> >
> > On 1/3/06, M. Hossein Amerkashi <[EMAIL PROTECTED]>
> > wrote:
> > > Hi,
> > >
> > > I am having difficulty loading custom tools using
> > > toolbox. Basically I have a simple java class that
> > > performs some action and am attempting to load it
> > on
> > > start-up. The reference is not getting processed.
> > All
> > > help is appreciated.
> > >
> > > <?xml version="1.0"?>
> > > <toolbox>
> > > <!-- other tools
> > >   ...
> > >   ...
> > > -->
> > >     <tool>
> > >         <key>airportTools</key>
> > >         <scope>application</scope>
> > >         <class>package.AirportTools</class>
> > >     </tool>
> > > </toolbox>
> > >
> > > template:
> > > $airportTools.getHciForArtcc($ARTCC_ID)
> > >
> > >
> > >
> > >
> > > __________________________________
> > > Yahoo! for Good - Make a difference this year.
> > > http://brand.yahoo.com/cybergivingweek2005/
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > 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]
> >
> >
>
>
>
>
>
> __________________________________
> Yahoo! for Good - Make a difference this year.
> http://brand.yahoo.com/cybergivingweek2005/
>
> ---------------------------------------------------------------------
> 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