Announcement

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

    New DSRequest from service is failing

    Hi,
    I am trying to make a DSRequest fetch from service using new DSRequest() and I am getting following exception :
    Code:
     
     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)
    I have a DatasourceA fetch from client that I am catching on server.
    Code:
     @Override
        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:
    Code:
    dsRequest.setRPCManager(rpcManager);
    After this while running execute() the system hangs. No exception nothing happens.


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

    Code:
     @Override
        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.

    Comment


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

      Comment


        #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".

        Comment

        Working...
        X