Hi !
Im trying to configure a spring portlet using Velocity. The portlet is to be run under Liferay, I dont know if this is a important fact or not. I have been following the reference manual steps to configure Velocity and I havent reached a solution. Im using velocity-1.6.1.jar and velocity-1.6.1-dep.jar as libraries. I hope somebody could help me !! The error I get is the following:
The only file I have modified over my spring portlet (running) is the name-portlet.xml, I use (..) where URLs are because I cannot post them:ERROR [DispatcherPortlet:501] Could not complete request
javax.portlet.PortletException: org.springframework.web.util.NestedServletExceptio n: View rendering failed; nested exception is java.lang.IllegalStateException: WebApplicationObjectSupport instance [org.springframework.web.servlet.view.velocity.Velo cityView: name 'view'; URL [/WEB-INF/velocity/view.vm]] does not run within a ServletContext. Make sure the object is fully configured!
Code:<?xml version="1.0" encoding="UTF-8"?> <beans (...) xsi:schemaLocation="(...)/spring-beans-2.5.xsd (...)/spring-context-2.5.xsd"> <context:annotation-config/> <bean class="org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping"> <property name="interceptors"> <bean class="org.springframework.web.portlet.handler.ParameterMappingInterceptor"/> </property> </bean> <bean id="viewController" class="es.prueba.portlet.pruebaAlba2Controller" /> <bean id="portletModeHandlerMapping" class="org.springframework.web.portlet.handler.PortletModeHandlerMapping"> <property name="portletModeMap"> <map> <entry key="view" value-ref="viewController" /> </map> </property> </bean> <bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"> <property name="resourceLoaderPath"> <value>/</value> </property> </bean> <bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver"> <property name="prefix" value="/WEB-INF/velocity/"/> <property name="cache" value="false"/> <property name="suffix" value=".vm"/> </bean> </beans>
The web.xml file contains the spring reference manual indications:
Code:<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" (...) xsi:schemaLocation="(...)/web-app_2_4.xsd"> <servlet> <servlet-name>view-servlet</servlet-name> <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>view-servlet</servlet-name> <url-pattern>/WEB-INF/servlet/view</url-pattern> </servlet-mapping> </web-app>
Please HELP !!! I cannot figure out where is the problem !


Reply With Quote
