3

So I trying to create a xlsx file (xlsx is needed as it goes over 70,000 rows) and I keep getting the following error when I deploy to the wso2 esb however when I run the tests (in netbeans and during the mvn build process) it works perfectly. I am specifically using SXSSF however the issue is from XSSF as it also occurs when I try without streaming.

Please help me get this working in the esb, I normally deploy through the .car file.

I am using ESB 4.8.1 just for clarification

ERROR:

TID[-1234] [ESB] [2014-10-10 19:11:43,968] ERROR 
{org.apache.axis2.transport.base.threads.NativeWorkerPool} - Uncaught exception 
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook$Factory.newInstance(Unknown 
Source) org.apache.poi.xssf.usermodel.XSSFWorkbook.onWorkbookCreate(XSSFWorkbook.java:307) 
org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:167) 
org.apache.poi.xssf.streaming.SXSSFWorkbook.(SXSSFWorkbook.java:172) 
org.apache.poi.xssf.streaming.SXSSFWorkbook.(SXSSFWorkbook.java:143) 
org.apache.poi.xssf.streaming.SXSSFWorkbook.(SXSSFWorkbook.java:205) 
com.circleblack.mediator.data.PerformanceExtract.mediate(PerformanceExtract.java:30) 
org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78) 
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77) 
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47) 
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131) 
org.apache.synapse.rest.Resource.process(Resource.java:297) 
org.apache.synapse.rest.API.process(API.java:341) 
org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76) 
org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:63) 
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220) 
org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83) 
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) 

org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:344) 
org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:168) 
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
java.lang.Thread.run(Thread.java:745) 

pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0</modelVersion>

<parent>
    <groupId>com.circleblack.mediator</groupId>
    <artifactId>cb-esb-mediator</artifactId>
    <version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>cb-esb-mediator-data</artifactId>
<packaging>bundle</packaging>

<description>Mediators for processing data.</description>

<properties>
    <CApp.type>lib/synapse/mediator</CApp.type>
</properties>

<dependencies>
    <dependency>
        <groupId>org.apache.synapse</groupId>
        <artifactId>synapse-core</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2.wso2</groupId>
        <artifactId>axis2</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.ws.commons.axiom.wso2</groupId>
        <artifactId>axiom</artifactId>
    </dependency>
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.10.1</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.10.1</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>3.10.1</version>
        <scope>compile</scope>
    </dependency>

    <!-- Tests -->
    <dependency>
        <groupId>com.circleblack.mediator</groupId>
        <artifactId>cb-esb-mediator-test-mockito</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.6.0</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.poi.wso2</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.9.0.wso2v2</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>ooxml-schemas</artifactId>
        <version>1.1</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>stax</groupId>
        <artifactId>stax-api</artifactId>
        <version>1.0.1</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
        <type>zip</type>
        <scope>compile</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <configuration>
                <instructions>
                    <Bundle-SymbolicName>cb-esb-mediator-data</Bundle-SymbolicName>
                    <Bundle-Name>cb-esb-mediator-data</Bundle-Name>
                    <Export-Package>com.circleblack.mediator.data</Export-Package>
                    <DynamicImport-Package>*</DynamicImport-Package>
                </instructions>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>

java file

package com.circleblack.mediator.data;

import java.io.FileNotFoundException;

import org.apache.axiom.om.OMElement;
import org.apache.synapse.MessageContext;
import org.apache.synapse.mediators.AbstractMediator;

import java.util.Date;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;

public class PerformanceExtract extends AbstractMediator {

  @Override
  public boolean mediate(MessageContext context) {
    System.out.println("Performance Extract Started perfExtact:");
    OMElement performanceExportElement = (OMElement) context.getProperty("performanceExtract");
    System.out.println("Performance Extract perfFile:");
    String performanceExportElementFile = (String) context.getProperty("performanceExtractFile");
    System.out.println(performanceExportElementFile);
    System.out.println("Performance Extract Data Gathered!");
    SXSSFWorkbook wb = new SXSSFWorkbook(100);

    for (Iterator<?> i = performanceExportElement.getChildElements(); i.hasNext();) {
      OMElement sheetElm = (OMElement) i.next();
      //Setup Sheet
      Sheet sheet = wb.createSheet(sheetElm.getLocalName());
      //Setup headers
      OMElement RowHeaders=sheetElm.getFirstElement();
      if(RowHeaders!=null){
        Row row = sheet.createRow(sheet.getLastRowNum());
        int columnNum=0;
        for (Iterator<?> q = RowHeaders.getChildElements(); q.hasNext();) {
          OMElement RowHeader = (OMElement) q.next();
          row.createCell(columnNum).setCellValue(RowHeader.getLocalName());
          columnNum++;
        }
        //Setup Data
        for (Iterator<?> z = sheetElm.getChildElements(); z.hasNext();) {
          OMElement rowElm = (OMElement) z.next();
          row = sheet.createRow(sheet.getLastRowNum()+1);
          columnNum=0;
          for (Iterator<?> q = rowElm.getChildElements(); q.hasNext();) {
            OMElement cellElm = (OMElement) q.next();
            row.createCell(columnNum).setCellValue(cellElm.getText());
            columnNum++;
          }
        }
      }
    }

    try {
      //FileOutputStream fileOut = new        FileOutputStream("/CBdrive/extracts/"+performanceExportElementFile);
      FileOutputStream fileOut = new FileOutputStream("C:\\"+performanceExportElementFile);
  wb.write(fileOut);
  fileOut.close();
    } catch (FileNotFoundException ex) {
      Logger.getLogger(PerformanceExtract.class.getName()).log(Level.SEVERE,     "FileNotFoundException", ex);
    } catch (IOException ex) {
      Logger.getLogger(PerformanceExtract.class.getName()).log(Level.SEVERE, "IOException", ex);
    }
    wb.dispose();
    return true;
  }
}

