`嗨,
我正在尝试将我的项目从 2.6.7 apache cxf(4.0.1) 升级到 springboot 3.1.6,但是它抛出错误为 线程“main”java.lang.NoClassDefFoundError 中的异常:javax/xml/bind/JAXBException
我尝试了多种方法,例如将依赖项更新到下面
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0'
implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.0'`
但是它仍然会抛出错误。 我的 gradle 文件看起来像
`import io.mateo.cxf.codegen.wsdl2java.Wsdl2Java
plugins {
id "io.spring.dependency-management" version "3.1.6"
id "org.springframework.boot" version "3.1.6"
id 'java'
id "io.mateo.cxf-codegen" version "1.0.0"
id 'org.hidetake.swagger.generator' version '2.19.2'
}`
`dependencies {
compileOnly "javax.servlet:javax.servlet-api:4.0.1"
implementation 'com.sun.xml.ws:jaxws-rt:4.0.0'
compileOnly "jakarta.xml.ws:jakarta.xml.ws-api:2.3.3"
compileOnly "jakarta.jws:jakarta.jws-api:1.1.1"
cxfCodegen "jakarta.xml.ws:jakarta.xml.ws-api:2.3.3"
cxfCodegen "jakarta.annotation:jakarta.annotation-api:1.3.5"
cxfCodegen "ch.qos.logback:logback-classic:1.2.10"
implementation "org.apache.cxf:cxf-spring-boot-starter-jaxws:4.0.1"
implementation "org.apache.cxf:cxf-rt-features-logging:4.0.1"
implementation "org.springframework.boot:spring-boot-starter-web-services"
compileOnly 'org.apache.commons:commons-lang3:3.12.0'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0'
implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.0'
}
您能建议可能是什么问题吗?
任何帮助将不胜感激。谢谢
我尝试了多种方法,例如将依赖项更新到下面
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0'
implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.0'
implementation 'javax.xml.bind:jaxb-api:2.3.0'
implementation 'com.sun.xml.ws:jaxws-rt:4.0.0'
以下依赖项(最小)是基于 javax 的版本,不应与当前配置一起出现
jakarta.xml.ws:jakarta.xml.ws-api:2.3.3
jakarta.annotation:jakarta.annotation-api:1.3.5
jakarta.jws:jakarta.jws-api:1.1.1
您应该进行以下操作并确保所有依赖项都是 jakarta 打包的(而不仅仅是 jakarta 命名的):
jakarta.xml.ws:jakarta.xml.ws-api:4.0.1
jakarta.annotation:jakarta.annotation-api:2.1.1
jakarta.jws:jakarta.jws-api:3.0.0