springboot下webservice使用cxf jar包报错及解决

来源:互联网 发布:如何判断网络是否连通 编辑:程序博客网 时间:2024/05/22 14:36
之前在spring框架中使用关于webservice的cxf包都使用的是cxf的捆绑包,
现在用的是springboot,发现用了捆绑包中包含有跟spring相冲突的包,所以就只能单独使用几个适合springboot的非捆绑包
http://bbs.csdn.net/topics/392172078
之后在实际调用webservice的时候遇见了几个错误
java.lang.IllegalStateException  Unable to create schema compiler
原因:缺少 jaxb-xjc-2.1.13.jar 或高版本jar包
解决:引入该jar包

java.lang.NoSuchFieldError: REFLECTION
把cxf的版本改为2.7.18之后就好了。好像是因为2.7.18的动态调用比较稳定,之前用的是3.1.16
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.7.18</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.7.18</version>
</dependency>

Client client = dcf.createClient(wsdlURL) 执行到一步报空指针
需要把jre换成jdk下面的jre


所以在最终在springboot中webservice要用到的cxf的所有包为以下3个
 <dependency>        <groupId>org.apache.cxf</groupId>        <artifactId>cxf-rt-frontend-jaxws</artifactId>        <version>2.7.18</version>    </dependency>    <dependency>        <groupId>org.apache.cxf</groupId>        <artifactId>cxf-rt-transports-http</artifactId>        <version>2.7.18</version>    </dependency>     <dependency>        <groupId>com.sun.xml.bind</groupId>        <artifactId>jaxb-xjc</artifactId>        <version>2.1.12</version>    </dependency> 





原创粉丝点击