EDITED: More detailed error message:

[2014-10-12 19:56:34,235] ERROR - NativeWorkerPool Uncaught exception java.lang.ExceptionInInitializerError 
at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook$Factory.newInstance(Unknown Source)       at org.apache.poi.xssf.usermodel.XSSFWorkbook.onWorkbookCreate(XSSFWorkbook.java:307)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:167)
    at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(SXSSFWorkbook.java:172)
    at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(SXSSFWorkbook.java:143)
    at org.apache.poi.xssf.streaming.SXSSFWorkbook.<init>(SXSSFWorkbook.java:205)
    at com.circleblack.mediator.data.PerformanceExtract.mediate(PerformanceExtract.java:30)
    at org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
    at org.apache.synapse.rest.Resource.process(Resource.java:297)
    at org.apache.synapse.rest.API.process(API.java:341)
    at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
    at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:63)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
    at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:344)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:168)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)Caused by: java.lang.RuntimeException: Cannot load SchemaTypeSystem. Unable to load class with name schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder. Make sure the generated binary files are on the classpath.
    at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:783)
    at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook.<clinit>(Unknown Source)
    ... 24 more

Caused by: java.lang.ClassNotFoundException: schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:769)
    ... 25 more

below is my parent pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0</modelVersion>

<parent>
    <groupId>com.circleblack</groupId>
    <artifactId>cb-wso2</artifactId>
    <version>1.0.0-SNAPSHOT</version>
</parent>

<groupId>com.circleblack.mediator</groupId>
<artifactId>cb-esb-mediator</artifactId>
<packaging>pom</packaging>

<description>Custom mediators for ESB.</description>

<modules>
    <module>cb-esb-mediator-data</module>
    <module>cb-esb-mediator-rest</module>
    <module>cb-esb-mediator-security</module>

    <module>cb-esb-mediator-test-mockito</module>
