Announcement

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

  • sidharth1917
    replied
    Hi,
    Just adding to the above logs, the
    webRoot:
    entry in server.properties is
    _AUTODETECT_
    .

    I changed the webroot to absolute path of the webroot. Still the same problem.

    Also, the logs pasted above were the only ones I get from the server console. Please let me know in case some more detail is required form my side.
    Last edited by sidharth1917; 8 Nov 2020, 23:48.

    Leave a comment:


  • sidharth1917
    replied
    Hi,
    This is the exception trace I got from the server console:

    Caused by: 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:223)
    at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:236)
    at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64)
    at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:3002)
    at com.XXX.YYY.server.services.impl.ZZZ.handleCopyAdjusments(ZZZ.java:1084)


    Thanks.

    Leave a comment:


  • Isomorphic
    replied
    Please never post just an exception without a stack trace or any surrounding logs. You have been reminded many times of the diagnostics you need to post, but you inexplicably omit them basically every time, even in situations like this where it is very obvious that it means no one can help you.

    Leave a comment:


  • sidharth1917
    replied
    Hi,

    I tried the way it is described in Standalone DataSource Usage.

    I have a Spring application where I use a DSRequest to call a method at server side Service.
    In the method:

    Code:
     public DSResponse copyAdjustments(final DSRequest priceAdjustmentDSRequest, final RPCManager rpcManager) throws ApplicationException {
    
            log.info("copyAdjustment - Start");
            final long jobId = jobSQLService.add("CopyAdjustments", BatchJobStatusConstants.IN_PROGRESS);
    
            // Process the copy adjustment logic in another thread
            taskExecutor.execute(() -> {
                // boolean value to control whether to mark the job is failed in the finally block
                boolean exception = true;
                try {
                    handleCopyAdjusments();
                    exception = false;
                } catch (final ApplicationException e) {
                    // Handle exceptions, send back the exception as the job note
                    exception = false;
                    log.error("Error copying adjustments", e);
                    jobSQLService.update(jobId, BatchJobStatusConstants.ERROR, e.getMessage());
                } finally {
                    // Mark the job as error if something else went wrong
                    if (exception) {
                        jobSQLService.update(jobId, BatchJobStatusConstants.ERROR);
                    }
                }
            });
    
            // Handle all the three lists with PriceAdjustment data in a single transaction
    
            hdwStdAdjustmentData.setData(jobId);
            return hdwStdAdjustmentData;
    
        }
    Please note that the threadPoolExecutor is a Spring managed pol and is injected in this service.

    Then on the handleCopyAdjsutment method:

    Code:
    handleCopyAdjustment(){
    DsTransaction dsTransaction = new DSTransaction();
    List<Object> tobeAddedList = methodFetch1(dsTransaction);
    
    if (CollectionUtils.isNotEmpty(toBeAddedList)) {
                    for (final Map<String, Object> rec : toBeAddedList) {
                        final DSRequest addRequest = new DSRequest(DSConst.PriceAdjustmentSQL.DATASOURCE, DSOperationType.UPDATE.getValue());
                        addRequest.setDsTransaction(dsTransaction);
                        addRequest.setOperationId(DSConst.PriceAdjustmentSQL.ADD_ADJUSTMENT_OPERATION);
                        addRequest.setValues(rec);
                        addRequest.execute();
                    }
    
                }
    
    
    
    }
    Although the fetches work fine and fetches the complete list.
    But when I go to UPDATE operation call in the loop, it gives me:
    [HTML]
    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.
    [/HTML]
    I have also added the following in my server.properties file : standalone.spring.applicationContext:$webRoot/WEB-INF/applicationContext.xml and the path to application context is correct. Still I am getting the same error.

    Please help.

    Leave a comment:


  • Isomorphic
    replied
    By reading the docs we just referred you to.

    There is literally a major overview called Standalone DataSource Usage and it covers your questions.

    Leave a comment:


  • sidharth1917
    replied
    Hi,
    Thanks for the prompt reply.
    I would definitely be using an existing thread pool of the application.

    Using the standalone Data Source Usage, how do we ensure same transaction for multiple operations?

    Leave a comment:


  • Isomorphic
    replied
    See Standalone DataSource Usage. Same approach as if you were running our server product outside of a servlet engine entirely.

    Just a note that most servlet containers consider it a violation to start your own thread - you generally need to coordinate with existing thread pools (eg via Quartz, etc).

    Leave a comment:


  • Using DSrequests from a new thread at Server side

    Hi,
    I am using SmartGWT version 12.1-p20200926.

    I have an UPDATE operation type with DSRequest handled at server side component.

    From within the server side service, I want to start a new ASYNC thread and have my handling code included in the new thread.
    The handling code will make further DataSource requests to accomplish the task. I would want to start a transaction, make new DataSource request, execute the requests and commit the whole transaction in the newly spawned thread.

    How can I do this?

    Thanks & Regards.
Working...
X