Using Aspose in an OSGi Environment

We are trying to use the Aspose libraries in an OSGi environment and we have run into an problem with Aspose Cells 7.3.4 and its use of the WoodStox StAX parser. Somewhere in the process of opening an Excel 2010 (.xlsx) file Aspose uses the following class from WoodStox com.ctc.wstx.sr.ValidatingStreamReader. In an OSGi environment this class is a private class and cannot be used. OSGi works by exposing available packages in a jar in the jar file’s MANIFEST.MF file. The WoodStox jar file lists the com.ctc.wstx.sr package as private and that means no other class in OSGi can use it classes of which ValidatingStreamReader. WoodStox only exposes the following packages to an OSGi environment:



com.ctc.wstx.msv

com.ctc.wstx.osgi

com.ctc.wstx.api

com.ctc.wstx.stax

com.ctc.wstx.sax



Is there an analogous class in one of the above packages that could be used. According the WoodStox JavaDoc the public API is in the com.ctc.wstx.api package.



I have another question also about Aspose and OSGi. To effectively use Aspose in an OSGi environment we would need to make the Aspose jar file OSGi aware. This means adding OSGi specific information to the MANIFEST.MF files inside the Aspose jar files. Does Aspose license agreement we have allow to make those changes? We would not be touching and of the class files, we just need to add a few new entires to the manifest file.



Thanks, Ian.

Hi,

Thanks for using Aspose.Cells for Java.

We have logged the investigation ticket for this issue in our database with the issue id: CELLSJAVA-40391.

Once, we will have some update for you, we will let you know asap.

Hi,

Thanks for using Aspose.Cells.

1. For the used APIs of Woodstox, we are afraid currently you have to expose all used packages to OSGi enviornment. We are also doing investigation now to check whether we can make our own XML parser to replace Woodstox, if yes then this issue may be removed completely in later versions of aspose.cells. However, it is a complicated task for us and we are afraid we cannot finish it very soon. We will also inform you when we have any news of it.

2. For the modification of MANIFEST.MF, we need to discuss it with corresponding department of our company. When we get any response or confirmation, we will let you know.

Hi,

we are also planning to use Aspose.Cells in an OSGi setting. Are there any plans for the near future to publish a version containing OSGi metadata?
What is the current state of your discussions regarding the permission for your clients to add this metadata?

Best regards,
Jens

Hi,

Thanks for your posting and using Aspose.Cells.

We do not have any update regarding this issue. However we have requested the development team to provide update regarding this. Once, we will get any update, we will share it with you asap.

Hi,

Thanks for using Aspose.Cells for Java.

We have implemented our xml parser and remove the dependency of woodstox library.

Please download and try the latest version: Aspose.Cells for Java 7.5.0.

Hi,

we will have to use Aspose.Cells quite soon. We have experimented with generating OSGi metadata on our own using SpringSource’s Bundlor tool. This works fine in our test environment. Could you please confirm that we are allowed to follow this path for production?

Of course, for future releases vendor provided OSGi metadata would be helpful.

Regards, Jens

Hi Jens,

Thanks for your posting and using Aspose.Cells for Java.

We have logged your comments in our database for consideration. We will look into it and update you. Please spare us some time. Once, we will have some some update for you regarding this issue, we will let you know asap.

Hi Jens,

Thanks for your posting and using Aspose.Cells for Java.

We are not sure what’s the problem you are facing by using the recent version of
aspose.cells with OSGi? The issue with WoodStox should have been removed
with our recent versions/fixes. Please give us more details
about your problems with new cells version.

Hi Shakeel,

your download contains plain jar files. For use in OSGi we need some additional metadata (such as Import-Package, Export-Package, Bundle-SymbolicName, Bundle-Version) in the manifest file (META-INF/Manifest.MF).
There are two alternatives for dealing with this situation:
1) Vendor-provided OSGi metadata
Due to the steadyly growing acceptance it might make sense that you provide OSGi metadata in your standard distribution. All customers would benefit from this feature.

2) Customer-generated OSGi metadata
Customers such as our company or Ian’s (who initiated this thread) take your plain jar files and generate metadata on our own. This is no rocket science. So we could live with this solution. There is just a minor legal issue: We have to modify your jar files by enriching the manifest file as described above. All the other content of the jar file, in particular .class files, will not be changed. Both Ian’s and our company seem to be confused wether your licence allows for this kind of manipulations.

Best regards, Jens

