You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by "Davis, Daniel" <Da...@si.edu> on 2015/04/02 01:09:18 UTC

ServiceMix, POI, and javax.xml.stream.XMLEventFactory

I have been exploring a number of configurations to install a bean that converts both an XSL and an XSLX to CSV as a bundle in ServiceMix (with Camel).  The code works correctly from command-line maven and passes my unit tests plus a Camel integration test using the Java DSL.  And the code works correctly in ServiceMix (with Camel) to convert XSL files to CSV.  But I have not been able to convert XSLT to CSV for different reasons with the various configurations.  For now I am not looking to use more advanced POI functionality just trying to solve my immediate problem, especially since the POI project has gotten very active again.

ServiceMix 5.4, Java 1.7.75, RHEL 6.x and Ubuntu 14.04
Attempted POI 3.9, 3.11 and 3.12-beta1

Tried a build using my bean and:

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

I also tried building just the bean then using exports from 3.9 and the yet to be released 3.11 bundles.

As noted above, the XSL to CSV conversion works in all of the configurations.  The XSLT conversion does not.

It seems like 3.11 is missing a jar (also reported by another user) so I concentrated on 3.9 and 3.12-beta1. With 3.9, I get a org.apache.poi.openxml4j.exceptions.InvalidFormatException when trying to convert an XSLT to CSV.

With 3.12-beta1, the issue I am facing now is: Unable to resolve 242.154: missing requirement [242.154] osgi.wiring.package; (osgi.wiring.package=javax.xml.stream.XMLEventFactory). I have looked in ServiceMix using osgi:headers including bundle 0 and I cannot find the package. I tried adding the javax.xml.stream.XMLEventFactory package to the Java 7 section of etc/jre.properties and restarting ServiceMix, but it does not show.  I have read a lot of good information online to suspect that, on the command-line, I am finding the package in the Java 7 JDK usually leading to a suggestion to modify etc/jre.properties or work with one of the Stax bundles.  But I am missing something.

Does anyone have any insight?  I am glad to supply more details but this email is already long enough.

--
Daniel Davis
Technical Manager - Office of Research Information Services
Smithsonian Institution



Re: ServiceMix, POI, and javax.xml.stream.XMLEventFactory

Posted by "Davis, Daniel" <Da...@si.edu>.
Using JB's pre-release POI servicemix bundle (org.apache.servicemix.bundles.poi-3.11.jar) fixed the ZipPackagePropertiesMarshaller and Krzysztof's suggestion about XMLEventFactory fixed the OSGI wiring.  Since using the comprehensive bundle is my preferred solution anyway, I am a happy camper.

Thanks!


On 04/02/2015 10:50 AM, Davis, Daniel wrote:

Adding  javax.xml.stream.XMLEventFactory to org.osgi.framework.system.packages.extra worked to get by the exception.  If I add javax.xml.stream.XMLEventFactory as an import to my bundle it will fail to load which I guess is not a surprise since it is a class not a package (I did not look deeply until Krzysztof's note).  I have not seen XMLEventFactory in any bundle header except when I included it as an import, which failed to be resolved I guess since its a javax class.

After getting by the XMLEventFactory exception , I am on to a second runtime exception (when converting XSLX only):

java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller

I have seen this before when using the POI 3.11 configuration and trying an XSLT transform (which only fails in ServiceMix).  It was identified as a missing class file in  http://stackoverflow.com/questions/28164609/java-lang-noclassdeffounderror-could-not-initialize-class-org-apache-poi-openxm .  But I am not so sure this posting is correct since I can make it work on the command line outside ServiceMix.  Plus the conclusion in the posting was to drop back to poi-ooxml-3.9.jar a workaround.  Now that the issues are narrowed a bit there are more postings on the ZipPackagePropertiesMarshaller exception I am reading now, though, if anyone has any insight it would certainly be appreciated.

I am going to drop to POI 3.11 and see if I can chase the ZipPackagePropertiesMarshaller in my own bundle and using JBs pre-release POI 3.11 bundle since 3.11 is the current generally available version.

If you are interested, in my own bundle with direct POI maven dependencies I am currently using the following import to get it to load in ServiceMix.  I get concerned when its this complicated.


<!-- To generate the MANIFEST-FILE of the bundle -->
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <version>2.3.7</version>
  <extensions>true</extensions>
  <configuration>
    <instructions>
      <Bundle-SymbolicName>edu.si.services.beans.excel</Bundle-SymbolicName>
      <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
      <Embed-Transitive>true</Embed-Transitive>

      <Import-Package>
        <!-- javax.xml.stream.XMLEventFactory, -->
        <!-- poi 3.12-beta1 -->
        com.sun.javadoc; resolution:=optional,
        com.sun.tools.javadoc; resolution:=optional,
        junit.framework; resolution:=optional,
        org.apache.crimson.jaxp; resolution:=optional,
        org.apache.poi.hdgf.extractor; resolution:=optional,
        org.apache.poi.hpbf.extractor; resolution:=optional,
        org.apache.poi.hslf.extractor; resolution:=optional,
        org.apache.poi.hslf.model; resolution:=optional,
        org.apache.poi.hsmf; resolution:=optional,
        org.apache.poi.hsmf.datatypes; resolution:=optional,
        org.apache.poi.hsmf.extractor; resolution:=optional,
        org.apache.poi.hwpf; resolution:=optional,
        org.apache.poi.hwpf.extractor; resolution:=optional,
        org.apache.poi.wp.usermodel; resolution:=optional,
        org.bouncycastle.asn1; resolution:=optional,
        org.bouncycastle.asn1.cmp; resolution:=optional,
        org.bouncycastle.asn1.nist; resolution:=optional,
        org.bouncycastle.asn1.ocsp; resolution:=optional,
        org.bouncycastle.asn1.x500; resolution:=optional,
        org.bouncycastle.asn1.x509; resolution:=optional,
        org.bouncycastle.cert; resolution:=optional,
        org.bouncycastle.cert.jcajce; resolution:=optional,
        org.bouncycastle.cert.ocsp; resolution:=optional,
        org.bouncycastle.cms; resolution:=optional,
        org.bouncycastle.cms.bc; resolution:=optional,
        org.bouncycastle.operator; resolution:=optional,
        org.bouncycastle.operator.bc; resolution:=optional,
        org.bouncycastle.tsp; resolution:=optional,
        org.bouncycastle.util; resolution:=optional,
        org.junit; resolution:=optional,
        org.junit.internal; resolution:=optional,
        org.junit.runner; resolution:=optional,
        org.junit.runner.notification; resolution:=optional,
        org.openxmlformats.schemas.officeDocument.x2006.math; resolution:=optional,
        org.openxmlformats.schemas.schemaLibrary.x2006.main; resolution:=optional,
        schemasMicrosoftComOfficePowerpoint; resolution:=optional,
        schemasMicrosoftComOfficeWord; resolution:=optional,

        <!-- poi 3.11 -->
        <!--
        com.sun.javadoc; resolution:=optional,
        com.sun.tools.javadoc; resolution:=optional,
        junit.framework; resolution:=optional,
        org.apache.crimson.jaxp; resolution:=optional,
        org.apache.poi.hdgf.extractor; resolution:=optional,
        org.apache.poi.hpbf.extractor; resolution:=optional,
        org.apache.poi.hslf.extractor; resolution:=optional,
        org.apache.poi.hslf.model; resolution:=optional,
        org.apache.poi.hsmf; resolution:=optional,
        org.apache.poi.hsmf.datatypes; resolution:=optional,
        org.apache.poi.hsmf.extractor; resolution:=optional,
        org.apache.poi.hwpf; resolution:=optional,
        org.apache.poi.hwpf.extractor; resolution:=optional,
        org.bouncycastle.asn1; resolution:=optional,
        org.bouncycastle.asn1.cmp; resolution:=optional,
        org.bouncycastle.asn1.nist; resolution:=optional,
        org.bouncycastle.asn1.ocsp; resolution:=optional,
        org.bouncycastle.asn1.x500; resolution:=optional,
        org.bouncycastle.asn1.x509; resolution:=optional,
        org.bouncycastle.cert; resolution:=optional,
        org.bouncycastle.cert.jcajce; resolution:=optional,
        org.bouncycastle.cert.ocsp; resolution:=optional,
        org.bouncycastle.cms; resolution:=optional,
        org.bouncycastle.cms.bc; resolution:=optional,
        org.bouncycastle.operator; resolution:=optional,
        org.bouncycastle.operator.bc; resolution:=optional,
        org.bouncycastle.tsp; resolution:=optional,
        org.bouncycastle.util; resolution:=optional,
        org.junit; resolution:=optional,
        org.junit.internal; resolution:=optional,
        org.junit.runner; resolution:=optional,
        org.junit.runner.notification; resolution:=optional,
        org.openxmlformats.schemas.officeDocument.x2006.math; resolution:=optional,
        org.openxmlformats.schemas.schemaLibrary.x2006.main; resolution:=optional,
        repackage; resolution:=optional,
        schemasMicrosoftComOfficeExcel; resolution:=optional,
        schemasMicrosoftComOfficeOffice; resolution:=optional,
        schemasMicrosoftComVml; resolution:=optional,
        schemasMicrosoftComOfficePowerpoint; resolution:=optional,
        schemasMicrosoftComOfficeWord; resolution:=optional,
        -->

        <!-- poi 3.9 -->
        <!--
        com.sun.javadoc; resolution:=optional,
        com.sun.msv.datatype; resolution:=optional,
        com.sun.msv.datatype.xsd; resolution:=optional,
        com.sun.tools.javadoc; resolution:=optional,
        junit.framework; resolution:=optional,
        junit.textui; resolution:=optional,
        org.apache.crimson.jaxp; resolution:=optional,
        org.apache.poi.hdgf.extractor; resolution:=optional,
        org.apache.poi.hpbf.extractor; resolution:=optional,
        org.apache.poi.hslf.extractor; resolution:=optional,
        org.apache.poi.hsmf; resolution:=optional,
        org.apache.poi.hsmf.datatypes; resolution:=optional,
        org.apache.poi.hsmf.extractor; resolution:=optional,
        org.apache.poi.hwpf; resolution:=optional,
        org.apache.poi.hwpf.extractor; resolution:=optional,
        org.apache.xmlbeans.impl.xpath.saxon; resolution:=optional,
        org.apache.xmlbeans.impl.xquery.saxon; resolution:=optional,
        org.gjt.xpp; resolution:=optional,
        org.jaxen; resolution:=optional,
        org.jaxen.dom4j; resolution:=optional,
        org.jaxen.pattern; resolution:=optional,
        org.jaxen.saxpath; resolution:=optional,
        org.openxmlformats.schemas.officeDocument.x2006.math; resolution:=optional,
        org.openxmlformats.schemas.schemaLibrary.x2006.main; resolution:=optional,
        org.relaxng.datatype; resolution:=optional,
        schemasMicrosoftComOfficePowerpoint; resolution:=optional,
        schemasMicrosoftComOfficeWord; resolution:=optional,
        -->

        *
      </Import-Package>
    <Export-Package>edu.si.services.beans.excel</Export-Package>
    </instructions>
  </configuration>
</plugin>

--
Dan Davis




On 04/02/2015 01:58 AM, Jean-Baptiste Onofré wrote:

It's maybe a mistake in the OSGi headers.

Can you check with bundles:headers as well ?

Regards
JB

On 04/02/2015 01:38 AM, Krzysztof Sobkowiak wrote:


Hi

I don't understand why OSGi tries to wire the   javax.xml.stream.XMLEventFactory  package. It is a class. It means, the
bundle declares from any reason wrong import.

Could you check if appending this missing "package" into org.osgi.framework.system.packages.extra parameter in
etc/custom.properties will help?

Regards
Krzysztof


On 02.04.2015 01:09, Davis, Daniel wrote:


I have been exploring a number of configurations to install a bean that converts both an XSL and an XSLX to CSV as a bundle in ServiceMix (with Camel).  The code works correctly from command-line maven and passes my unit tests plus a Camel integration test using the Java DSL.  And the code works correctly in ServiceMix (with Camel) to convert XSL files to CSV.  But I have not been able to convert XSLT to CSV for different reasons with the various configurations.  For now I am not looking to use more advanced POI functionality just trying to solve my immediate problem, especially since the POI project has gotten very active again.

ServiceMix 5.4, Java 1.7.75, RHEL 6.x and Ubuntu 14.04
Attempted POI 3.9, 3.11 and 3.12-beta1

Tried a build using my bean and:

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

I also tried building just the bean then using exports from 3.9 and the yet to be released 3.11 bundles.

As noted above, the XSL to CSV conversion works in all of the configurations.  The XSLT conversion does not.

It seems like 3.11 is missing a jar (also reported by another user) so I concentrated on 3.9 and 3.12-beta1. With 3.9, I get a org.apache.poi.openxml4j.exceptions.InvalidFormatException when trying to convert an XSLT to CSV.

With 3.12-beta1, the issue I am facing now is: Unable to resolve 242.154: missing requirement [242.154] osgi.wiring.package; (osgi.wiring.package=javax.xml.stream.XMLEventFactory). I have looked in ServiceMix using osgi:headers including bundle 0 and I cannot find the package. I tried adding the javax.xml.stream.XMLEventFactory package to the Java 7 section of etc/jre.properties and restarting ServiceMix, but it does not show.  I have read a lot of good information online to suspect that, on the command-line, I am finding the package in the Java 7 JDK usually leading to a suggestion to modify etc/jre.properties or work with one of the Stax bundles.  But I am missing something.

Does anyone have any insight?  I am glad to supply more details but this email is already long enough.

--
Daniel Davis
Technical Manager - Office of Research Information Services
Smithsonian Institution















Re: ServiceMix, POI, and javax.xml.stream.XMLEventFactory

Posted by "Davis, Daniel" <Da...@si.edu>.
More info.

Using POI 3.11, I get the following exception:

java.lang.NoSuchMethodError: javax.xml.stream.XMLEventFactory.newFactory()Ljavax/xml/stream/XMLEventFactory;

The execution seems to be finding the class and, in Oracle Java 7, newFactory is a method of the class.  I verified that ServiceMix is running in Java(TM) SE Runtime Environment(build 1.7.0_72-b14) Java HotSpot(TM) 64-Bit Server VM(build 24.72-b04, mixed mode) - actually the JDK.

--
Dan Davis

On 04/02/2015 10:50 AM, Davis, Daniel wrote:

Adding  javax.xml.stream.XMLEventFactory to org.osgi.framework.system.packages.extra worked to get by the exception.  If I add javax.xml.stream.XMLEventFactory as an import to my bundle it will fail to load which I guess is not a surprise since it is a class not a package (I did not look deeply until Krzysztof's note).  I have not seen XMLEventFactory in any bundle header except when I included it as an import, which failed to be resolved I guess since its a javax class.

After getting by the XMLEventFactory exception , I am on to a second runtime exception (when converting XSLX only):

java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller

I have seen this before when using the POI 3.11 configuration and trying an XSLT transform (which only fails in ServiceMix).  It was identified as a missing class file in  http://stackoverflow.com/questions/28164609/java-lang-noclassdeffounderror-could-not-initialize-class-org-apache-poi-openxm .  But I am not so sure this posting is correct since I can make it work on the command line outside ServiceMix.  Plus the conclusion in the posting was to drop back to poi-ooxml-3.9.jar a workaround.  Now that the issues are narrowed a bit there are more postings on the ZipPackagePropertiesMarshaller exception I am reading now, though, if anyone has any insight it would certainly be appreciated.

I am going to drop to POI 3.11 and see if I can chase the ZipPackagePropertiesMarshaller in my own bundle and using JBs pre-release POI 3.11 bundle since 3.11 is the current generally available version.

If you are interested, in my own bundle with direct POI maven dependencies I am currently using the following import to get it to load in ServiceMix.  I get concerned when its this complicated.


<!-- To generate the MANIFEST-FILE of the bundle -->
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <version>2.3.7</version>
  <extensions>true</extensions>
  <configuration>
    <instructions>
      <Bundle-SymbolicName>edu.si.services.beans.excel</Bundle-SymbolicName>
      <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
      <Embed-Transitive>true</Embed-Transitive>

      <Import-Package>
        <!-- javax.xml.stream.XMLEventFactory, -->
        <!-- poi 3.12-beta1 -->
        com.sun.javadoc; resolution:=optional,
        com.sun.tools.javadoc; resolution:=optional,
        junit.framework; resolution:=optional,
        org.apache.crimson.jaxp; resolution:=optional,
        org.apache.poi.hdgf.extractor; resolution:=optional,
        org.apache.poi.hpbf.extractor; resolution:=optional,
        org.apache.poi.hslf.extractor; resolution:=optional,
        org.apache.poi.hslf.model; resolution:=optional,
        org.apache.poi.hsmf; resolution:=optional,
        org.apache.poi.hsmf.datatypes; resolution:=optional,
        org.apache.poi.hsmf.extractor; resolution:=optional,
        org.apache.poi.hwpf; resolution:=optional,
        org.apache.poi.hwpf.extractor; resolution:=optional,
        org.apache.poi.wp.usermodel; resolution:=optional,
        org.bouncycastle.asn1; resolution:=optional,
        org.bouncycastle.asn1.cmp; resolution:=optional,
        org.bouncycastle.asn1.nist; resolution:=optional,
        org.bouncycastle.asn1.ocsp; resolution:=optional,
        org.bouncycastle.asn1.x500; resolution:=optional,
        org.bouncycastle.asn1.x509; resolution:=optional,
        org.bouncycastle.cert; resolution:=optional,
        org.bouncycastle.cert.jcajce; resolution:=optional,
        org.bouncycastle.cert.ocsp; resolution:=optional,
        org.bouncycastle.cms; resolution:=optional,
        org.bouncycastle.cms.bc; resolution:=optional,
        org.bouncycastle.operator; resolution:=optional,
        org.bouncycastle.operator.bc; resolution:=optional,
        org.bouncycastle.tsp; resolution:=optional,
        org.bouncycastle.util; resolution:=optional,
        org.junit; resolution:=optional,
        org.junit.internal; resolution:=optional,
        org.junit.runner; resolution:=optional,
        org.junit.runner.notification; resolution:=optional,
        org.openxmlformats.schemas.officeDocument.x2006.math; resolution:=optional,
        org.openxmlformats.schemas.schemaLibrary.x2006.main; resolution:=optional,
        schemasMicrosoftComOfficePowerpoint; resolution:=optional,
        schemasMicrosoftComOfficeWord; resolution:=optional,

        <!-- poi 3.11 -->
        <!--
        com.sun.javadoc; resolution:=optional,
        com.sun.tools.javadoc; resolution:=optional,
        junit.framework; resolution:=optional,
        org.apache.crimson.jaxp; resolution:=optional,
        org.apache.poi.hdgf.extractor; resolution:=optional,
        org.apache.poi.hpbf.extractor; resolution:=optional,
        org.apache.poi.hslf.extractor; resolution:=optional,
        org.apache.poi.hslf.model; resolution:=optional,
        org.apache.poi.hsmf; resolution:=optional,
        org.apache.poi.hsmf.datatypes; resolution:=optional,
        org.apache.poi.hsmf.extractor; resolution:=optional,
        org.apache.poi.hwpf; resolution:=optional,
        org.apache.poi.hwpf.extractor; resolution:=optional,
        org.bouncycastle.asn1; resolution:=optional,
        org.bouncycastle.asn1.cmp; resolution:=optional,
        org.bouncycastle.asn1.nist; resolution:=optional,
        org.bouncycastle.asn1.ocsp; resolution:=optional,
        org.bouncycastle.asn1.x500; resolution:=optional,
        org.bouncycastle.asn1.x509; resolution:=optional,
        org.bouncycastle.cert; resolution:=optional,
        org.bouncycastle.cert.jcajce; resolution:=optional,
        org.bouncycastle.cert.ocsp; resolution:=optional,
        org.bouncycastle.cms; resolution:=optional,
        org.bouncycastle.cms.bc; resolution:=optional,
        org.bouncycastle.operator; resolution:=optional,
        org.bouncycastle.operator.bc; resolution:=optional,
        org.bouncycastle.tsp; resolution:=optional,
        org.bouncycastle.util; resolution:=optional,
        org.junit; resolution:=optional,
        org.junit.internal; resolution:=optional,
        org.junit.runner; resolution:=optional,
        org.junit.runner.notification; resolution:=optional,
        org.openxmlformats.schemas.officeDocument.x2006.math; resolution:=optional,
        org.openxmlformats.schemas.schemaLibrary.x2006.main; resolution:=optional,
        repackage; resolution:=optional,
        schemasMicrosoftComOfficeExcel; resolution:=optional,
        schemasMicrosoftComOfficeOffice; resolution:=optional,
        schemasMicrosoftComVml; resolution:=optional,
        schemasMicrosoftComOfficePowerpoint; resolution:=optional,
        schemasMicrosoftComOfficeWord; resolution:=optional,
        -->

        <!-- poi 3.9 -->
        <!--
        com.sun.javadoc; resolution:=optional,
        com.sun.msv.datatype; resolution:=optional,
        com.sun.msv.datatype.xsd; resolution:=optional,
        com.sun.tools.javadoc; resolution:=optional,
        junit.framework; resolution:=optional,
        junit.textui; resolution:=optional,
        org.apache.crimson.jaxp; resolution:=optional,
        org.apache.poi.hdgf.extractor; resolution:=optional,
        org.apache.poi.hpbf.extractor; resolution:=optional,
        org.apache.poi.hslf.extractor; resolution:=optional,
        org.apache.poi.hsmf; resolution:=optional,
        org.apache.poi.hsmf.datatypes; resolution:=optional,
        org.apache.poi.hsmf.extractor; resolution:=optional,
        org.apache.poi.hwpf; resolution:=optional,
        org.apache.poi.hwpf.extractor; resolution:=optional,
        org.apache.xmlbeans.impl.xpath.saxon; resolution:=optional,
        org.apache.xmlbeans.impl.xquery.saxon; resolution:=optional,
        org.gjt.xpp; resolution:=optional,
        org.jaxen; resolution:=optional,
        org.jaxen.dom4j; resolution:=optional,
        org.jaxen.pattern; resolution:=optional,
        org.jaxen.saxpath; resolution:=optional,
        org.openxmlformats.schemas.officeDocument.x2006.math; resolution:=optional,
        org.openxmlformats.schemas.schemaLibrary.x2006.main; resolution:=optional,
        org.relaxng.datatype; resolution:=optional,
        schemasMicrosoftComOfficePowerpoint; resolution:=optional,
        schemasMicrosoftComOfficeWord; resolution:=optional,
        -->

        *
      </Import-Package>
    <Export-Package>edu.si.services.beans.excel</Export-Package>
    </instructions>
  </configuration>
</plugin>

--
Dan Davis




On 04/02/2015 01:58 AM, Jean-Baptiste Onofré wrote:

It's maybe a mistake in the OSGi headers.

Can you check with bundles:headers as well ?

Regards
JB

On 04/02/2015 01:38 AM, Krzysztof Sobkowiak wrote:


Hi

I don't understand why OSGi tries to wire the   javax.xml.stream.XMLEventFactory  package. It is a class. It means, the
bundle declares from any reason wrong import.

Could you check if appending this missing "package" into org.osgi.framework.system.packages.extra parameter in
etc/custom.properties will help?

Regards
Krzysztof


On 02.04.2015 01:09, Davis, Daniel wrote:


I have been exploring a number of configurations to install a bean that converts both an XSL and an XSLX to CSV as a bundle in ServiceMix (with Camel).  The code works correctly from command-line maven and passes my unit tests plus a Camel integration test using the Java DSL.  And the code works correctly in ServiceMix (with Camel) to convert XSL files to CSV.  But I have not been able to convert XSLT to CSV for different reasons with the various configurations.  For now I am not looking to use more advanced POI functionality just trying to solve my immediate problem, especially since the POI project has gotten very active again.

ServiceMix 5.4, Java 1.7.75, RHEL 6.x and Ubuntu 14.04
Attempted POI 3.9, 3.11 and 3.12-beta1

Tried a build using my bean and:

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

I also tried building just the bean then using exports from 3.9 and the yet to be released 3.11 bundles.

As noted above, the XSL to CSV conversion works in all of the configurations.  The XSLT conversion does not.

It seems like 3.11 is missing a jar (also reported by another user) so I concentrated on 3.9 and 3.12-beta1. With 3.9, I get a org.apache.poi.openxml4j.exceptions.InvalidFormatException when trying to convert an XSLT to CSV.

With 3.12-beta1, the issue I am facing now is: Unable to resolve 242.154: missing requirement [242.154] osgi.wiring.package; (osgi.wiring.package=javax.xml.stream.XMLEventFactory). I have looked in ServiceMix using osgi:headers including bundle 0 and I cannot find the package. I tried adding the javax.xml.stream.XMLEventFactory package to the Java 7 section of etc/jre.properties and restarting ServiceMix, but it does not show.  I have read a lot of good information online to suspect that, on the command-line, I am finding the package in the Java 7 JDK usually leading to a suggestion to modify etc/jre.properties or work with one of the Stax bundles.  But I am missing something.

Does anyone have any insight?  I am glad to supply more details but this email is already long enough.

--
Daniel Davis
Technical Manager - Office of Research Information Services
Smithsonian Institution















Re: ServiceMix, POI, and javax.xml.stream.XMLEventFactory

Posted by "Davis, Daniel" <Da...@si.edu>.
Adding  javax.xml.stream.XMLEventFactory to org.osgi.framework.system.packages.extra worked to get by the exception.  If I add javax.xml.stream.XMLEventFactory as an import to my bundle it will fail to load which I guess is not a surprise since it is a class not a package (I did not look deeply until Krzysztof's note).  I have not seen XMLEventFactory in any bundle header except when I included it as an import, which failed to be resolved I guess since its a javax class.

After getting by the XMLEventFactory exception , I am on to a second runtime exception (when converting XSLX only):

java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller

I have seen this before when using the POI 3.11 configuration and trying an XSLT transform (which only fails in ServiceMix).  It was identified as a missing class file in  http://stackoverflow.com/questions/28164609/java-lang-noclassdeffounderror-could-not-initialize-class-org-apache-poi-openxm .  But I am not so sure this posting is correct since I can make it work on the command line outside ServiceMix.  Plus the conclusion in the posting was to drop back to poi-ooxml-3.9.jar a workaround.  Now that the issues are narrowed a bit there are more postings on the ZipPackagePropertiesMarshaller exception I am reading now, though, if anyone has any insight it would certainly be appreciated.

I am going to drop to POI 3.11 and see if I can chase the ZipPackagePropertiesMarshaller in my own bundle and using JBs pre-release POI 3.11 bundle since 3.11 is the current generally available version.

If you are interested, in my own bundle with direct POI maven dependencies I am currently using the following import to get it to load in ServiceMix.  I get concerned when its this complicated.


<!-- To generate the MANIFEST-FILE of the bundle -->
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <version>2.3.7</version>
  <extensions>true</extensions>
  <configuration>
    <instructions>
      <Bundle-SymbolicName>edu.si.services.beans.excel</Bundle-SymbolicName>
      <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
      <Embed-Transitive>true</Embed-Transitive>

      <Import-Package>
        <!-- javax.xml.stream.XMLEventFactory, -->
        <!-- poi 3.12-beta1 -->
        com.sun.javadoc; resolution:=optional,
        com.sun.tools.javadoc; resolution:=optional,
        junit.framework; resolution:=optional,
        org.apache.crimson.jaxp; resolution:=optional,
        org.apache.poi.hdgf.extractor; resolution:=optional,
        org.apache.poi.hpbf.extractor; resolution:=optional,
        org.apache.poi.hslf.extractor; resolution:=optional,
        org.apache.poi.hslf.model; resolution:=optional,
        org.apache.poi.hsmf; resolution:=optional,
        org.apache.poi.hsmf.datatypes; resolution:=optional,
        org.apache.poi.hsmf.extractor; resolution:=optional,
        org.apache.poi.hwpf; resolution:=optional,
        org.apache.poi.hwpf.extractor; resolution:=optional,
        org.apache.poi.wp.usermodel; resolution:=optional,
        org.bouncycastle.asn1; resolution:=optional,
        org.bouncycastle.asn1.cmp; resolution:=optional,
        org.bouncycastle.asn1.nist; resolution:=optional,
        org.bouncycastle.asn1.ocsp; resolution:=optional,
        org.bouncycastle.asn1.x500; resolution:=optional,
        org.bouncycastle.asn1.x509; resolution:=optional,
        org.bouncycastle.cert; resolution:=optional,
        org.bouncycastle.cert.jcajce; resolution:=optional,
        org.bouncycastle.cert.ocsp; resolution:=optional,
        org.bouncycastle.cms; resolution:=optional,
        org.bouncycastle.cms.bc; resolution:=optional,
        org.bouncycastle.operator; resolution:=optional,
        org.bouncycastle.operator.bc; resolution:=optional,
        org.bouncycastle.tsp; resolution:=optional,
        org.bouncycastle.util; resolution:=optional,
        org.junit; resolution:=optional,
        org.junit.internal; resolution:=optional,
        org.junit.runner; resolution:=optional,
        org.junit.runner.notification; resolution:=optional,
        org.openxmlformats.schemas.officeDocument.x2006.math; resolution:=optional,
        org.openxmlformats.schemas.schemaLibrary.x2006.main; resolution:=optional,
        schemasMicrosoftComOfficePowerpoint; resolution:=optional,
        schemasMicrosoftComOfficeWord; resolution:=optional,

        <!-- poi 3.11 -->
        <!--
        com.sun.javadoc; resolution:=optional,
        com.sun.tools.javadoc; resolution:=optional,
        junit.framework; resolution:=optional,
        org.apache.crimson.jaxp; resolution:=optional,
        org.apache.poi.hdgf.extractor; resolution:=optional,
        org.apache.poi.hpbf.extractor; resolution:=optional,
        org.apache.poi.hslf.extractor; resolution:=optional,
        org.apache.poi.hslf.model; resolution:=optional,
        org.apache.poi.hsmf; resolution:=optional,
        org.apache.poi.hsmf.datatypes; resolution:=optional,
        org.apache.poi.hsmf.extractor; resolution:=optional,
        org.apache.poi.hwpf; resolution:=optional,
        org.apache.poi.hwpf.extractor; resolution:=optional,
        org.bouncycastle.asn1; resolution:=optional,
        org.bouncycastle.asn1.cmp; resolution:=optional,
        org.bouncycastle.asn1.nist; resolution:=optional,
        org.bouncycastle.asn1.ocsp; resolution:=optional,
        org.bouncycastle.asn1.x500; resolution:=optional,
        org.bouncycastle.asn1.x509; resolution:=optional,
        org.bouncycastle.cert; resolution:=optional,
        org.bouncycastle.cert.jcajce; resolution:=optional,
        org.bouncycastle.cert.ocsp; resolution:=optional,
        org.bouncycastle.cms; resolution:=optional,
        org.bouncycastle.cms.bc; resolution:=optional,
        org.bouncycastle.operator; resolution:=optional,
        org.bouncycastle.operator.bc; resolution:=optional,
        org.bouncycastle.tsp; resolution:=optional,
        org.bouncycastle.util; resolution:=optional,
        org.junit; resolution:=optional,
        org.junit.internal; resolution:=optional,
        org.junit.runner; resolution:=optional,
        org.junit.runner.notification; resolution:=optional,
        org.openxmlformats.schemas.officeDocument.x2006.math; resolution:=optional,
        org.openxmlformats.schemas.schemaLibrary.x2006.main; resolution:=optional,
        repackage; resolution:=optional,
        schemasMicrosoftComOfficeExcel; resolution:=optional,
        schemasMicrosoftComOfficeOffice; resolution:=optional,
        schemasMicrosoftComVml; resolution:=optional,
        schemasMicrosoftComOfficePowerpoint; resolution:=optional,
        schemasMicrosoftComOfficeWord; resolution:=optional,
        -->

        <!-- poi 3.9 -->
        <!--
        com.sun.javadoc; resolution:=optional,
        com.sun.msv.datatype; resolution:=optional,
        com.sun.msv.datatype.xsd; resolution:=optional,
        com.sun.tools.javadoc; resolution:=optional,
        junit.framework; resolution:=optional,
        junit.textui; resolution:=optional,
        org.apache.crimson.jaxp; resolution:=optional,
        org.apache.poi.hdgf.extractor; resolution:=optional,
        org.apache.poi.hpbf.extractor; resolution:=optional,
        org.apache.poi.hslf.extractor; resolution:=optional,
        org.apache.poi.hsmf; resolution:=optional,
        org.apache.poi.hsmf.datatypes; resolution:=optional,
        org.apache.poi.hsmf.extractor; resolution:=optional,
        org.apache.poi.hwpf; resolution:=optional,
        org.apache.poi.hwpf.extractor; resolution:=optional,
        org.apache.xmlbeans.impl.xpath.saxon; resolution:=optional,
        org.apache.xmlbeans.impl.xquery.saxon; resolution:=optional,
        org.gjt.xpp; resolution:=optional,
        org.jaxen; resolution:=optional,
        org.jaxen.dom4j; resolution:=optional,
        org.jaxen.pattern; resolution:=optional,
        org.jaxen.saxpath; resolution:=optional,
        org.openxmlformats.schemas.officeDocument.x2006.math; resolution:=optional,
        org.openxmlformats.schemas.schemaLibrary.x2006.main; resolution:=optional,
        org.relaxng.datatype; resolution:=optional,
        schemasMicrosoftComOfficePowerpoint; resolution:=optional,
        schemasMicrosoftComOfficeWord; resolution:=optional,
        -->

        *
      </Import-Package>
    <Export-Package>edu.si.services.beans.excel</Export-Package>
    </instructions>
  </configuration>
</plugin>

--
Dan Davis




On 04/02/2015 01:58 AM, Jean-Baptiste Onofré wrote:

It's maybe a mistake in the OSGi headers.

Can you check with bundles:headers as well ?

Regards
JB

On 04/02/2015 01:38 AM, Krzysztof Sobkowiak wrote:


Hi

I don't understand why OSGi tries to wire the   javax.xml.stream.XMLEventFactory  package. It is a class. It means, the
bundle declares from any reason wrong import.

Could you check if appending this missing "package" into org.osgi.framework.system.packages.extra parameter in
etc/custom.properties will help?

Regards
Krzysztof


On 02.04.2015 01:09, Davis, Daniel wrote:


I have been exploring a number of configurations to install a bean that converts both an XSL and an XSLX to CSV as a bundle in ServiceMix (with Camel).  The code works correctly from command-line maven and passes my unit tests plus a Camel integration test using the Java DSL.  And the code works correctly in ServiceMix (with Camel) to convert XSL files to CSV.  But I have not been able to convert XSLT to CSV for different reasons with the various configurations.  For now I am not looking to use more advanced POI functionality just trying to solve my immediate problem, especially since the POI project has gotten very active again.

ServiceMix 5.4, Java 1.7.75, RHEL 6.x and Ubuntu 14.04
Attempted POI 3.9, 3.11 and 3.12-beta1

Tried a build using my bean and:

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.12-beta1</version>
<scope>compile</scope>
</dependency>

I also tried building just the bean then using exports from 3.9 and the yet to be released 3.11 bundles.

As noted above, the XSL to CSV conversion works in all of the configurations.  The XSLT conversion does not.

It seems like 3.11 is missing a jar (also reported by another user) so I concentrated on 3.9 and 3.12-beta1. With 3.9, I get a org.apache.poi.openxml4j.exceptions.InvalidFormatException when trying to convert an XSLT to CSV.

With 3.12-beta1, the issue I am facing now is: Unable to resolve 242.154: missing requirement [242.154] osgi.wiring.package; (osgi.wiring.package=javax.xml.stream.XMLEventFactory). I have looked in ServiceMix using osgi:headers including bundle 0 and I cannot find the package. I tried adding the javax.xml.stream.XMLEventFactory package to the Java 7 section of etc/jre.properties and restarting ServiceMix, but it does not show.  I have read a lot of good information online to suspect that, on the command-line, I am finding the package in the Java 7 JDK usually leading to a suggestion to modify etc/jre.properties or work with one of the Stax bundles.  But I am missing something.

Does anyone have any insight?  I am glad to supply more details but this email is already long enough.

--
Daniel Davis
Technical Manager - Office of Research Information Services
Smithsonian Institution












Re: ServiceMix, POI, and javax.xml.stream.XMLEventFactory

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
It's maybe a mistake in the OSGi headers.

Can you check with bundles:headers as well ?

Regards
JB

On 04/02/2015 01:38 AM, Krzysztof Sobkowiak wrote:
> Hi
>
> I don't understand why OSGi tries to wire the   javax.xml.stream.XMLEventFactory  package. It is a class. It means, the
> bundle declares from any reason wrong import.
>
> Could you check if appending this missing "package" into org.osgi.framework.system.packages.extra parameter in
> etc/custom.properties will help?
>
> Regards
> Krzysztof
>
>
> On 02.04.2015 01:09, Davis, Daniel wrote:
>> I have been exploring a number of configurations to install a bean that converts both an XSL and an XSLX to CSV as a bundle in ServiceMix (with Camel).  The code works correctly from command-line maven and passes my unit tests plus a Camel integration test using the Java DSL.  And the code works correctly in ServiceMix (with Camel) to convert XSL files to CSV.  But I have not been able to convert XSLT to CSV for different reasons with the various configurations.  For now I am not looking to use more advanced POI functionality just trying to solve my immediate problem, especially since the POI project has gotten very active again.
>>
>> ServiceMix 5.4, Java 1.7.75, RHEL 6.x and Ubuntu 14.04
>> Attempted POI 3.9, 3.11 and 3.12-beta1
>>
>> Tried a build using my bean and:
>>
>> <dependency>
>> <groupId>org.apache.poi</groupId>
>> <artifactId>poi</artifactId>
>> <version>3.12-beta1</version>
>> <scope>compile</scope>
>> </dependency>
>>
>> <dependency>
>> <groupId>org.apache.poi</groupId>
>> <artifactId>poi-ooxml</artifactId>
>> <version>3.12-beta1</version>
>> <scope>compile</scope>
>> </dependency>
>>
>> <dependency>
>> <groupId>org.apache.poi</groupId>
>> <artifactId>poi-ooxml-schemas</artifactId>
>> <version>3.12-beta1</version>
>> <scope>compile</scope>
>> </dependency>
>>
>> I also tried building just the bean then using exports from 3.9 and the yet to be released 3.11 bundles.
>>
>> As noted above, the XSL to CSV conversion works in all of the configurations.  The XSLT conversion does not.
>>
>> It seems like 3.11 is missing a jar (also reported by another user) so I concentrated on 3.9 and 3.12-beta1. With 3.9, I get a org.apache.poi.openxml4j.exceptions.InvalidFormatException when trying to convert an XSLT to CSV.
>>
>> With 3.12-beta1, the issue I am facing now is: Unable to resolve 242.154: missing requirement [242.154] osgi.wiring.package; (osgi.wiring.package=javax.xml.stream.XMLEventFactory). I have looked in ServiceMix using osgi:headers including bundle 0 and I cannot find the package. I tried adding the javax.xml.stream.XMLEventFactory package to the Java 7 section of etc/jre.properties and restarting ServiceMix, but it does not show.  I have read a lot of good information online to suspect that, on the command-line, I am finding the package in the Java 7 JDK usually leading to a suggestion to modify etc/jre.properties or work with one of the Stax bundles.  But I am missing something.
>>
>> Does anyone have any insight?  I am glad to supply more details but this email is already long enough.
>>
>> --
>> Daniel Davis
>> Technical Manager - Office of Research Information Services
>> Smithsonian Institution
>>
>>
>>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: ServiceMix, POI, and javax.xml.stream.XMLEventFactory

Posted by Krzysztof Sobkowiak <kr...@gmail.com>.
Hi

I don't understand why OSGi tries to wire the   javax.xml.stream.XMLEventFactory  package. It is a class. It means, the
bundle declares from any reason wrong import.

Could you check if appending this missing "package" into org.osgi.framework.system.packages.extra parameter in
etc/custom.properties will help?

Regards
Krzysztof

 
On 02.04.2015 01:09, Davis, Daniel wrote:
> I have been exploring a number of configurations to install a bean that converts both an XSL and an XSLX to CSV as a bundle in ServiceMix (with Camel).  The code works correctly from command-line maven and passes my unit tests plus a Camel integration test using the Java DSL.  And the code works correctly in ServiceMix (with Camel) to convert XSL files to CSV.  But I have not been able to convert XSLT to CSV for different reasons with the various configurations.  For now I am not looking to use more advanced POI functionality just trying to solve my immediate problem, especially since the POI project has gotten very active again.
>
> ServiceMix 5.4, Java 1.7.75, RHEL 6.x and Ubuntu 14.04
> Attempted POI 3.9, 3.11 and 3.12-beta1
>
> Tried a build using my bean and:
>
> <dependency>
> <groupId>org.apache.poi</groupId>
> <artifactId>poi</artifactId>
> <version>3.12-beta1</version>
> <scope>compile</scope>
> </dependency>
>
> <dependency>
> <groupId>org.apache.poi</groupId>
> <artifactId>poi-ooxml</artifactId>
> <version>3.12-beta1</version>
> <scope>compile</scope>
> </dependency>
>
> <dependency>
> <groupId>org.apache.poi</groupId>
> <artifactId>poi-ooxml-schemas</artifactId>
> <version>3.12-beta1</version>
> <scope>compile</scope>
> </dependency>
>
> I also tried building just the bean then using exports from 3.9 and the yet to be released 3.11 bundles.
>
> As noted above, the XSL to CSV conversion works in all of the configurations.  The XSLT conversion does not.
>
> It seems like 3.11 is missing a jar (also reported by another user) so I concentrated on 3.9 and 3.12-beta1. With 3.9, I get a org.apache.poi.openxml4j.exceptions.InvalidFormatException when trying to convert an XSLT to CSV.
>
> With 3.12-beta1, the issue I am facing now is: Unable to resolve 242.154: missing requirement [242.154] osgi.wiring.package; (osgi.wiring.package=javax.xml.stream.XMLEventFactory). I have looked in ServiceMix using osgi:headers including bundle 0 and I cannot find the package. I tried adding the javax.xml.stream.XMLEventFactory package to the Java 7 section of etc/jre.properties and restarting ServiceMix, but it does not show.  I have read a lot of good information online to suspect that, on the command-line, I am finding the package in the Java 7 JDK usually leading to a suggestion to modify etc/jre.properties or work with one of the Stax bundles.  But I am missing something.
>
> Does anyone have any insight?  I am glad to supply more details but this email is already long enough.
>
> --
> Daniel Davis
> Technical Manager - Office of Research Information Services
> Smithsonian Institution
>
>
>

-- 
Krzysztof Sobkowiak

JEE & OSS Architect
Apache Software Foundation Member
Apache ServiceMix <http://servicemix.apache.org/> Committer & PMC
Senior Solution Architect @ Capgemini SSC <http://www.pl.capgemini-sdm.com/en/>