Announcement Announcement Module
No announcement yet.
IllegalArgumentException: ServletContext must not be null Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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(
    at text.initContext(
    at questContext.initContext(JspAwareRequestContext.ja va:76)
    at questContext.<init>( )
    at org.springframework.web.servlet.tags.RequestContex tAwareTag.doStartTag( 4)
    at org.apache.jsp.WEB_002dINF.jsp.login_jsp._jspx_met h_form_form_0(
    at org.apache.jsp.WEB_002dINF.jsp.login_jsp._jspServi ce(

    and in my JSP I have this snippet.

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

    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"/>

    Thanks in advance.

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


    • #3
      Wow it worked. Thank you.