'lo all,
I'm using velocity to render pages in the web tier using spring under jboss 4.0.1 deployed as a simple war file. Here is the velocity specific app config:
Here is velocity.properties (located under WEB-INF):Code:<bean id="velocityConfigurer" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"> <property name="configLocation"> <value>WEB-INF/velocity.properties</value> </property> </bean> <bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver"> <property name="suffix" value=".vm"/> <!-- <property name="numberToolAttribute"><value>numbertool</value></property> <property name="dateToolAttribute"><value>datetool</value></property> --> </bean>
Here is the error:Code:# Any property that is not listed here will have it's default # value used. The default values are located in : # * src/java/org/apache/velocity/runtime/default/velocity.defaults # * http://jakarta.apache.org/velocity/developer-guide.html # runtime.log = ./velocity.log runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem resource.loader=file #class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader #class.resource.loader.cache=false #class.resource.loader.modificationCheckInterval=2 #class.resource.loader.path=/WEB-INF/views file.resource.loader.class=org.apache.velocity.runtime.resource.loader.FileResourceLoader file.resource.loader.path=/WEB-INF/views file.resource.loader.cache=true file.resource.loader.modificationCheckInterval=2
Here is the controller that is trying to invoke the velocity view:Code:org.springframework.context.ApplicationContextException: Cannot find Velocity template for URL [admin-home.vm]: Did you specify the correct resource loader path?; nested exception is org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'admin-home.vm' org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'admin-home.vm'
Here is the logger output for the debug section w/in the controller class above:Code:public class AdminHomeController extends AbstractController { private AccountUserDao accountUserDao = null; public void setAccountUserDao(AccountUserDao accountUserDao) { this.accountUserDao = accountUserDao; } protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { long userId = RequestUtils.getRequiredLongParameter(request, "userId"); // debug File f = new File("."); logger.debug("current dir absolute path ('.'): " + f.getAbsolutePath()); ClassLoader classLoader = this.getClass().getClassLoader(); URL url = classLoader.getResource("."); logger.debug("classLoader current dir: " + url.getPath() ); /// AccountUserVO accountUser = accountUserDao.load(userId); return new ModelAndView("admin-home").addObject("accountUser", accountUser); }
Does the war need some additional bit of info to tell JBoss what the "current directory" should be?Code:22:28:49,414 DEBUG [AdminHomeController] current dir absolute path ('.'): C:\development\jboss-4.0.1\bin\. 22:28:50,926 DEBUG [AdminHomeController] classLoader current dir: /C:/development/jboss-4.0.1/server/default/tmp/deploy/tmp933smbiz-exp.war/
[/code]


Reply With Quote
