Serious Java portability problem (use of sun.* packages )

Hi,



I have been evaluating Aspose.Total for Java for my company, and we have run into a serious issue with the product. Apparently, the Aspose developers rely heavily on the non-standard sun.* packages that are NOT part of the Java language API. Those are simply the building blocks Sun used to code their own implementation of the JVM. Therefore, those packages have never been documented or supported as part of Java, and were never guaranteed not to change or disappear with every next Java release. Those packages do not exist in any JVM implementations other than Sun/Oracle. They are deprecated in the Oracle 1.6 implementation, and are completely gone in Java 7. Copying these packages/Jars into a different implementation of the JRE (Apple, IBM, etc) does not guarantee their compatibility with the rest of the implementation. Therefore, using such packages/classes in a commercial product is a serious mistake, an oversight that renders the product not portable. You cannot - and must not - expect that all your customers run their software on one particular implementation of one particular version of JVM.



Please read more about Why Developers Should Not Write Programs That Call ‘sun’ Packages on the Oracle site:



FAQ - Sun Packages



Our questions:



1) Are any tech leads/architects at Aspose aware of this issue? (The threads in the forum indicate that the Aspose support engineers are all but clueless and keep stating that they can’t reproduce the problem when the customers complain about the countless ClassNotFoundExceptions due to non-existing sun.* classes… Frankly, this is mind-boggling, because - according to the forum threads - this has been going on for years!)



2) Is there any hope that the issue will be addressed and resolved any time soon?





I have posted these questions in other threads before but so far there has been no reaction from Aspose whatsoever. Your response and clarifications are much appreciated.

Hi
Constantine


Thanks for your inquiry. I am representative of Aspose.Words team.

Yes, you’re right; currently, Aspose.Words for Java references some internal Sun classes in some places and because of that it sometimes throws ‘NoClassDefFoundError’ when deploying applications on non-Sun JVM platforms. We’re aware of this drawback. Your request has been linked to the appropriate issue (WORDSJAVA-544) in our issue tracking system. This issue is currently pending for analysis and is in the queue. At the moment, we can’t provide you any reliable ETA. However, we’ll keep you informed of any developments and let you know via this forum thread once this issue is resolved. Sorry for the inconvenience.

Best Regards,

Hi,

We do know that we have to avoid sun.* classes. But time-to-time they leak into production code:) All the references are introduced in new Digital Signature Reading module. The bug will be fixed in the next release. The release will be published as usual, on the last day of current month.

Thanks for your hint.

Best Regards,

Awais and Konstantin,



thank you both very much for responding. It is good to know that the team is aware of the issue and steps are being taken. If I understand Konstantin’s note correctly, Aspose expects to release the new product update that addresses the problem by the end of this month? Wow! That would be great. Or do I misread his statement? We have observed the issue in pretty much every product of the Total suite that we tested: Word, Slides, Cells, etc. Would it be fair to assume that the whole Aspose.Total suite of products will be free of ‘sun’ packages within the next couple of months?



Thanks,

Constantine

Hi
Constantine,


Unfortunatelly (?:)) I can promise only about Aspose.Words for Java.

Regards,

Hi,

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

Aspose.Cells does not call Sun.* packages.

Hi there,


Thanks for your inquiry.

The issue found in Aspose.Words for Java is fixed and is included in the release at the end of the month. Just a quick clarification though, most of our Java products depend upon the JAI package from Sun in order to process images. This dependency will not change in any upcoming version.

Thanks,

Thanks for the update! That’s good news. JAI packages (com.sun.media.jai and jvax.media.jai) are different from sun.* and are part of standard Java, so there’s no issue there.



What about sun.* usage in Aspose.Slides? Will that be fixed soon as well?

Hi Constantine,


Thanks for your inquiry, I am representing Aspose.Slides.

I like to share that Aspose.Slides for Java currently depends upon Sun.* api internally. However, we are working over removal of this dependency. An issue with ID SLIDESJAVA-33372 has been created in our issue tracking system to resolve the issue. I will share the further feedback with you as soon as it will be shared by our development team.

Many Thanks,

The issues you have found earlier (filed as WORDSJAVA-544) have been fixed in this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)
mshakeel.faiz:
Hi,

Aspose.Cells does not call Sun.* packages.

