Announcement Announcement Module
Collapse
No announcement yet.
VelocityView.getTemplate() NPE Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • VelocityView.getTemplate() NPE

    Hi!

    1. The problem
    java.lang.NullPointerException

    2. The code
    Code:
    VelocityView view = new VelocityView();				
    view.setUrl(getDefaultView());
    view.setBeanName(getDefaultBeanName());
    view.setContentType(getDefaultContentType());	
    return new ModelAndView(view, model);
    3. The logs
    org.springframework.web.servlet.DispatcherServlet (926) - Rendering view [org.springframework.web.servlet.view.velocity.Velo cityView: name 'style'; URL [WEB-INF/tpl/style.htm]] in DispatcherServlet with name 'RMP'

    org.springframework.web.servlet.view.velocity.Velo cityView (234) - Rendering view with name 'style' with model {} and static attributes {}

    org.springframework.web.servlet.view.velocity.Velo cityView (498) - Rendering Velocity template [WEB-INF/tpl/style.htm] in VelocityView 'style'

    org.springframework.web.servlet.DispatcherServlet (406) - Could not complete request
    java.lang.NullPointerException
    at org.springframework.web.servlet.view.velocity.Velo cityView.getTemplate(VelocityView.java:537)

    4. The comment
    File 'WEB-INF/tpl/style.htm' exist.

    Any suggestions? Thanks in advance!

    --
    Greetings,
    Łukasz

  • #2
    if you're creating the view programmatically, you need to set a configured VelocityEngine on it. See the source for VelocityView.

    Regards,

    Comment

    Working...
    X