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.

 View Only
Expand all | Collapse all

Workbook object creation error: content stream closed

  • 1.  Workbook object creation error: content stream closed

    Posted Mon October 25, 2010 02:21 PM

    Hi all,

    I have wrote a java service that gets executed from an email port whenever a email comes with an xlsx attachment.
    I am extracting the attachment from the mail in my java service and reading its content in a bufferedinput stream.
    I am getting error while creating a workbook object for that attachment object.
    Below is the code where i am getting error:

    IDataCursor pipelineCursor = pipeline.getCursor();
    Object inputStream = IDataUtil.get( pipelineCursor, “inputStream” );
    pipelineCursor.destroy();
    BufferedInputStream bufferedInputStream = new BufferedInputStream( (InputStream) inputStream );
    if (bufferedInputStream == null)
    throw new ServiceException(“Input File Stream is Null”);

    IData[] row_list = null;
    String debugLog = null;
    Workbook wb = null;
    debugLog = “Workbook Object Creation”;
    wb = new XSSFWorkbook(bufferedInputStream); // error at this step.
    Sheet sheet = wb.getSheetAt(0);


    The input to this java service is an object containing the xlsx attachment.

    I am having following jars in my classpath:

    • poi-3.6-20091214.jar
    • poi-contrib-3.6-20091214.jar
    • poi-ooxml-3.6-20091214.jar
    • poi-ooxml-schemas-3.6-20091214.jar
    • dom4j-1.6.1.jar

    Can anyone of you please help me to resolve this issue.?

    Thanks in Advance…

    Amit


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


  • 2.  RE: Workbook object creation error: content stream closed

    Posted Fri October 29, 2010 01:22 PM

    I finally found the solution:
    there werte 2 jar files missing in IS classpath.
    · xmlbeans-2.3.0.jar
    · org.apache.servicemix.specs.stax-API-1.0-1.0.1

    After adding these jar files code ran fine.

    I hope this might be useful for others.

    Cheers!!!
    Amit


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