jibx 编组与休眠 5

jibx marshalling with hibernate 5

我们正在从 hibernate 5(从 v3)和 spring boot 1.5 升级我们的技术堆栈,特别是当我们对 hibernate 和 jibx 编组使用相同的域对象时面临 hibernate 和 jibx 编组的问题。

def compileJibx() {
    ant {
        taskdef(name: 'bind',
            classname: 'org.jibx.binding.ant.CompileTask',
            classpath: configurations.jibx.asPath)

        bind(binding: "${projectDir}/src/main/resources/jibx-binding.xml", verbose: 'false') {
            classpath {
                pathelement(path: "${projectDir}/build/classes/main")
            }
        }
}
}

此 jibx 编译任务在 compileJava 步骤之后执行。

使用以下依赖项

    jibx group: 'org.apache.bcel', name: 'bcel', version:'6.0'
    jibx group: 'org.jibx', name: 'jibx-run', version:'1.1.5'
    jibx group: 'org.jibx', name: 'jibx-extras', version:'1.1.5'
    jibx group: 'org.jibx', name: 'jibx-bind', version:'1.1.5'
    jibx group: 'xmlpull', name: 'xmlpull', version:'1.1.4'
    jibx group: 'xpp3', name: 'xpp3', version:'1.1.4c'
    jibx group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version:'1.0.2.Final'
    jibx group: 'javax.xml.bind', name: 'jaxb-api', version:'2.2.11'

在 gradle 构建之后,我看到 jibx 类 已在 jar 文件中正确构建。 但是当我启动应用程序时,jibx 编组由于以下错误而失败。

[2019-09-18 10:30:40.537] [BDSPUSD00000582] [ERROR] [com.abc.UnhandledExceptionHandler] [{Correlation-ID=skdfhjwe39850jkhfsd}] - Unhandled exception
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.VerifyError: Expecting a stackmap frame at branch target 26
Exception Details:
  Location:
    com/abc/jibx/domain/JibxDomain.JiBX_ABC_marshal_6_0(Lorg/jibx/runtime/impl/MarshallingContext;)V @19: ifnonnull
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0x0000000: 2b2a b600 462b 2b06 1248 b600 4c57 2ab6
    0x0000010: 0050 59c7 0007 57a7 0007 2bb6 0056 0612 
  ...
Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 26
Exception Details:
  Location:
    com/abc/jibx/domain/JibxDomain.JiBX_ABC_marshal_6_0(Lorg/jibx/runtime/impl/MarshallingContext;)V @19: ifnonnull
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0x0000000: 2b2a b600 462b 2b06 1248 b600 4c57 2ab6
    0x0000010: 0050 59c7 0007 57a7 0007 2bb6 0056 0612

我的编译或构建步骤有问题吗? 有人可以提供一些适用于以下堆栈的工作示例吗?

Spring 引导 1.5, 休眠5, 吉布斯 1.15, Java8

我已经用 bcel/jibx 的升级版本修复了这个问题。

bcel-6.1
jibx-1.3.1