Yes, such dependencies are always hard to sort out.

The geronimo-stax-api_1.2 jar seems to have it, see
http://search.maven.org/#artifactdetails|org.apache.geronimo.specs|geronimo-stax-api_1.2_spec|1.2|bundle

Dominik.

On Mon, Oct 13, 2014 at 6:32 PM, Nolan Darilek <[email protected]> wrote:
> Hmm, you're right. I looked at some version of XMLEventFactory with
> javap and could have sworn I'd seen the
> newFactory method, but I can't find that version now, and the versions I
> have found don't include newFactory.
>
> Where might I find an implementation that includes newFactory if I can't
> count on my VM shipping it (I.e. Dalvik?) I tried stax:stax:1.2.0 but it
> doesn't seem to ship with a set of javax classes--at least, I can't find
> one in Gradle's build directory. There is of course a stax 1.0.1 that
> doesn't include newFactory.
>
> Thanks.
>
> On 10/12/2014 1:46 PM, Dominik Stadler wrote:
>> Hi,
>>
>> This sounds like you are using an older version of class
>> XMLEventFactory from somewhere, it probably is pulled in by
>> stax-api.jar or an outdated xml-apis.jar, the classes in JDK 6 or
>> higher have the method newFactory(), while older ones seem to miss it.
>>
>> Dominik.
>>
>> On Sun, Oct 12, 2014 at 4:11 AM, Nolan Darilek <[email protected]> 
>> wrote:
>>> Hello,
>>>
>>> I'm having a very hard time trying to use XWPFDocument on Android. Seems
>>> like I've read everything I can find from Google on the subject, but am
>>> still hitting an issue. In particular, here's part of the exception I'm
>>> getting when I try to write a DocX from an Android app:
>>>
>>> E/AndroidRuntime( 2553): java.lang.NoSuchMethodError:
>>> avax.xml.stream.XMLEventFactory.newFactory
>>>
>>> E/AndroidRuntime( 2553):     at
>>> org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(PackagePropertiesMarshaller.java:45)
>>>
>>> E/AndroidRuntime( 2553):     at
>>> org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161)
>>>
>>> E/AndroidRuntime( 2553):     at
>>> org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:141)
>>>
>>> E/AndroidRuntime( 2553):     at
>>> org.apache.poi.openxml4j.opc.Package.<init>(Package.java:37)
>>>
>>> E/AndroidRuntime( 2553):     at
>>> org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:65)
>>>
>>> E/AndroidRuntime( 2553):     at
>>> org.apache.poi.openxml4j.opc.OPCPackage.create(OPCPackage.java:337)
>>>
>>> E/AndroidRuntime( 2553):     at
>>> org.apache.poi.xwpf.usermodel.XWPFDocument.newPackage(XWPFDocument.java:256)
>>>
>>> E/AndroidRuntime( 2553):     at
>>> org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:129)
>>>
>>> I understand the issues on Android are 2-fold. 1: the method limit. I
>>> haven't seemed to hit that yet, so I haven't needed to shrink the POI jars.
>>>
>>> 2. The use of javax.* namespaces. Many of the solutions I saw on Google
>>> involved manually opening the jars and replacing "javax" with something
>>> else, like "avax". For this I used Jarjar and the Gradle plugin for
>>> same, with a rule like:
>>>
>>> "rule javax.** avax.@1"
>>>
>>> The resulting fat jar appears to have its javax namespace renamed, and
>>> indeed, I can't find the string "javax" anywhere when grepping through
>>> the directories.
>>>
>>> I'm also not sure if I need to manually install stax-api. It appears to
>>> be installed as a POI dependency, but installing stax:stax-api:1.0.1
>>> doesn't seem to make much of a difference.
>>>
>>> Any idea as to why I'm getting this NoSuchMethodError? Guessing it has
>>> to be something found on the JVM but not Dalvik, but I can't figure out
>>> what that is and am quickly approaching my wits' end. Do I have to do
>>> anything to tell POI to use the javax.xml.* facilities provided by
>>> stax-api and not expect to find them on the VM running it? Or is there
>>> something else I'm missing?
>>>
>>> Thanks.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to