Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    RequestContext is missing the ServletContext

    just flow Server Examples - Validations - DMI Validation

    <code>
    DSRequest dsRequest = new DSRequest("StockItem", "fetch");
    Object itemId = record.get("itemId");
    // if no item was selected, no way to run this validation - rely on a required
    // validator on the itemId question to tell the user to populate the form.
    if (itemId == null) return true;

    dsRequest.setCriteria(DataTools.buildMap("id", record.get("itemId")));

    Map dataMap = dsRequest.execute().getDataMap();
    </code>


    Map dataMap = dsRequest.execute().getDataMap(); throws exception :


    2011-10-03 18:42:03,153 [l0-7] WARN com.isomorphic.util.DefaultValidators - Validator DMI invocation threw exception: java.lang.Exception: RequestContext is missing the ServletContext. Please ensure you privide either a PageContext, a Servlet, or a ServletContext to your RequestContex.instance() call.
    at com.isomorphic.rpc.ServerObject.<init>(ServerObject.java:225)
    at com.isomorphic.rpc.ServerObject.<init>(ServerObject.java:70)
    at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:416)
    at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64)
    at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1440)

    #2
    This is caused by failure to install the Init servlet - see installation instructions.

    Comment


      #3
      but I had set that servlet in web.xml


      <servlet>
      <servlet-name>Init</servlet-name>
      <servlet-class>com.isomorphic.base.Init</servlet-class>
      <load-on-startup>1</load-on-startup>
      </servlet>

      Comment


        #4
        Then something else is wrong - not actually using that web.xml file, servlet not actually installed, code is running before the Init servlet runs are some possibilities. But this does not happen with that sample when following the documented installation procedure.

        Comment

        Working...
        X