Announcement Announcement Module
Collapse
No announcement yet.
IllegalArgumentException: ServletContext must not be null Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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!

    Comment


    • #3
      Wow it worked. Thank you.

      Comment

      Working...
      X