Hi Jens,

Thank you for providing more details regarding your requirements. We will soon look into them and respond to you accordingly. Please spare us little time to analyze it on our end.

Hi,

Thanks for your posting and using Aspose.Cells for Java.

Please download and try the latest version: Aspose.Cells for Java v7.6.0.4.

We have added some attributes for you in the manifest of the released jar:
Export-Package, Bundle-Name, Bundle-Vendor, Bundle-Version, Bundle-SymbolicName.
Hope it can fit you requirement.

Hi Shakeel,


I’ve tried the new jar file in our OSGi environment and the Manifest.MF file is missing the Import-Package section with external classes that Aspose Cells requires. In my environment adding these packages make my code work:

javax.imageio,
javax.imageio.metadata,
javax.imageio.stream,
javax.xml.namespace,
javax.xml.parsers,
javax.xml.stream,
javax.xml.transform,
org.dom4j,
org.dom4j.io,
org.w3c.dom,
org.xml.sax,
org.xml.sax.helpers

There are probably more packages that need to be listed as I only use a small portion of the Aspose Cells functionality. The Bnd Tool (http://www.aqute.biz/Bnd/Bnd) should be able to help figure out which packages need to be imported.

Also are there any plans to update the other libraries (e.g. Aspose Words, Aspose Slides, etc) with OSGi manifest information, I use those as well.

Thanks, Ian.

Hi Ian,

Thanks for your posting and using Aspose.Cells for Java.

We have logged your comment in our database for consideration. We will look into it and update you. Please spare us some time. Once, we will have some fix or update for you, we will let you know asap.

For plans relating to other Aspose components like Aspose.Words, Aspose.Slides etc, you need to post your query in their respective forums. You can find their forums from this link.

https://forum.aspose.com
http://www.aspose.com/community/forums/aspose.words-product-family/75/showforum.aspx
http://www.aspose.com/community/forums/aspose.slides-product-family/109/showforum.aspx

Hi,

SpringSource’s Bundlor tool (which is similar to the mentioned bnd) generated the following Import-Package attribute:

Import-Package: com.sun.image.codec.jpeg;resolution:=“optional”,com.su
n.media.imageio.plugins.tiff;resolution:=“optional”,javax.crypto;reso
lution:=“optional”,javax.crypto.spec;resolution:=“optional”,javax.ima
geio;resolution:=“optional”,javax.imageio.metadata;resolution:=“optio
nal”,javax.imageio.stream;resolution:=“optional”,javax.media.jai;reso
lution:=“optional”,javax.print;resolution:=“optional”,javax.print.att
ribute;resolution:=“optional”,javax.print.attribute.standard;resoluti
on:=“optional”,javax.security.cert;resolution:=“optional”,javax.xml.p
arsers;resolution:=“optional”,org.apache.tools.zip;resolution:=“optio
nal”,org.bouncycastle.jce.provider;resolution:=“optional”,org.dom4j;r
esolution:=“optional”,org.dom4j.io;resolution:=“optional”,org.dom4j.t
ree;resolution:=“optional”,org.w3c.dom;resolution:=“optional”,org.xml
.sax;resolution:="optional"

Not knowing internals of Aspose Cells I intentionally specified all imported packages to be optional. May be library experts can immediately tell which of these imported packages will be used in any given scenario and therefore not be optional.

Regards, Jens

Hi Jens,

Thanks for your additional information.

It seems we need to add Import-Package attribute: different value for different platform. We have logged your comments in our database for investigation. We will look into it and advise you. Once, we will have some update for you, we will let you know asap.

The issues you have found earlier (filed as CELLSJAVA-40391) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

I’ve started testing the lastest jar file (7.6.1) and in our environment we are still getting an error that requires one more line to be added to the MANIFEST.MF file.


The error we see is: R3 imports cannot contain directives.

Adding “Bundle-ManifestVersion: 2” to the MANIFEST.MF solves this issue.

Can you look at updating the MANIFEST.MF with this change.

Thanks, Ian.

Hi Ian,

Thanks for your posting and using Aspose.Cells.

We will look into it and update the MANIFEST.MF with this change. We have logged your comments in our database against this issue for investigation. Once, there is some fix or update for you, we will let you know asap.

Hi,

Thanks for your posting and using Aspose.Cells for Java.

Please download and try this fix: Aspose.Cells for Java v7.7.0.2.

We have added the required attribute to MANIFEST.MF.