[Bug 61991] New: Simple instantiation of XWPFDocument causes reflection warning and method not found exception

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 61991] New: Simple instantiation of XWPFDocument causes reflection warning and method not found exception

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61991

            Bug ID: 61991
           Summary: Simple instantiation of XWPFDocument causes reflection
                    warning and method not found exception
           Product: POI
           Version: 3.17-FINAL
          Hardware: PC
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: XWPF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

This simple code:

        FileInputStream fis = new FileInputStream(filename);
        document = new XWPFDocument(fis);

Using Tiki the mime of the file being attempted:
 application/vnd.openxmlformats-officedocument.wordprocessingml.document

Generates:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by
org.apache.poi.openxml4j.util.ZipSecureFile$1
(file:/C:/javadev/workspace/poi-3.17/poi-ooxml-3.17.jar) to field
java.io.FilterInputStream.in
WARNING: Please consider reporting this to the maintainers of
org.apache.poi.openxml4j.util.ZipSecureFile$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal
reflective access operations
WARNING: All illegal access operations will be denied in a future release

--> the blocker
java.lang.NoSuchMethodException:
org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTPictureBaseImpl.<init>(org.apache.xmlbeans.SchemaType,
boolean)


Jar files in use:
POI Core came from
file:/C:/javadev/workspace/poi-3.17/poi-3.17.jar!/org/apache/poi/poifs/filesystem/POIFSFileSystem.class
POI OOXML came from
file:/C:/javadev/workspace/poi-3.17/poi-ooxml-3.17.jar!/org/apache/poi/POIXMLDocument.class
POI Scratchpad came from
file:/C:/javadev/workspace/poi-3.17/poi-scratchpad-3.17.jar!/org/apache/poi/hslf/usermodel/HSLFSlideShow.class

I have tried work arounds nothing so far successful.  I've tried switching
between JVMs 1.7,1.8,1.9. Looking for jar dependencies and tried different
files.

I am building / running in Eclipse version: Oxygen.2 Release (4.7.2) Build id:
20171218-0600

Libraries on build path:
dom4j-2.1.0.jar
poi-3.17.jar
poi-ooxml-3.17.jar
poi-ooxml-schemas-3.17.jar
poi-scratchpad-3.17.jar
stax-api-1.0.1.jar
tika-eval-1.17.jar
xmlbeans-2.6.0.jar

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61991] Simple instantiation of XWPFDocument causes reflection warning and method not found exception

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61991

Will Greenway <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]
                 OS|                            |Windows 10

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61991] Simple instantiation of XWPFDocument causes reflection warning and method not found exception

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61991

Will Greenway <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Will Greenway <[hidden email]> ---
Many of the examples for OOXML (XWPFDocument) refer to version 3.9.  I gathered
all the 3.9 jars, recompiled.  Code works.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61991] Simple instantiation of XWPFDocument causes reflection warning and method not found exception

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61991

--- Comment #2 from Andreas Beeker <[hidden email]> ---
For the Java 9 warning check [1] and add the addOpens & Co. to your java
command.
Don't use POI 3.9.
This basic example should work - for other cases try the full schema instead of
poi-ooxml-schema.

[1] http://poi.apache.org/faq.html#faq-N102B0

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61991] Simple instantiation of XWPFDocument causes reflection warning and method not found exception

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61991

--- Comment #3 from Will Greenway <[hidden email]> ---


I was able to get 3.17 to work by adding this to the VM Arguments page of the
project:
-Xmx1524m --add-modules=java.xml.bind
--add-opens=java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED -Duser.language=en
-Duser.country=US -Djava9addmods=--add-modules=java.xml.bind
-Djavadoc9addmods=--add-modules=java.xml.bind
-Djava9addmodsvalue=-Dsun.reflect.debugModuleAccessChecks=true
-Djava9addopens1=--add-opens=java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED
-Djava9addopens2=--add-opens=java.base/java.io=ALL-UNNAMED
-Djava9addopens3=--add-opens=java.base/java.nio=ALL-UNNAMED
-Djava9addopens4=--add-opens=java.base/java.lang=ALL-UNNAMED
-Djava9addopens5=--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED
-Djava.locale.providers=JRE,CLDR -Dcoverage.enabled=true

I also added the ooxml-schemas-1.3.jar to the classpath.

If the full version is necessary just to instantiate XWPFDocument, shouldn't it
be a little easier to find (or included with the download)?

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61991] Simple instantiation of XWPFDocument causes reflection warning and method not found exception

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61991

--- Comment #4 from Nick Burch <[hidden email]> ---
(In reply to Will Greenway from comment #3)
> If the full version is necessary just to instantiate XWPFDocument, shouldn't
> it be a little easier to find (or included with the download)?

Almost all files should be processable by the standard "minimum" smaller
poi-ooxml-schemas jar. However, there's always the odd one that uses something
else...

Please see this FAQ for more details on the why, the how, and how to get the
smaller schemas jar updated to handle your odd file:
http://poi.apache.org/faq.html#faq-N10025

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61991] Simple instantiation of XWPFDocument causes reflection warning and method not found exception

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61991

PJ Fanning <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #5 from PJ Fanning <[hidden email]> ---


*** This bug has been marked as a duplicate of bug 61572 ***

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61991] Simple instantiation of XWPFDocument causes reflection warning and method not found exception

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61991

--- Comment #6 from Tim Allison <[hidden email]> ---
Added triggering file from TIKA-2549 to include CTPictureBaseImpl in our
smaller ooxml jar.

r1822033

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61991] Simple instantiation of XWPFDocument causes reflection warning and method not found exception

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61991

--- Comment #7 from Will Greenway <[hidden email]> ---
Wanted to add that the file I was reading that caused the issue was docx output
from GoogleDocs, which I'd take to be fairly common.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61991] Simple instantiation of XWPFDocument causes reflection warning and method not found exception

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61991

--- Comment #8 from Tim Allison <[hidden email]> ---
Interesting.  Note that the content was still extracted without exception, but
the exception was logged.  Now we're good -- Java 9 aside. :)  Thank you!

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]