Results 1 to 8 of 8

Thread: Spring Portlet MVC 3.0 Release : File not found: /WEB-INF/servlet/view

  1. #1
    Join Date
    Mar 2010
    Posts
    3

    Default Spring Portlet MVC 3.0 Release : File not found: /WEB-INF/servlet/view

    I have written a simple HelloWorld portlet with Spring 3 Portlet MVC and deploy to Vignette Portal Server and it throws errors with the following stack trace:
    ERROR - DispatcherPortlet - Could not complete request
    javax.portlet.PortletException: javax.servlet.ServletException: File "/WEB-INF/servlet/view" not found
    at com.vignette.portal.portlet.jsrcontainer.internal. standardcontainer.invocation.apiimpl.PortletReques tDispatcherImpl.include(PortletRequestDisp
    atcherImpl.java:328)
    at org.springframework.web.portlet.DispatcherPortlet. doRender(DispatcherPortlet.java:1137)
    at org.springframework.web.portlet.DispatcherPortlet. render(DispatcherPortlet.java:1092)
    at org.springframework.web.portlet.DispatcherPortlet. doRenderService(DispatcherPortlet.java:761)
    at org.springframework.web.portlet.FrameworkPortlet.p rocessRequest(FrameworkPortlet.java:522)
    at org.springframework.web.portlet.FrameworkPortlet.d oDispatch(FrameworkPortlet.java:470)

    Notes:
    When I switch to Spring 2.5.6 with the same source code, it works fine.
    Any help would be appreciated. I'm hereby attached the detail logs for further investigation.
    Here is my environment:
    jdk 1.6.0_17, spring 3.0.1, Tomcat 6.0.20, Vignette Portal Server 7_4

    The ViewRendererServlet Mapping is reside in web.xml:
    <servlet>
    <servlet-name>view-servlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.ViewRenderer Servlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>view-servlet</servlet-name>
    <url-pattern>/WEB-INF/servlet/view</url-pattern>
    </servlet-mapping>
    Attached Files Attached Files
    Last edited by chengkhoon; Mar 17th, 2010 at 06:05 PM. Reason: code added

  2. #2
    Join Date
    Mar 2010
    Posts
    3

    Default

    I really need some leads about whether is a bug from Vignette Portal or from Spring 3. It's just work fine in Spring 2.5.6.
    Is there a workaround ? Otherwise I have to bypass Spring Portlet MVC and just implement with GenericPortlet.

  3. #3
    Join Date
    Oct 2006
    Posts
    228

    Default

    Looking at the stack trace it appears to be entering the ViewRendererServlet but is failing somewhere in the Tomcat JspServlet, so my guess would be that either the viewResolver configuration is incorrect or the jsp is missing/invalid. Can you post the full web.xml, application context files (both applicationContext.xml and helloWorld-portlet.xml, and /WEB-INF/jsp/helloWorld.jsp.

  4. #4
    Join Date
    Oct 2006
    Posts
    228

    Default

    I have a feeling this is probably a bug in Vignette Portal. The log shows the viewResolver is correctly generating the jsp path, and the stacktrace message indicates the JspServlet is trying to find /WEB-INF/servlet/view instead of /WEB-INF/jsp/helloWorld.jsp. This is a real possibility if the PortletRequestDispatcher doesn't setup the correct context for the included servlet/jsp (including provide a correct implementation of the servlet RequestDispatcher). I'm speculating here, but since Spring 3.x supports JSR 286, but Spring 2.5.x doesn't, it is possible that the portlet container is behaving differently once you use the updated Spring jar files.

    You could easily check this independent of Spring by creating a GenericPortlet that does an include on a Servlet that does an include on a jsp. You could also see if it makes any difference whether you do this as a JSR168 or JSR286 portlet.

  5. #5
    Join Date
    Mar 2010
    Posts
    3

    Default

    Here is my web.xml
    Code:
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
             version="2.4">
    
        <description>Portlet that displays simple helloworld</description>
        <display-name>HelloWorld-2</display-name>
        <session-config>
            <session-timeout>15</session-timeout>
        </session-config>
        <context-param>
            <description>
                The context root to which this web application is deployed.
            </description>
            <param-name>contextPath</param-name>
            <param-value>helloWorld</param-value>
        </context-param>
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <servlet>
            <servlet-name>view-servlet</servlet-name>
            <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>view-servlet</servlet-name>
            <url-pattern>/WEB-INF/servlet/view</url-pattern>
        </servlet-mapping>
    </web-app>
    Here is my portlet.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
    	<portlet>
            <description>Write here a short description about your hello world portlet.</description>
    		<portlet-name>helloWorld</portlet-name>
            <display-name>SPRING</display-name>
    		<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
    
    		<supports>
    			<mime-type>text/html</mime-type>
    			<portlet-mode>view</portlet-mode>
    		</supports>
    
            <supported-locale>en</supported-locale>
            
            <portlet-info>
                <title>Hello World</title>
                <short-title>Hello World</short-title>
                <keywords>helloworld2</keywords>
            </portlet-info>
    	</portlet>
    </portlet-app>
    Here is my applicationContext.xml, which is empty:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    
    </beans>
    Here is my helloworld-portlet.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    
    	<bean id="helloWorldController" class="au.com.xxx.xxx.spike.HelloWorldController"/>
    
    	<bean id="portletModeHandlerMapping"
    		class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
    		<property name="portletModeMap">
    			<map>
    				<entry key="view">
    					<ref bean="helloWorldController" />
    				</entry>
    			</map>
    		</property>
    	</bean>
    	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<property name="viewClass" value="org.springframework.web.servlet.view.InternalResourceView" />
    		<property name="prefix" value="/WEB-INF/jsp/" />
    		<property name="suffix" value=".jsp" />
    	</bean>
    </beans>
    Here is my helloWorld.jsp
    Code:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ page contentType="text/html" isELIgnored="false" %>
    
    <h1>HELLO</h1>
    <c:out value="${helloWorldMessage}"/>
    Here is my HelloWorldController.java
    Code:
    import org.springframework.web.portlet.ModelAndView;
    import org.springframework.web.portlet.mvc.Controller;
    
    import javax.portlet.ActionRequest;
    import javax.portlet.ActionResponse;
    import javax.portlet.RenderRequest;
    import javax.portlet.RenderResponse;
    import java.util.HashMap;
    import java.util.Map;
    
    public class HelloWorldController implements Controller {
    	
    	public void handleActionRequest(ActionRequest request,
    			ActionResponse response) throws Exception {
    		
    	}
    
    	
    	public ModelAndView handleRenderRequest(RenderRequest request,
    			RenderResponse response) throws Exception {
    		Map<String, Object> model = new HashMap<String, Object>();
    		model.put("helloWorldMessage", "Hello World");
    		return new ModelAndView("helloWorld", model);
    	}
    }
    Last edited by chengkhoon; Mar 20th, 2010 at 04:22 AM.

  6. #6
    Join Date
    Mar 2007
    Posts
    15

    Default Do not map to a URL under WEB-INF on Vignette

    make changes similar to the following:

    web.xml
    Code:
    <servlet-mapping>
         <servlet-name>ViewRendererServlet</servlet-name>
         <url-pattern>/whoSucksForNotMappingWebInfUrls</url-pattern>
    </servlet-mapping>
    Add the following to portlet.xml
    Code:
    <init-param>
         <name>viewRendererUrl</name>
         <value>/whoSucksForNotMappingWebInfUrls</value>
    </init-param>

    Yes, this sucks because you are mapping a freely accessible URL, but that is all you have available.

  7. #7
    Join Date
    Jul 2010
    Posts
    1

    Default did it work?

    Hi,
    i am using the same environment, and i think that i have the same problem.

    Could you tell me if you solved it? and how did you solve?


    thanks a lot
    gchuquip

  8. #8
    Join Date
    Mar 2007
    Posts
    15

    Default

    See the instructions above. Basically, map it to a URL that is NOT under WEB-INF.


    Quote Originally Posted by giuliana View Post
    Hi,
    i am using the same environment, and i think that i have the same problem.

    Could you tell me if you solved it? and how did you solve?


    thanks a lot
    gchuquip

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •