Free Support Forum - aspose.com

Java exception convering word document with image in Oracle DB

Hi,

I have loaded the words jar for java 1.4 into an Oracle database. When I try to convert a microsoft word document with an image to pdf I get.

java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:165)
at asposewobfuscated.JO.(Unknown Source)
at asposewobfuscated.JP.Ã(Unknown Source)
at asposewobfuscated.JP.V(Unknown Source)
at asposewobfuscated.JP.(Unknown Source)
at asposewobfuscated.PA.NK(Unknown Source)
at asposewobfuscated.PA.NL(Unknown Source)
at asposewobfuscated.P1.Ns(Unknown Source)
at asposewobfuscated.PB.Ã(Unknown Source)
at asposewobfuscated.OS.MJ(Unknown Source)
at asposewobfuscated.OS.MU(Unknown Source)
at asposewobfuscated.OS.Y(Unknown Source)
at asposewobfuscated.KD.NP(Unknown Source)
at asposewobfuscated.OM.Ln(Unknown Source)
at asposewobfuscated.KF.U(Unknown Source)
at asposewobfuscated.P3.U(Unknown Source)
at asposewobfuscated.L1.Ã(Unknown Source)
at asposewobfuscated.ZZ.Ã(Unknown Source)
at asposewobfuscated.ZZ.Ã(Unknown Source)
at asposewobfuscated.GZ.Ã(Unknown Source)
at asposewobfuscated.ZZ.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.N.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.N.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.N.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.N.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.N.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.ZW.Ã(Unknown Source)
at asposewobfuscated.GZ.U(Unknown Source)
at com.aspose.words.ZVM.X(Unknown Source)
at com.aspose.words.MZ.Ã(Unknown Source)
at com.aspose.words.Document.Ã(Unknown Source)
at com.aspose.words.Document.Ã(Unknown Source)
at com.aspose.words.Document.R(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at CoreHRDocumentConverter.createNewDocument(COREHRDOCUMENTCONVERTER:145)
at CoreHRDocumentConverter.convertDocument(COREHRDOCUMENTCONVERTER:308)
Caused by: java.security.AccessControlException: the Permission (java.lang.RuntimePermission getClas
er’, ‘’ )
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:280)
at java.security.AccessController.checkPermission(AccessController.java:429)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:528)
at oracle.aurora.rdbms.SecurityManagerImpl.checkPermission(SecurityManagerImpl.java:192)
at java.lang.Thread.getContextClassLoader(Thread.java:1203)
at com.sun.media.jai.util.Service.providers(Service.java:359)
at javax.media.jai.OperationRegistry.registerServices(OperationRegistry.java:2049)
at javax.media.jai.ThreadSafeOperationRegistry.registerServices(ThreadSafeOperationRegistry.java:62
at javax.media.jai.OperationRegistry.initializeRegistry(OperationRegistry.java:373)
at javax.media.jai.JAI.(JAI.java:566)
… 43 more

If I then run it a second time I get

ava.lang.NoClassDefFoundError
at asposewobfuscated.JP.Ã(Unknown Source)
at asposewobfuscated.JP.V(Unknown Source)
at asposewobfuscated.JP.(Unknown Source)
at asposewobfuscated.PA.NK(Unknown Source)
at asposewobfuscated.PA.NL(Unknown Source)
at asposewobfuscated.P1.Ns(Unknown Source)
at asposewobfuscated.PB.Ã(Unknown Source)
at asposewobfuscated.OS.MJ(Unknown Source)
at asposewobfuscated.OS.MU(Unknown Source)
at asposewobfuscated.OS.Y(Unknown Source)
at asposewobfuscated.KD.NP(Unknown Source)
at asposewobfuscated.OM.Ln(Unknown Source)
at asposewobfuscated.KF.U(Unknown Source)
at asposewobfuscated.P3.U(Unknown Source)
at asposewobfuscated.L1.Ã(Unknown Source)
at asposewobfuscated.ZZ.Ã(Unknown Source)
at asposewobfuscated.ZZ.Ã(Unknown Source)
at asposewobfuscated.GZ.Ã(Unknown Source)
at asposewobfuscated.ZZ.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.N.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.N.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.N.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.N.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.N.Ã(Unknown Source)
at asposewobfuscated.K.Ã(Unknown Source)
at asposewobfuscated.ZW.Ã(Unknown Source)
at asposewobfuscated.GZ.U(Unknown Source)
at com.aspose.words.ZVM.X(Unknown Source)
at com.aspose.words.MZ.Ã(Unknown Source)
at com.aspose.words.Document.Ã(Unknown Source)
at com.aspose.words.Document.Ã(Unknown Source)
at com.aspose.words.Document.R(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at CoreHRDocumentConverter.createNewDocument(COREHRDOCUMENTCONVERTER:145)

CoreHRDocumentConverter is the name of my class that is also in the Database. If I run this conversion directly on my own PC there is no problem it is only when I try to run it in the DB.

I’m using

outputStream = new ByteArrayOutputStream();
formatDocConst = com.aspose.words.SaveFormat.PDF;
currentDocument.save(outputStream, formatDocConst);

Thanks in advance.
Anthony

Hi Anthony,


Thanks for your inquiry. In case you’re using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v11.9.0) from here and let us know how it goes on your side. If the problem still remains, please attach your input Word document here for testing. I will investigate the issue on my side and provide you more information.

Best Regards,

Hi Awais,

I have found that the issue arises if I put anything but an .gif image into the word document. So is it the Aspose treats anything but gifs in a different way when converting to PDF. I'm not sure how you can test this unless you can put a word document into an Oracle db with Aspose installed in the database. As I say if I run this on my PC connecting to the DB to extract the document it works. The problem arises when I'm doing the conversion in the DB. I think it may be that there is some java object missing from the oracle DB implementation of java or there is some permission needed.

Anthony

Hi Anthony,


Thanks for the additional information. When saying that you have installed Aspose.Words for Java in the database; could you please confirm if you’re using ‘Oracle Developer Suite’ on your side to perform these conversions? We will prepare the required platform to simulate the environment as of yours. As soon as everything is setup, we will then test your issue on our end and will post the results here for your kind reference. But, before we proceed, it would be great if you could please share any particular steps you needed us to do to be able to reproduce this exception on or end (For example you can share the version of Oracle Developer you’re getting this exception on etc).

Best Regards,

Hi Awais

What we have is an Oracle database running on Linux. The version of the db is

Oracle Database 10g Release 10.2.0.4.0 - 64bit Production.

Basically we load the jar directly into the database using a command like this

loadjava -user aspose/aspose@thedb:port:service -thin -verbose -resolver "((* SCHEMA) (* aspose) (* sys) (* -))" -force -resolve Aspose.Words.jdk14.jar.

Basically the jvm runs inside the database so we then use plsql wrapper around our java class that is also in the database to use the aspose classes. In this version of Oracle they use java 1.4.

We have decided to change our direction on using Aspose in the Database as we are having a number of other issues using Aspose in this way. We are now going to host out of the database and run the conversion in the operating system as we can update the jdk system to 1.6 and everything converts without any issues(so far).

For testing I was using Oracle JDeveloper on my PC and had no issues converting.

I think there may be an issue in the jvm in the database in that it cannot use any visual components

I think we can leave this go for the now and we will continue testing with our new method.

Thanks again

Anthony

Hi Anthony,


Thanks for your inquiry.

It sounds like your DB is restricting dynamic use of a class or is perhaps running headless without any access to a graphics environment. If the former you may wish to research how to open up permissions, otherwise you can try enabling the following line at the start of your code and see if this helps. You can do this on the system level you have to configure “headless” graphic environment. See http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/ . Note, you have to install X11, but you don’t need to start it.

Please let us know how it goes.

Thanks,