Results 1 to 3 of 3

Thread: IllegalArgumentException: ServletContext must not be null

  1. #1
    Join Date
    Aug 2008
    Posts
    16

    Default IllegalArgumentException: ServletContext must not be null

    I'm getting the following error if i use the spring form tag.
    Please help. I'm stuck with this forever error.

    Nested Exception is java.lang.IllegalArgumentException: ServletContext must not be null
    at org.springframework.util.Assert.notNull(Assert.jav a:112)
    at org.springframework.web.util.WebUtils.getDefaultHt mlEscape(WebUtils.java:178)
    at org.springframework.web.servlet.support.RequestCon text.initContext(RequestContext.java:215)
    at org.springframework.web.servlet.support.JspAwareRe questContext.initContext(JspAwareRequestContext.ja va:76)
    at org.springframework.web.servlet.support.JspAwareRe questContext.<init>(JspAwareRequestContext.java:50 )
    at org.springframework.web.servlet.tags.RequestContex tAwareTag.doStartTag(RequestContextAwareTag.java:7 4)
    at org.apache.jsp.WEB_002dINF.jsp.login_jsp._jspx_met h_form_form_0(login_jsp.java:97)
    at org.apache.jsp.WEB_002dINF.jsp.login_jsp._jspServi ce(login_jsp.java:69)


    and in my JSP I have this snippet.

    <form:form commandName="webUser" method="post" >
    <form:input path="userName" size="30" maxlength="80"/>
    </form:form>


    and in my porlet.xml I have this snippet.

    <bean id="loginController" class="com.ea.nfs.portlets.login.controller.LoginC ontroller">
    <property name="commandName" value="webUser"/>
    <property name="commandClass" value="com.ea.nfs.model.WebUser"/>
    <property name="formView" value="login"/>
    <property name="successView" value="login"/>
    </bean>


    Thanks in advance.
    Coffeejoy

  2. #2
    Join Date
    Sep 2004
    Location
    Arizona, USA
    Posts
    383

    Default

    You need to have an application context defined and loaded (even if its empty) at the webapp level (typically loaded by ContextLoaderListener defined in your web.xml), and then a separate application context defined and loaded for your portlet. The portlet gets access to the ServletContext via the application contexts.

    Hope that helps!

  3. #3
    Join Date
    Aug 2008
    Posts
    16

    Default

    Wow it worked. Thank you.

Tags for this Thread

Posting Permissions

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