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

  • New DSRequest from service is failing

    I am trying to make a DSRequest fetch from service using new DSRequest() and I am getting following 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>( 	at com.isomorphic.rpc.ServerObject.<init>(
    I have a DatasourceA fetch from client that I am catching on server.
        public DSResponse fetch(final DSRequest req, final RPCManager rpcManager) throws Exception {
                // Execute Another DS Fetch
                final DSRequest dsRequest= new DSRequest("DatasourceB", DS_OPERATIONTYPE_FETCH);  
               dsRequest.execute();   //this line is throwing exception
    I have tried to set the rpcManager to the new request as given below:
    After this while running execute() the system hangs. No exception nothing happens.

    The DatasourceB fetch is given below:
            <operationBinding operationType="fetch">
                <serverObject lookupStyle="spring" bean="myService"
                    className="com.test.MyServiceImpl" />
    The service method is :

        public DSResponse fetch(final DSRequest dsRequest,final RPCManager rpcManager) throws Exception {
    // some logic
    return  dsRequest.execute();
    Kindly suggest. Thanks in advance.

  • #2
    Normally, the RPCManager and RequestContext is created in the IDACall servlet, in processRequest(). Somehow you've broken that process, possibly with an override of the IDACall servlet, or maybe with a servlet you've put in front of IDACall.

    Whatever the problem, it has nothing to do with the code you've shown so far.


    • #3
      Resolved it using the below code :
      I don't know why it was not working with new DSRequest(dsName, operationType, RPCManager); constructor.


      • #4
        That's complete nonsense. You already provided the RPCManager to this dsRequest instance, so it already had a requestContext. And that's the requestContext where you have gotten an error message saying that requestContext.servletContext is missing.

        So, either something you told us before isn't true, or you are in a "two wrongs make a right" situation where you created a problem through bad usage and then "fixed" it through more bad usage.

        We would recommend looking into how you actually broke things in the first place - probably some bad servlet-level code as we mentioned before - rather than considering it "resolved".