Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java org/apache/cxf/jaxb/JAXBToStringStyle上的NoClassDefFoundError_Java_Maven_Spring Boot_Cxf_Jax Ws - Fatal编程技术网

Java org/apache/cxf/jaxb/JAXBToStringStyle上的NoClassDefFoundError

Java org/apache/cxf/jaxb/JAXBToStringStyle上的NoClassDefFoundError,java,maven,spring-boot,cxf,jax-ws,Java,Maven,Spring Boot,Cxf,Jax Ws,你好 我正在使用apache cxf和spring boot构建web服务,但当我尝试调用端点时,会出现以下错误: WARN 15936 --- [nio-8080-exec-4] o.a.cxf.phase.PhaseInterceptorChain : Application { endpointMethod has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: org/

你好

我正在使用apache cxf和spring boot构建web服务,但当我尝试调用端点时,会出现以下错误:

    WARN 15936 --- [nio-8080-exec-4] o.a.cxf.phase.PhaseInterceptorChain      : Application {
endpointMethod has thrown exception, unwinding now

        org.apache.cxf.interceptor.Fault: org/apache/cxf/jaxb/JAXBToStringStyle
                [...]
                at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
        Caused by: java.lang.NoClassDefFoundError: org/apache/cxf/jaxb/JAXBToStringStyle
以下是我的Web服务配置:

@Configuration
public class WebServiceConfig {

@Bean
public org.springframework.boot.web.servlet.ServletRegistrationBean cxfServlet() {
    return new org.springframework.boot.web.servlet.ServletRegistrationBean(new CXFServlet(), "/cxf-api/*");
}

@Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
    return new SpringBus();
}


@Bean
public Conc2MGPService conc2MGPService() {
    return new RegistrationServiceEndpoint();
}

@Bean
public Endpoint endpoint() {
    EndpointImpl endpoint = new EndpointImpl(springBus(), concessionario2MGPService());
    endpoint.publish("/registration_endpoint");
    return endpoint;
}
这是我的POM:

<project ...">
    <groupId>com.me.justin</groupId>
        <artifactId>registration-gateway-app</artifactId>
        <packaging>war</packaging>
    <name>registration-gateway-app</name>
    <description>Demo project for Spring Boot</description>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
        </dependency>
        <dependency>
            <groupId>it.justin</groupId>
            <artifactId>justin-soap-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-databinding-jaxb</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

我认为我的POM中缺少了一些东西,但我不知道是什么

将此依赖项添加到pom中

 <dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-bundle</artifactId>
    <version>2.7.18</version>
</dependency>

org.apache.cxf
cxf束
2.7.18
顺便说一句,这个jar不推荐使用,请尝试更新您的依赖项。上述jar的新版本如下所示。(但为了使用它,您必须更新相关的依赖项)

org.apache.cxf.xjc-utils
cxf xjc运行时
3.2.1

您将依赖项的范围限定为运行时,例如,它将在运行时由容器提供。如果您使用的是嵌入式容器,或者它不是您部署到的容器的一部分,则需要编译该依赖项。
 <dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-bundle</artifactId>
    <version>2.7.18</version>
</dependency>
<groupId>org.apache.cxf.xjc-utils</groupId>
<artifactId>cxf-xjc-runtime</artifactId>
<version>3.2.1</version>