Proguard混淆后的java.lang.ExceptionInInitializerError

时间:2019-04-16 10:07:55

标签: exception netbeans proguard obfuscation

如果我从IDE(Netbeans)运行,则不会有任何问题。

我使用Apache Poi库进行excel管理。

应用Proguard混淆后,出现以下问题:

java.lang.ExceptionInInitializerError
        at org.openxmlformats.schemas.spreadsheetml.x2006.main.SstDocument$Factory.parse(Unknown Source)
        at org.apache.poi.xssf.model.SharedStringsTable.readFrom(SourceFile:119)
        at org.apache.poi.xssf.model.SharedStringsTable.<init>(SourceFile:107)
        at org.apache.poi.xssf.eventusermodel.XSSFReader.getSharedStringsTable(SourceFile:105)
        at c.a.b(SourceFile:125)
        at c.a.a(SourceFile:73)
        at c.c.b(SourceFile:542)
        at c.c.a(SourceFile:57)
        at c.e.a(SourceFile:400)
        at c.e.call(SourceFile:373)
        at com.j256.ormlite.misc.TransactionManager.callInTransaction(SourceFile:227)
        at com.j256.ormlite.misc.TransactionManager.callInTransaction(SourceFile:169)
        at com.j256.ormlite.misc.TransactionManager.callInTransaction(SourceFile:150)
        at c.d.run(SourceFile:373)
        at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.RuntimeException: Cannot load SchemaTypeSystem. Unable to load class with name schemaorg_apache_xmlbeans.system.sF1327CCA741569E70F9CA8C9AF9B44B2.TypeSystemHolder. Make sure the generated binary files are on the classpath.
        at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(SourceFile:783)
        at org.openxmlformats.schemas.spreadsheetml.x2006.main.SstDocument.<clinit>(Unknown Source)
        ... 15 more Caused by: java.lang.ClassNotFoundException: schemaorg_apache_xmlbeans.system.sF1327CCA741569E70F9CA8C9AF9B44B2.TypeSystemHolder
        at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(SourceFile:769)

在我的“ build.xml”中,我有:

    <keep name="org.**" >    <method name="*" />    <field name="*" />   </keep>
    <keep name="com.**" >    <method name="*" />    <field name="*" />   </keep>
    <keep name="javax.**" >    <method name="*" />    <field name="*" />   </keep>
    <keep name="myjava.**" >    <method name="*" />    <field name="*" />   </keep>
    <keep name="junit.**" >    <method name="*" />    <field name="*" />   </keep>
    <keep name="local.**" >    <method name="*" />    <field name="*" />   </keep>
    <keep name="media.**" >    <method name="*" />    <field name="*" />   </keep>
    <keep name="java.**" >    <method name="*" />    <field name="*" />   </keep>
    <keep name="io.jsonwebtoken.**" >    <method name="*" />    <field name="*" />   </keep>

    -keepattributes *Annotation*            
    -keepattributes Signature
    <keepattribute name="LineNumberTable"></keepattribute>
    <keepattribute name="SourceFile"></keepattribute>

更新

我看到丢失的文件“ schemaorg_apache_xmlbeans.system.sF1327CCA741569E70F9CA8C9AF9B44B2.TypeSystemHolder”没有被混淆(实际上,如果我运行它,它可以工作),但是在被混淆的.jar中却没有文件文件夹为“ sF1327CCA741569E70F9CA8C9AF9B44B2”。

因此由于某种原因,混淆会更改此文件的名称(或可能不会复制)。

0 个答案:

没有答案