-
Mar 9th, 2009, 12:43 PM
#1
Velocity cannot find resource after upgrade
Hi,
I have a osgi bundle that is running perfect in Spring DM Server 1.0.0 RELEASE. However, after I upgrade to SpringDM Server 1.0.2 REPLEASE.
I got exception saying that it cannot find the property file and velocity template.
BEFORE upgrade
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
<property name="location" value="WEB-INF/myproject.properties" />
</bean>
It will work if I change it to
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
<property name="location" value="MODULE-INF/WEB-INF/myproject.properties" />
</bean>
or
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
<property name="location" value="classpath:WEB-INF/myproject.properties" />
</bean>
After I fixed the location to the property file, Velocity complains that it cannot find the template.
Here is the setup:
<bean id="velocityConfig" class="org.springframework.web.servlet.view.veloci ty.VelocityConfigurer">
<!-- <property name="resourceLoaderPath"-->
<!-- value="${velocity.template.dir},classpath:WEB-INF/velocity," />-->
<property name="configLocation">
<value>WEB-INF/velocity.properties</value>
</property>
</bean>
velocity.properties
resource.loader=class,file
class.resource.loader.class=org.apache.velocity.ru ntime.resource.loader.ClasspathResourceLoader
class.resource.loader.path=MODULE-INF/
class.resource.loader.cache=true
class.resource.loader.modificationCheckInterval=10
file.resource.loader.class=org.apache.velocity.run time.resource.loader.FileResourceLoader
file.resource.loader.path=/var/opt/Myproject/dynamic
file.resource.loader.cache=true
file.resource.loader.modificationCheckInterval=10
Velocity has no problem finding template in /var/opt/Myproject/dynamic, however, if I have a "parse("WEB-INF/velocity/vm/footer.vm") " statement in the template under the file loader path. Velocity cannot find it. It was working before upgrade.
So, is there any change in org.springframework.osgi.io-1.1.3.RELEASE.jar that will affect Velocity finding template.
Thanks
-
Mar 9th, 2009, 03:40 PM
#2
In dm Server 1.0.0 and 1.0.1 web resources would be made part of the classpath. That's wrong (I created a JIRA issue for it) and has been fixed in 1.0.2. I guess that's what you're seeing: these resources used to be visible on the classpath, but now they're just web resources.
Your Velocity config uses a ClasspathResourceLoader to load web resources. That means you'll either need to use another loader class, or you'll need to move your templates tobe on the bundle's classpath (under MODULE-INF/WEB-inf/classes seems like a sensible location).
-
Mar 12th, 2009, 09:06 PM
#3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules