You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Will Glass-Husain <wg...@gmail.com> on 2007/04/26 02:56:11 UTC

Re: Velocity, StringResourceLoader and Tomcat

Nice fix.  Good to see users interested in this new feature.

WILL

On 4/25/07, Nathan Bubna <nb...@gmail.com> wrote:
>
> It's all checked in.  Tino, if you want to use the new version, you
> can find it at:
>
>
> http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java?revision=532549&view=markup
>
> And of course, this will be in the 1.6 release (no timetable on that
> though).
>
> On 4/25/07, Nathan Bubna <nb...@gmail.com> wrote:
> > Ok, i created an issue myself and took some time today to fix
> > StringResourceLoader to use repository(s) sanely.   I'm still writing
> > some new tests for it but will check it in soon.
> >
> > http://issues.apache.org/jira/browse/VELOCITY-541
> >
> > On 4/24/07, Nathan Bubna <nb...@gmail.com> wrote:
> > > Would you be willing to open a JIRA issue and attach a patch with your
> > > changes to StringResourceLoader?  It would speed up the process of
> > > fixing it. ;)
> > >
> > > http://issues.apache.org/jira/browse/VELOCITY
> > >
> > > On 4/23/07, Tino Schöllhorn <t....@plattform-gmbh.de> wrote:
> > > > Hi,
> > > >
> > > > I looked in the code and your description is exactly the problem.
> Now I
> > > > wrote an StringResourceLoader on my own which works fine.
> > > >
> > > > But the StringResourceLoader would be great if it worked correctly.
> ;-)
> > > >
> > > > With regards
> > > > Tino
> > > >
> > > > Nathan Bubna wrote:
> > > > > It appears to mean that multiple StringResourceLoaders are being
> > > > > initialized and the later ones are blowing up.
> StringResourceLoader
> > > > > uses a static RepositoryFactory.  Unfortunately i think this means
> > > > > that you can really only have one StringResourceLoader per
> > > > > classloader.  Sorry about this, it's a new feature and apparently
> > > > > hasn't had all its usecases tested.
> > > > >
> > > > > i'll ping the dev list about this and/or try and look into it more
> > > > > myself.  there should be a way to use multiple
> > > > > StringResourceLoaders...
> > > > >
> > > > > in the meantime, you may want to make sure your app only
> instantiates
> > > > > one VelocityEngine that uses a StringResourceLoader.
> > > > >
> > > > > On 4/23/07, Tino Schöllhorn <t....@plattform-gmbh.de>
> wrote:
> > > > >> Hi,
> > > > >>
> > > > >> we are using Tomcat, Spring and Velocity 1.5. A first application
> > > > >> (without Tomcat) is running fine - it just uses Velocity to parse
> an
> > > > >> simple "Hello World" template which we provide in the
> > > > >> StringResourceRepository.
> > > > >>
> > > > >> But as soon as we want to integrate this in our web-application
> we
> > > > >> encounter the following error:
> > > > >>
> > > > >> Error creating bean with name 'velocityEngine' defined in class
> path
> > > > >> resource [appCxt-kernelBase.xml]: Invocation of init method
> failed;
> > > > >> nested exception is java.lang.IllegalStateException: The
> > > > >> RepositoryFactory has already been initialized!
> > > > >>         at
> > > > >>
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean
> (AbstractAutowireCapableBeanFactory.java:1148)
> > > > >>
> > > > >>         ....
> > > > >>
> > > > >>
> > > > >> Does anyone know what the problem might be?
> > > > >>
> > > > >> With regards
> > > > >> Tino
> > > > >>
> > > > >> ps:
> > > > >>
> > > > >> We are using the follwowing spring-bean configuration:
> > > > >>
> > > > >> <bean id="velocityEngine"
> > > > >>
> > > > >> class="org.springframework.ui.velocity.VelocityEngineFactoryBean
> ">
> > > > >>
> > > > >>     <property name="velocityProperties">
> > > > >>         <props>
> > > > >>         <prop key="resource.loader">string</prop>
> > > > >>          <prop key="string.resource.loader.class">
> > > > >> org.apache.velocity.runtime.resource.loader.StringResourceLoader
> > > > >>            </prop>
> > > > >>          </props>
> > > > >>     </property>
> > > > >> </bean>
> > > > >>
> > > > >>
> > > > >>
> ---------------------------------------------------------------------
> > > > >> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> > > > >> For additional commands, e-mail: user-help@velocity.apache.org
> > > > >>
> > > > >>
> > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> > > > For additional commands, e-mail: user-help@velocity.apache.org
> > > >
> > > >
> > >
> >
>
> ---------------------------------------------------------------------
> 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