Javassist failure in hibernate: invalid constant type: 60

空扰寡人 提交于 2019-12-04 05:23:11

The problem is ultimately caused by an invalid class in icu4j-2.6.1 as can be seen in this post. Specifically, this file is invalid:

com/ibm/icu/impl/data/LocaleElements_zh__PINYIN.class

Here's a simple way to identify a corrupt file:

for x in PATH_TO_EXTRACTED_JAR/**/*.class; do
    java -cp PATH_TO/javassist.jar javassist.tools.Dump $x >/dev/null 2>&1 || echo "$x is invalid"
done

This file is being included by indirectly by maven through its transitive dependencies which is why I didn't recognize that page as referencing the error and a file contained within the jar as being the culprit and cause of the problem. Here's how it ended up included in my jar-with-dependencies bundle:

jaxen-1.1.1 -> xom-1.0 -> icu4j-2.6.1

After adding the following exclusion to the jaxen dependency, everything worked correctly for me (but be careful if you need its localization pieces):

<exclusions>
    <exclusion>
        <groupId>com.ibm.icu</groupId>
        <artifactId>icu4j</artifactId>
    </exclusion>
</exclusions>

Another option would be to remove the offending file(s) from the jar file:

#!/bin/sh                                                                                                                                                                                                                                    
shopt -s extglob
shopt -s globstar
for x in **/*.jar ; do
    zip -d $x 'com/ibm/icu/impl/data/*_zh*' >/dev/null 2>&1 && echo "Removed corrupted files from $x"
done
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!