Free Support Forum - aspose.com

JDK 1.4 with latest version of Aspose Words. Java error: sun/reflect/generics/reflectiveObjects

Hello,

With the latest version of Aspose Words. Java with my JDK 1.4.2.

I use the library Aspose.Words.jdk14.jar

I have the following error:

java.lang.NoClassDefFoundError: sun/reflect/generics/reflectiveObjects/NotImplementedException
at asposewobfuscated.xd.tQ(SortedList.java:207)
at asposewobfuscated.pc.iterator(OpcPackagePartCollection.java:34)
at asposewobfuscated.app.bh(_Iterable.java:57)
at asposewobfuscated.oz.a(OpcPackage.java:176)
at asposewobfuscated.oz.h(OpcPackage.java:73)
...

Have you any idea?

Where can I found the Jar for library sun.reflect.generic?

This library is included in JDK 1.6 but I can use it.

Thank you for your help.
Mathieu

Hi Mathieu,

Thanks for your query. Please share your Operating System details to reproduce this issue at our end.

Hi,

JDK: j2sdk1.4.2_32 find in the oracle partner website, cannot change this version.
IDE: Netbeans: 7.0.1
Application: Java Application
OS: Microsoft Vista SP2

The problem is that the "generics.reflectiveObjects" package is not available in the JDK 1.4. The generic Objects are only available since JDK 1.5.

With the version Aspose.Words for Java 10.6.0 I have no problem, it works fine :-).

But with the latest version 10.8.0 it doesn't work. This error occurs:

java.lang.NoClassDefFoundError: sun/reflect/generics/reflectiveObjects/NotImplementedException
at asposewobfuscated.xd.tQ(SortedList.java:207)
at asposewobfuscated.pc.iterator(OpcPackagePartCollection.java:34)
at asposewobfuscated.app.bh(_Iterable.java:57)
at asposewobfuscated.oz.a(OpcPackage.java:176)
at asposewobfuscated.oz.h(OpcPackage.java:73)
at asposewobfuscated.oz.(OpcPackage.java:47)
at com.aspose.words.he.(DocxReader.java:30)
at com.aspose.words.Document.b(Document.java:1246)
at com.aspose.words.Document.a(Document.java:1167)
at com.aspose.words.Document.(Document.java:200)
at com.aspose.words.Document.(Document.java:171)
at com.aspose.words.Document.(Document.java:166)

Thank you for your support.
Greeting,
Mathieu

Hi Mathieu,

Thanks for sharing the additional information. I have tested the scenario and able to reproduce the same problem at my end. I have logged this issue in our issue tracking system and you will be updated via this forum thread once this issue is resolved.

There´s a solution for the problem with jdk1.4? I´m avaliating the lib and until now the problem persist.


Testing trial version on java 1.6, the conversion from odt to pdf result on loss of format and note was rendered on pdf document.

See attach doc.

Thanks

Hi Moaflavio,

Yes, there is problem with Aspose.Words for Java for JDK 1.4 version. We had already logged this issue in our issue tracking system and you will be notified via this forum thread once this issue is resolved.

Regarding ODT to PDF conversion by using JDK 1.6, It would be great, If you share your ODT file for investigation purposes.

I had the same problem with Aspose.Words for Java for JDK 1.5 on Oracle 11g

java.lang.NoClassDefFoundError: sun/reflect/generics/reflectiveObjects/NotImplementedException

After another loadjava with -genmissingjar option I get the following exception:

ORA-29532: Java call terminated by uncaught Java exception: java.lang.VerifyError: (class: asposewobfuscated/zi$c, method: retainAll signature: (Ljava/util/Collection;)Z) Can only throw Throwable objects

I had no such problems with Aspose.Words for java 4.0.3.0

Any chance of getting a solution any time soon?

Hi Moaflavio,

Please accept my apology for late response. I have tested the scenario with JDK 1.5 and have not found any issue while using latest version of Aspose.Words for Java. Please share your ODT file for investigation purposes.

Thanks.

We just tried loading Aspose.Words.jdk15.jar v.11.2 into Oracle

From load_java.log:
arguments: ‘-user’ ‘system/***$@[db]’ ‘-verbose’ ‘-schema’ ‘document_user’ ‘Aspose.Words.jdk15.jar’ ‘-resolve’ ‘-fileout’ ‘load_java.log’

skipping : class DOCUMENT_USER.asposewobfuscated/zu$c
errors : class DOCUMENT_USER.asposewobfuscated/zu$c
ORA-29552: verification warning: java.lang.VerifyError: (class: asposewobfuscated/zu$c, method: retainAll signature: (Ljava/util/Collection;)Z) Can only throw Throwable objects



Our classes that are using Aspose.Words do compile though.
It’s just when we are trying to use it we get an error:

ORA-29532: Java call terminated by uncaught Java exception: java.lang.VerifyError: (class: asposewobfuscated/zu$c, method: retainAll signature: (Ljava/util/Collection;)Z) Can only throw Throwable objects

The 11.2. version doesn’t seem to solve the problem. Adding a resolver definition to loadjava command doesn’t help either.

Hi Andris,

I have tried to understand your problem statement but unfortunately I have not completely understand your issue. It would be great, If you share some more detail about your issue.

Thanks.

User Andris is the same person posting the same problem as ZZdats. I just thought that you would react sooner if I posted from an account of a customer.

I have no idea what else can I add to the problem description. I am no Java expert, not even close, but it looks to me that there is a problem with a method called “retainAll” in a class that is obfuscated to me. Something wrong with an object being thrown.

Hi Andris,

We had already logged the issue related with JDK 1.4 as WORDSJAVA-490 in our issue tracking system.

The new issue you reported with JDK 1.5, see below, Please share sample code along with document for investigation purposes.

I had the same problem with Aspose.Words for Java for JDK 1.5 on Oracle 11g

java.lang.NoClassDefFoundError: sun/reflect/generics/reflectiveObjects/NotImplementedException
We are really keen to help you but need some more detail from your side, like code and document.

Thanks.

PL/SQL package body:

CREATE OR REPLACE PACKAGE BODY U_JAVASOURCE_WORDDOCUMENT_PCK IS

PROCEDURE AddNrAndSigners_java(pi_docu_content IN BLOB,
po_edited_docu_content IN BLOB)
IS LANGUAGE JAVA NAME ‘WordDocument.AddNrAndSigners(oracle.sql.BLOB,
oracle.sql.BLOB)’;
PROCEDURE AddNrAndSigners(pi_docu_id IN DOCUMENT.DOCU_ID%TYPE,
po_edited_docu_content OUT BLOB) AS
v_docu_content BLOB;
BEGIN
DBMS_LOB.createtemporary(po_edited_docu_content,FALSE);
v_docu_content := DOCUMENT_BLOB_PCK.QRY_CONTENT_FUN(pi_docu_id);
AddNrAndSigners_java(v_docu_content, po_edited_docu_content);
END;

END U_JAVASOURCE_WORDDOCUMENT_PCK;

JavaSource:
create or replace and compile java source named worddocument as
import java.io.;
import oracle.sql.
;
import com.aspose.words.;
import com.aspose.
;
import LogJava.*;

public class WordDocument {

private static void SetLicence() throws Exception
{
LogJava myLog = new LogJava(“WordDocument”, “WordDocument”, “SetLicence”);
try
{
License license = new License();
license.setLicense(“C:\DOCUMENT_USER_JAVA\WordOracle\Aspose.Words.lic”);
//license.setLicense("//opt//oracle//Aspose.Words.lic");
myLog.Debug(“Licence is set”);
}
catch (Exception exc)
{
myLog.Error(exc);
throw exc;
}
}

public static void AddNrAndSigners(InputStream pi_docu_content,
OutputStream po_edited_docu_content) throws Exception
{
LogJava myLog = new LogJava(“WordDocument”, “WordDocument”, “AddNrAndSigners”);
try
{
myLog.Debug(“1”);
SetLicence();
myLog.Debug(“2”);
Document doc = new Document(pi_docu_content); //this is where it crashes
myLog.Debug(“3”);

}
catch (Exception exc)
{
myLog.Error(exc);
throw exc;
}
}


public static void AddNrAndSigners(BLOB pi_docu_content,
BLOB po_edited_docu_content) throws Exception
{
try
{
OutputStream os = po_edited_docu_content.getBinaryOutputStream();
AddNrAndSigners(pi_docu_content.getBinaryStream(), os);
}
catch (Exception exc)
{
throw exc;
}
}

}

The code above works fine with Aspose.Words 4.0.3
When I load Aspose.Words 11.2. it crashes at:

Document doc = new Document(pi_docu_content)

with an exception:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.VerifyError: (class: asposewobfuscated/zu$c, method: retainAll signature: (Ljava/util/Collection;)Z) Can only throw Throwable objects
ORA-06512: at “DOCUMENT_USER.U_JAVASOURCE_WORDDOCUMENT_PCK”, line 3
ORA-06512: at “DOCUMENT_USER.U_JAVASOURCE_WORDDOCUMENT_PCK”, line 13
ORA-06512: at line 3

Any MS Word document will do. I am testing with blank document of Microsoft Office Word 97 - 2003 Document (.doc)

We have Oracle Database 11g Enterprise Edition Release 11.2.0.2.0
I was loading the jar file with a command that can be seen in one of my previous posts in this thread.

Hi Andris,

Thanks for sharing the more information. I have verified the Aspose.Words for Java with JDK 1.5 again and have not found any issue. It will be really helpful for further investigation, If you execute the following code snippet at your end and share your output/exception.


<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>PL</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>AR-SA</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>

// Open the stream. Read only access is enough for Aspose.Words to load a document.

InputStream stream = new FileInputStream("D:\\in.doc");

// Load the entire document into memory.

Document doc = new Document(stream);

// You can close the stream now, it is no longer needed because the document is in memory.

stream.close();


Java method:
public static void newTest() throws Exception
{
LogJava myLog = new LogJava(“WordDocument”, “WordDocument”, “newTest”);
myLog.Debug(“1”);
InputStream stream = new FileInputStream(“C:\path\test.doc”);
myLog.Debug(“2”);
Document doc = new Document(stream);
myLog.Debug(“3”);
stream.close();
myLog.Debug(“4”);
}

Exception:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.VerifyError: (class: asposewobfuscated/zu$c, method: retainAll signature: (Ljava/util/Collection;)Z) Can only throw Throwable objects

mylog logs “1” and “2” and that’s it.

If I enter a non existant path I get error “Non existant file or directory.” and “1” in myLog.

Hi Andris,

Thanks for your feedback. Please confirm that you are using the jar file (Aspose.Words.jdk15.jar) of Aspose.Words for Java 11.2.0 with JDK 1.5. Also, please share your test.doc file with us.

Thanks.

I confirm - I am using Aspose.Words.jdk15.jar 11.2.0. - 5,24 MB (5 496 129 bytes)

Also I attach a test.doc although any word file I use generates an error.

Hi Andris,

Please accept my apologies for late response.

A new version of Aspose.Words for Java (11.3.0) has been released. Please use the latest version.

Thanks for sharing the document. I have successfully loaded the shared document with latest version of Aspose.Words for Java. I am using the jdk1.5.0_22.

Please check this link and share the JDK 1.5 version update with us for investigation purposes.


<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>PL</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>AR-SA</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>

// Open the stream.

InputStream stream = new FileInputStream("D:\\Data\\Customers\\test.doc");

// Load the entire document into memory.

Document doc = new Document(stream);

// close the stream

stream.close();


Hi,
I am currently evaluating Aspose.Total, and have been following some of the forum discussions - after running into the same type of issues: ClassNotFoundExceptions due to the fact that Aspose uses Sun’s proprietary classes that ONLY EXIST IN SUN’S IMPLEMENTATIONS OF JVM!

I am surprised no one seems to have mentioned the very obvious problem and solution. The sun. classes are NOT part of the Java language but rather are the “building blocks” Sun used to implement their own JVM. As, I’m sure you know, there are many other JVM implementations - from Oracle, IBM, Apple, etc., where those classes are not present. Yes, Oracle still used Sun’s classes through Java 6, in which those classes became officially deprecated. They no longer exist in Java 7. Sun has always made it clear that the sun. packages were not portable with other JVMs, were not documented, and were not guaranteed to be present in any particular release of the JVM.

Read the Sun/Oracle disclaimer: Why Developers Should Not Write Programs That Call ‘sun’ Packages

I simply cannot imagine how the Aspose engineering team could have overlooked this, continue to use sun.* in their products for years, and seemingly remain unaware of the issue to this day! Seriously?

The very obvious reason why the Aspose developers cannot re-create the problem in their environments is because they are testing their code in Sun JVMs that have the classes that many of your customers are missing due to the fact that those customers run their applications in non-Sun JVMs! But I don’t understand why no one has actually pin-pointed and addressed this trivial and very obvious problem. You guys are building a product that is NOT pure Java, it is not portable, it will only run on one particular type of JVM. It is not a minor bug, it is a very serious FLAW.

The fix is simple. Refactor your code base to replace all sun.* usages with the proven alternative implementations that are available. Provide the dependency JARs in your distributions, and/or provide the info on the resources where the latest versions of those libraries may be obtained, i.e Maven artifact configurations for those libs. No need to have year-long forum exchanges. Just get it done. The task is technically very simple although a few API signatures might need to be
adjusted, and, of course, a new round of QA will be required, so we would not expect you to come up with the fix overnight. However, acknowledging the problem and a reasonable time estimate would be appreciated.

I am not sure how many Sun packages you are using throughout your applications, but here’s an example of an alternative open-source JAI implementation, and how you can pull it using Maven (this example uses the SpringSource Maven repository, but there are certainly other sources):



com.springsource.repository.bundles.external
SpringSource Enterprise Bundle Repository - External Bundle Releases
http://repository.springsource.com/maven/bundles/external





javax.media.jai
com.springsource.javax.media.jai.core
1.1.3


javax.media.jai
com.springsource.javax.media.jai.codec
1.1.3



Hope this helps.
Cheers…

Hi Constantine


Thanks for your inquiry and I apologise for the delay.

You are absolutely right, this is a serious oversight and it should be corrected as soon as possible. I have logged this as a new issue in our database with high priority. We will resolve any sun references in Java as soon as possible. The issue ID is: WORDSJAVA-544

We will inform you as soon as there are developments.

Thanks,