</modules>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <synapse.version>2.1.2-wso2v2</synapse.version>

    <axis2.version>1.6.1.wso2v10</axis2.version>
    <axiom.version>1.2.11.wso2v4</axiom.version>

    <httpcomponents.version>4.1.0-wso2v1</httpcomponents.version>
    <httpclient.version>3.1.0.wso2v2</httpclient.version>

    <junit.version>4.11</junit.version>
    <mockito.version>1.9.5</mockito.version>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.apache.synapse</groupId>
            <artifactId>synapse-core</artifactId>
            <version>${synapse.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2.wso2</groupId>
            <artifactId>axis2</artifactId>
            <version>${axis2.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.commons.axiom.wso2</groupId>
            <artifactId>axiom</artifactId>
            <version>${axiom.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents.wso2</groupId>
            <artifactId>httpcore</artifactId>
            <version>${httpcomponents.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-httpclient.wso2</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>${httpclient.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.16</version>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.4</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </pluginManagement>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
        </plugin>
    </plugins>
</build>

</project>

My top level wso2 pom

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0</modelVersion>

<groupId>com.circleblack</groupId>
<artifactId>cb-wso2</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
    <module>cb-ds</module>
    <module>cb-esb</module>
    <module>cb-esb-mediator</module>
    <module>cb-capp</module>
</modules>

<repositories>
    <repository>
        <releases>
            <updatePolicy>daily</updatePolicy>
            <checksumPolicy>ignore</checksumPolicy>
        </releases>
        <id>wso2-nexus</id>
        <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <releases>
            <updatePolicy>daily</updatePolicy>
            <checksumPolicy>ignore</checksumPolicy>
        </releases>
        <id>wso2-nexus</id>
        <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
    </pluginRepository>
</pluginRepositories>

<properties>
    <wso2.plugin>2.0.4</wso2.plugin>
    <artifact.types>service/rule=aar,lib/library/bundle=jar,synapse/message-processors=xml,synapse/proxy-service=xml,synapse/message-store=xml,carbon/application=car,registry/resource=zip,synapse/endpoint=xml,lib/dataservice/validator=jar,web/application=war,synapse/sequence=xml,synapse/configuration=xml,lib/registry/handlers=jar,synapse/task=xml,webapp/jaxws=war,synapse/api=xml,cep/bucket=xml,bpel/workflow=zip,lib/registry/filter=jar,service/dataservice=dbs,synapse/local-entry=xml,synapse/priority-executor=xml,synapse/template=xml,synapse/event-source=xml,lib/carbon/ui=jar,service/axis2=aar,wso2/gadget=dar,lib/synapse/mediator=jar</artifact.types>
    </properties>

</project>

Do I need to specifically include the dependencies somewhere outside of the mediators pom? I also included them in the main carbon app pom but it didn't seem to make a difference.

Community
  • 1
  • 1
Jegsar
  • 501
  • 6
  • 22
  • What's the full stacktrace? – Gagravarr Oct 12 '14 at 12:12
  • I added a more detailed error message. Please let me know if there is something else you need to help me. – Jegsar Oct 12 '14 at 19:08
  • The caused by makes me think you're missing the (right) xmlbeans jar, are you sure it's present and working at runtime? – Gagravarr Oct 12 '14 at 21:03
  • If everything is working properly it should I have 2.6.0 based on the requirements from http://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas/3.10.1 in both the carbon app pom and the pom for the mediator, with scope "compile". I however do agree that something is stopping it from getting accessed during runtime. It is located here on my computer also. C:\Users\Jegsar\.m2\repository\org\apache\xmlbeans\xmlbeans\2.6.0\xmlbeans-2.6.0.jar – Jegsar Oct 12 '14 at 23:42

2 Answers2

3

With ESB 4.8.1, class

schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder

can be found in ESB_HOME/repository/components/plugins/poi_ooxml_3.9.0.wso2v1

I don't have your parent POM, so I've updated your POM (see below) to package your class mediator and have a try with ESB (4.8.1) and I don't have any error, I can see

Performance Extract Started perfExtact:
Performance Extract perfFile:
mytest.txt
Performance Extract Data Gathered!

in std output

Nota : with ESB 4.9.0 (SNAPSHOT) I've had the same error as yours and need to add poi-ooxml-3.9.0.wso2v1.jar in repository/components/lib : it works like that, but I don't know if it's a good idea because you can find poi-ooxml_3.9.0.wso2v2.jar by default in repository/components/plugins

POM :

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<modelVersion>4.0.0</modelVersion>
<groupId>com.circleblack.mediator</groupId>
<artifactId>cb-esb-mediator-data</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>

<description>Mediators for processing data.</description>

<properties>
    <CApp.type>lib/synapse/mediator</CApp.type>
</properties>

    <repositories>
        <repository>
            <id>wso2-maven2-repository</id>
            <url>http://dist.wso2.org/maven2</url>
        </repository>
        <repository>
            <id>apache-Incubating-repo</id>
            <name>Maven Incubating Repository</name>
            <url>http://people.apache.org/repo/m2-incubating-repository</url>
        </repository>
        <repository>
            <id>apache-maven2-repo</id>
            <name>Apache Maven2 Repository</name>
            <url>http://repo1.maven.org/maven2/</url>
        </repository>
    </repositories>

<dependencies>
    <dependency>
        <groupId>org.apache.synapse</groupId>
        <artifactId>synapse-core</artifactId>
        <version>2.1.2-wso2v1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.axis2.wso2</groupId>
        <artifactId>axis2</artifactId>
        <version>1.6.1.wso2v10</version>
    </dependency>
    <dependency>
        <groupId>org.apache.ws.commons.axiom.wso2</groupId>
        <artifactId>axiom</artifactId>
        <version>1.2.11.wso2v4</version>
    </dependency>
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.10.1</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.10.1</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>3.10.1</version>
        <scope>compile</scope>
    </dependency>

    <!-- Tests -->
    <!--dependency>
        <groupId>com.circleblack.mediator</groupId>
        <artifactId>cb-esb-mediator-test-mockito</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
    </dependency-->
    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.6.0</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.poi.wso2</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.9.0.wso2v2</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>ooxml-schemas</artifactId>
        <version>1.1</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>stax</groupId>
        <artifactId>stax-api</artifactId>
        <version>1.0.1</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
        <type>zip</type>
        <scope>compile</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>1.4.0</version>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Bundle-SymbolicName>cb-esb-mediator-data</Bundle-SymbolicName>
                    <Bundle-Name>cb-esb-mediator-data</Bundle-Name>
                    <Export-Package>com.circleblack.mediator.data.*</Export-Package>
                    <DynamicImport-Package>*</DynamicImport-Package>
                </instructions>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>
Jean-Michel
  • 5,926
  • 1
  • 13
  • 19
  • Thanks for the attempt, not sure if you actually tested through the esb or just using some test but it hasn't worked. I am using your pom provided with the following change Replaced: 4.0.0 com.circleblack.mediator cb-esb-mediator-data 1.0.0-SNAPSHOT bundle With: com.circleblack.mediator cb-esb-mediator 1.0.0-SNAPSHOT cb-esb-mediator-data bundle – Jegsar Oct 13 '14 at 09:36
  • I've tested through the esb : I've packaged your mediator with my pom (mvn clean package), deployed it inside the esb (copy cb-esb-mediator-data-1.0.0-SNAPSHOT.jar in repository/components/lib) and injected a sample soap to my test proxy : which version of the esb are you using ? – Jean-Michel Oct 13 '14 at 09:41
  • Looking at the plugins I do see poi 3.9.0 however I see poi-ooxml_3.9.0.wso2v1 instead of poi-ooxml_3.9.0.wso2v2 What do you have in yours for ooxml? I did note that I was able to use HSSF but not XSSF HSSF wouldn't need ooxml, at least i don't think it does. – Jegsar Oct 13 '14 at 09:55
  • So I added xmlbeans, oomxml 2v2, oomxml-schemas to the plugins folder, I'm going to add more. Is there something I need to do past restarting the server for them to be used? – Jegsar Oct 13 '14 at 10:13
  • you're right, I've found the difference between your ESB 4.8.1 and mine : I've builded it myself and installed servicepack001. In this servicepack, you can find poi-ooxml-3.9.0.wso2v1.jar but if you compare it with the same jar that comes from ESB4.8.1 archive you download on wso2.com, there is 4 more packages / directories : schemarorg_apache_xmlbeans, schemasMicrosoftComOfficeExcel, schemasMicrosoftComOfficeOffice and schemasMicrosoftComVml – Jean-Michel Oct 13 '14 at 11:31
  • You should'nt add jars directly in plugins directory. You can install add-ons in lib (jdbc driver for exemple), your mediator bundle in dropins, patchs in patches/patchxxxx and service packs in servicepacks/servicepackxxx. If you add such libraries, you must restart the ESB – Jean-Michel Oct 13 '14 at 11:57
  • that sounds like it should fix it, i tried searching for the service pack but all i could find was something for 4.2.0 do you know where I can get it. Thank you! – Jegsar Oct 13 '14 at 12:08
  • Sorry, I don't think you can get it, I think you must build it yourself from source code. – Jean-Michel Oct 13 '14 at 12:37
  • In wso2 maven repo, you can find poi-ooxml-3.9.0.wso2v3.jar there : http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/poi/wso2/poi-ooxml/3.9.0.wso2v3/ this one contains required packages. I don't know if it's a good idea to use this version in ESB4.8.1 but if you want to try it, just add a directory "patch0100" for exemple under repository/components/patches, copy the jar in patch0100 and restart the ESB. If you want to undeploy it, delete patch0100 and restart... (in a test environment !!!) – Jean-Michel Oct 13 '14 at 12:49
  • So I added the jar in the patch and I see that it got put into plugins but I don't think it's being accessed as I am getting the same error. I will attempt to build the server myself later on – Jegsar Oct 13 '14 at 14:33
  • This is because this jar is named poi-ooxml_3.9.0.wso2v3 and in the ESB, you find poi-ooxml_3.9.0.wso2v1 : after applying the patch, you can find the two jars in plugins, it was a bad option, sorry. – Jean-Michel Oct 13 '14 at 15:03
0

Put all required jar files into the repository/extensions folder into the ESB_HOME and restart the wso2 ESB.

  1. dom4j-1.6.1.jar
  2. poi-3.10-FINAL.jar
  3. poi-ooxml-3.10-FINAL.jar
  4. poi-ooxml-schemas-3.10-FINAL.jar
  5. xmlbeans-2.3.0.jar
Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
  • Why are you recommending them to use an older version of Apache POI? As of writing, 3.11 is the latest stable release, and 3.12 beta 1 is the latest, see the [changelog](http://poi.apache.org/changes.html#3.10-FINAL) for all the new features and bug fixes since then! – Gagravarr Mar 12 '15 at 11:43
  • I tested it using version 3.10. That's why I write it. – user3652388 Mar 13 '15 at 13:00