MohamedSaeed / xdocreport

Automatically exported from code.google.com/p/xdocreport
1 stars 0 forks source link

java.lang.IllegalAccessError: tried to access class com.lowagie.text.pdf.PdfDocument from class fr.opensagres.xdocreport.itext.extension.ExtendedPdfWriter #470

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I'm using this code

InputStream in= new FileInputStream(new File("nameDoc.odt"));
OdfTextDocument document = OdfTextDocument.loadDocument( in );

File outFile = new File( "nameDoc.pdf" );
outFile.getParentFile().mkdirs();

OutputStream out = new FileOutputStream( outFile );
PdfOptions options = PdfOptions.create(); // PdfOptions.create().fontEncoding( 
"windows-1250" );
PdfConverter.getInstance().convert( document, out, options );

2.
Throw the exception when tring convert

What is the expected output? What do you see instead?

fr.opensagres.xdocreport.converter.XDocConverterException: 
java.lang.IllegalAccessError: tried to access class 
com.lowagie.text.pdf.PdfDocument from class 
fr.opensagres.xdocreport.itext.extension.ExtendedPdfWriter

What version of the product are you using? On what operating system?
1.0.4

Please provide any additional information below.

Original issue reported on code.google.com by carlos.o...@s2ctechnology.com on 13 Mar 2015 at 8:46

Attachments:

GoogleCodeExporter commented 9 years ago
Are you sure you are using the well JARs (well version of iText, etc that you 
can retrieve with maven or by downloading our sample?)

Original comment by angelo.z...@gmail.com on 13 Mar 2015 at 10:04

GoogleCodeExporter commented 9 years ago
this is my pom

                <dependency>
                        <groupId>fr.opensagres.xdocreport</groupId>
                        <artifactId>xdocreport</artifactId>
                        <version>1.0.5</version>
                </dependency>
                <dependency>
                  <groupId>fr.opensagres.xdocreport</groupId>
                  <artifactId>fr.opensagres.xdocreport.document.odt</artifactId>
                  <version>1.0.5</version>
                </dependency>
                <dependency>
                  <groupId>fr.opensagres.xdocreport</groupId>
                  <artifactId>fr.opensagres.xdocreport.converter.odt.odfdom</artifactId>
                  <version>1.0.5</version>
                </dependency>
                <dependency>
                    <groupId>fr.opensagres.xdocreport</groupId>
                    <artifactId>fr.opensagres.xdocreport.itext.extension</artifactId>
                    <version>1.0.5</version>
                </dependency>

                <dependency>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                    <version>2.11.0</version>
                </dependency>
                <dependency>
                    <groupId>org.odftoolkit</groupId>
                    <artifactId>odfdom-java</artifactId>
                    <version>0.8.7</version>
                </dependency>
                <dependency>
                    <groupId>com.lowagie</groupId>
                    <artifactId>itext</artifactId>
                    <version>4.2.1</version>
                </dependency>
                <dependency>
                    <groupId>com.itextpdf</groupId>
                    <artifactId>itextpdf</artifactId>
                    <version>5.5.5</version>
                </dependency>
                <dependency>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                    <version>2.0.2</version>
                </dependency>

Original comment by carlos.o...@s2ctechnology.com on 14 Mar 2015 at 12:32

GoogleCodeExporter commented 9 years ago
The ODT -> PDF converter is based on iText 2.1.7 (pay attention with license). 
See 
https://github.com/opensagres/xdocreport#issue-with-itext-based-pdf-converter

In your pom.xml, you must declare only : 

---------------------------------------------- 
<dependency>
    <groupId>fr.opensagres.xdocreport</groupId>
    <artifactId>fr.opensagres.xdocreport.converter.odt.odfdom</artifactId>
    <version>1.0.5</version>
</dependency>
---------------------------------------------- 

This declaration will download iText 2.1.7. So you must NOT declare in your POM 
other iText version like : 

---------------------------------------------- 
<dependency>
    <groupId>com.lowagie</groupId>
    <artifactId>itext</artifactId>
    <version>4.2.1</version>
</dependency>
<dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>itextpdf</artifactId>
    <version>5.5.5</version>
</dependency>
----------------------------------------------

Original comment by angelo.z...@gmail.com on 14 Mar 2015 at 12:51

GoogleCodeExporter commented 9 years ago
I already change it and still the issue

Original comment by carlos.o...@s2ctechnology.com on 14 Mar 2015 at 1:23

GoogleCodeExporter commented 9 years ago
Check you have only iText 2.1.7 in your classpath. Otherwise I don't understand 
the problem?

Original comment by angelo.z...@gmail.com on 14 Mar 2015 at 8:55

GoogleCodeExporter commented 9 years ago
Persist the problem, but I think that other dependen modules have in his pom 
the dependency 

<dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itextpdf</artifactId>
            <version>5.4.5</version>
        </dependency>

and I cant' remove it because cause error in this modules. What I mean,
My module commons that I want use xdocreport dependends on others that i cant' 
remove the itext's dependency.

I that case, what can I do?

I hope I've explained well....

Original comment by carlos.o...@s2ctechnology.com on 17 Mar 2015 at 1:15