[jboss-dev-forums] [JBoss AS 7 Development] - Migrating from AS4 to AS7 - Problem loading view templates

Neil Doshi do-not-reply at jboss.com
Thu Jun 28 21:12:46 EDT 2012


Neil Doshi [https://community.jboss.org/people/ndoshi] created the discussion

"Migrating from AS4 to AS7 - Problem loading view templates"

To view the discussion, visit: https://community.jboss.org/message/744935#744935

--------------------------------------------------------------
I am migrating my spring mvc web app from AS4 to AS7.
The application is having a hard time finding my view templates (we are using velocity templates for our view).
This currently works fine in AS4 as is.

The project structure is as follows:
/
 /src
   /com
    (etc...)

 /WebContent
  /WEB-INF
    /velocity
     /login
      /login.vm


Here is an excerpt from my spring config file:





Stack Trace:
org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/WEB-INF/velocity/login/login.vm'
          org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)
          org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)
          org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400)
          org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1380)
          org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:401)
          org.springframework.web.servlet.view.velocity.VelocityView.getTemplate(VelocityView.java:535)
          org.springframework.web.servlet.view.velocity.VelocityView.getTemplate(VelocityView.java:520)
          org.springframework.web.servlet.view.velocity.VelocityView.checkTemplate(VelocityView.java:293)
          org.springframework.web.servlet.view.velocity.VelocityLayoutView.checkTemplate(VelocityLayoutView.java:122)
          org.springframework.web.servlet.view.velocity.VelocityView.initApplicationContext(VelocityView.java:258)
          org.springframework.context.support.ApplicationObjectSupport.initApplicationContext(ApplicationObjectSupport.java:119)
          org.springframework.web.context.support.WebApplicationObjectSupport.initApplicationContext(WebApplicationObjectSupport.java:69)
          org.springframework.context.support.ApplicationObjectSupport.setApplicationContext(ApplicationObjectSupport.java:73)
          org.springframework.context.support.ApplicationContextAwareProcessor.postProcessBeforeInitialization(ApplicationContextAwareProcessor.java:70)
          org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350)
          org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1331)
          org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:341)
          org.springframework.web.servlet.view.UrlBasedViewResolver.loadView(UrlBasedViewResolver.java:413)
          org.springframework.web.servlet.view.AbstractCachingViewResolver.createView(AbstractCachingViewResolver.java:159)
          org.springframework.web.servlet.view.UrlBasedViewResolver.createView(UrlBasedViewResolver.java:378)
          org.springframework.web.servlet.view.AbstractCachingViewResolver.resolveViewName(AbstractCachingViewResolver.java:78)
          org.springframework.web.servlet.DispatcherServlet.resolveViewName(DispatcherServlet.java:1215)
          org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1164)
          org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:902)
          org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
          org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
          org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
          javax.servlet.http.HttpServlet.service(HttpServlet.java:847)




I tried a few different options for the "prefix" property
* /WEB-INF/velocity/
* WEB-INF/velocity/
* customerportal.war/WEB-INF/velocity/
* com.odc.customerportal/WEB-INF/velocity/



I am able to reorganize the location of the files in the built war file if necessary.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/744935#744935]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120628/ec7d41af/attachment.html 


More information about the jboss-dev-forums mailing list