You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Amit Jagtap <am...@gmail.com> on 2008/06/28 12:13:26 UTC

Error in intializing Velocity for StringResourceLoader

I am trying to invoke Velocity using following code-

VelocityEngine ve = new VelocityEngine();

Properties p = new Properties();
p.setProperty( "resource.loader", "String" );
p.setProperty( "class.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.StringResourceLoader" );        

ve.init(p);

VelocityContext context = new VelocityContext();


I am trying to do the above after reading javadoc for
ClasspathResourceLoader. the javadoc says-
resource.loader = class class.resource.loader.class =
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader 
should be used. I tried these properties and my templates are loaded from
classpath.

But now I need to create my templates dynamically. For this I am using
StringResourceLoader. But after the above mentioned initialization of
Velocity, I get following error-
WARNING: ResourceManager : No configuration information for resource loader
named 'String'. Skipping.

Please help me in this issue. How do I initialise VelocityEngine to load
velocity templates using StringResourceLoader

Thanks and Regards,
Amit
-- 
View this message in context: http://www.nabble.com/Error-in-intializing-Velocity-for-StringResourceLoader-tp18169294p18169294.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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


Re: Error in intializing Velocity for StringResourceLoader

Posted by Will Glass-Husain <wg...@gmail.com>.
Thanks for letting us know!

On Sat, Jun 28, 2008 at 7:16 AM, Amit Jagtap <am...@gmail.com> wrote:

>
> Hi,
>
> the mentioned issue got resolved..
> had to add the following-
>             VelocityEngine ve = new VelocityEngine();
>            Properties p = new Properties();
>             p.setProperty( "resource.loader", "string" );
>            p.setProperty( "string.resource.loader.description", "Velocity
> StringResource loader" );
>            p.setProperty( "string.resource.loader.class",
> "org.apache.velocity.runtime.resource.loader.StringResourceLoader" );
>            ve.init(p);
>
>
> it was given in the javadoc :P
> the age old unix adage is true till date - "RTFM" :)
>
> Thanks,
> Amit
>
>
>
> Amit Jagtap wrote:
> >
> > I am trying to invoke Velocity using following code-
> >
> > VelocityEngine ve = new VelocityEngine();
> >
> > Properties p = new Properties();
> > p.setProperty( "resource.loader", "String" );
> > p.setProperty( "class.resource.loader.class",
> > "org.apache.velocity.runtime.resource.loader.StringResourceLoader" );
> >
> > ve.init(p);
> >
> > VelocityContext context = new VelocityContext();
> >
> >
> > I am trying to do the above after reading javadoc for
> > ClasspathResourceLoader. the javadoc says-
> > resource.loader = class class.resource.loader.class =
> > org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
> > should be used. I tried these properties and my templates are loaded from
> > classpath.
> >
> > But now I need to create my templates dynamically. For this I am using
> > StringResourceLoader. But after the above mentioned initialization of
> > Velocity, I get following error-
> > WARNING: ResourceManager : No configuration information for resource
> > loader named 'String'. Skipping.
> >
> > Please help me in this issue. How do I initialise VelocityEngine to load
> > velocity templates using StringResourceLoader
> >
> > Thanks and Regards,
> > Amit
> >
>
> --
> View this message in context:
> http://www.nabble.com/Error-in-intializing-Velocity-for-StringResourceLoader-tp18169294p18171137.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

Re: Error in intializing Velocity for StringResourceLoader

Posted by Amit Jagtap <am...@gmail.com>.
Hi,

the mentioned issue got resolved..
had to add the following-
            VelocityEngine ve = new VelocityEngine();
            Properties p = new Properties();
            p.setProperty( "resource.loader", "string" );
            p.setProperty( "string.resource.loader.description", "Velocity
StringResource loader" );
            p.setProperty( "string.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.StringResourceLoader" );
            ve.init(p);


it was given in the javadoc :P
the age old unix adage is true till date - "RTFM" :)

Thanks,
Amit



Amit Jagtap wrote:
> 
> I am trying to invoke Velocity using following code-
> 
> VelocityEngine ve = new VelocityEngine();
> 
> Properties p = new Properties();
> p.setProperty( "resource.loader", "String" );
> p.setProperty( "class.resource.loader.class",
> "org.apache.velocity.runtime.resource.loader.StringResourceLoader" );        
> 
> ve.init(p);
> 
> VelocityContext context = new VelocityContext();
> 
> 
> I am trying to do the above after reading javadoc for
> ClasspathResourceLoader. the javadoc says-
> resource.loader = class class.resource.loader.class =
> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader 
> should be used. I tried these properties and my templates are loaded from
> classpath.
> 
> But now I need to create my templates dynamically. For this I am using
> StringResourceLoader. But after the above mentioned initialization of
> Velocity, I get following error-
> WARNING: ResourceManager : No configuration information for resource
> loader named 'String'. Skipping.
> 
> Please help me in this issue. How do I initialise VelocityEngine to load
> velocity templates using StringResourceLoader
> 
> Thanks and Regards,
> Amit
> 

-- 
View this message in context: http://www.nabble.com/Error-in-intializing-Velocity-for-StringResourceLoader-tp18169294p18171137.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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