Maybe Aspose.Cells does not use sun.* directly, but we've seen at least two different stacktraces of an IBM JDK where Aspose.Cells is not able to open an Excel file:

Caused by: java.lang.NoClassDefFoundError: sun.font.FontManager (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
at sun.java2d.SunGraphicsEnvironment.addDirFonts(SunGraphicsEnvironment.java:766)
at sun.java2d.SunGraphicsEnvironment.registerFontsInDir(SunGraphicsEnvironment.java:646)
at sun.java2d.SunGraphicsEnvironment.access$200(SunGraphicsEnvironment.java:87)
at sun.java2d.SunGraphicsEnvironment$1.run(SunGraphicsEnvironment.java:207)
at java.security.AccessController.doPrivileged(AccessController.java:192)
at sun.java2d.SunGraphicsEnvironment.(SunGraphicsEnvironment.java:124)
at sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:206)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1328)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:102)
at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1174)
at java.awt.image.BufferedImage.getGraphics(BufferedImage.java:1164)
at com.aspose.cells.b.a.b.i.a(Unknown Source)
at com.aspose.cells.xN.a(Unknown Source)
at com.aspose.cells.WorksheetCollection.W(Unknown Source)
at com.aspose.cells.WorksheetCollection.(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)

and
java.lang.NoClassDefFoundError: com.sun.imageio.plugins.jpeg.JPEGImageReader (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
at com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi.createReaderInstance(JPEGImageReaderSpi.java:123)
at javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:327)
at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:518)
at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:502)
at com.aspose.cells.b.a.b.a.(Unknown Source)
at com.aspose.cells.b.a.b.j.a(Unknown Source)
at com.aspose.cells.a.c.m.a(Unknown Source)
at com.aspose.cells.Aw.a(Unknown Source)
at com.aspose.cells.Aw.b(Unknown Source)
at com.aspose.cells.Aw.a(Unknown Source)
at com.aspose.cells.Aw.a(Unknown Source)
at com.aspose.cells.Aw.b(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:218)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.(JPEGImageReader.java:258)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:196)
at com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi.createReaderInstance(JPEGImageReaderSpi.java:123)
at javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:327)
at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:518)
at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:502)
at com.aspose.cells.b.a.b.a.(Unknown Source)
at com.aspose.cells.b.a.b.j.a(Unknown Source)
at com.aspose.cells.a.c.m.a(Unknown Source)
at com.aspose.cells.Aw.a(Unknown Source)
at com.aspose.cells.Aw.b(Unknown Source)
at com.aspose.cells.Aw.a(Unknown Source)
at com.aspose.cells.Aw.a(Unknown Source)
at com.aspose.cells.Aw.b(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Can't load standard profile: GRAY.pf
at java.awt.color.ICC_Profile$2.run(ICC_Profile.java:915)
at java.security.AccessController.doPrivileged(AccessController.java:192)
at java.awt.color.ICC_Profile.getStandardProfile(ICC_Profile.java:908)
at java.awt.color.ICC_Profile.getInstance(ICC_Profile.java:881)
at java.awt.color.ColorSpace.getInstance(ColorSpace.java:344)
at javax.imageio.ImageTypeSpecifier$Grayscale.(ImageTypeSpecifier.java:730)
at javax.imageio.ImageTypeSpecifier.createGrayscale(ImageTypeSpecifier.java:811)
at javax.imageio.ImageTypeSpecifier.(ImageTypeSpecifier.java:170)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:196)

Hi,

Thanks for your posting and using Aspose components.

Yes, Aspose.Cells for Java does not use Sun.* package as mentioned earlier. There could be two reasons you files might throw exception.

1 - Your files are corrupt, you can check it by opening them in Ms-Excel 2003/2007/2010
2 - It might be a bug of Aspose.Cells for Java
3 - You might be missing Aspose.Cells for Java prerequisite libraries.

Please provide us your problematic files so that we could investigate your issue further and also make sure you have all the prerequisite libraries in your classpath which are the following. You can find them in the main download link: Aspose.Cells for Java 7.3.3


  1. bcprov-jdk16-146.jar
  2. dom4j-1.6.1.jar
  3. stax2-api-3.0.2.jar
  4. woodstox-core-asl-4.1.1.jar


The issues you have found earlier (filed as WORDSJAVA-697) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(1)