IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
  • 1.  Pass Session object to new thread

    Posted Thu June 24, 2004 04:59 PM

    Is it some way for passing Session object from current thread to a new one ? When I invoked remote service via Service.doInvoke(…) from original server context - everything was working fine. But when I run my new thread and try to do it there, I have NullPointerException during invoke execution. I think it is because the Service.getSession() within my new thread is NULL. I tried to take Session object from original thread and passed it into my thread constructor, then used it for invoked the remote service via another method Service.doInvoke(String, Session, IData) but it doesn’t work too, with the same exception. So, now I have no ideas how I can solve this problem, may be somebody knows another way for do that ?

    sy konstantin


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: Pass Session object to new thread

    Posted Thu June 24, 2004 07:02 PM

    Konstantin,

    Please check these below threads if it helps,

    [url=“wmusers.com”]wmusers.com &
    [url=“wmusers.com”]wmusers.com

    Cheers,


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 3.  RE: Pass Session object to new thread

    Posted Sun June 27, 2004 11:39 AM

    Try this…
    Get the session object from the parent thread, and set the following parameters just before calling Service.doInvoke in the child thread:

    InvokeState.setCurrentUser(session.getUser());
    InvokeState.setCurrentSession(session);


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Pass Session object to new thread

    Posted Wed June 15, 2016 03:38 PM

    Hi,

    Even I am getting the same error. Can you please help me if this got resolved. please let me know how to pass session object and do the rest of the stuff so that i can invoke the service using doInvoke.

    IDataCursor pipelineCursor = pipeline.getCursor();
    try
    {
    FPImpServiceN m1=new FPImpServiceN();
    Thread t1 =new Thread(m1);
    t1.start();

    }
    catch(Exception e)
    {
    throw new ServiceException(e);
    }
    pipelineCursor.destroy();

    Code in source:

    static class FPImpServiceN implements Runnable
    {
    public void run()
    {
    try
    {
    NSName nsName = NSName.create( “threadsPOC.services:new_javaService” );
    IData outputData = Service.doInvoke( nsName, null ); // Getting Null pointer exception here //
    }
    catch(Exception e)
    {
    com.wm.util.JournalLogger.log( com.wm.util.JournalLogger.INFO, com.wm.util.JournalLogger.FAC_FLOW_SVC, com.wm.util.JournalLogger.DEBUG, e);
    }
    }
    }


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods