先记录一下,后期补充配置原因

原先的spring3.X(struts2)的时候配置cxf2.x没问题,基本就是在context.xml中加入

<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
 <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>

这三个文件即可。

后期框架为springmvc4.3(mybatis),这时候cxf的版本已经迭代到3.2.4了,我们查看一下这个最新版本的编译发现是jdk8了,部署在我们的jdk7下回报错,所以讲版本,目前我用的是

spring4.3+mybatis3.4+cxf3.1.6

主要说一配置文件的事情(spring-mybatis.xml,spring-mvc.xml,cxf-servlet.xml,web.xml)

cxf-servlet.xml文件的位置要放到应用上下文的加载位置,不能放到servlet的加载位置,也就是说

1、可以放到咱们的WEB-INF下(编译后类的根目录,在webapp下)

2、可以放到web.xml下的<context-param>,如:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/spring-mybatis.xml,classpath:spring/cxf-servlet.xml</param-value>
</context-param>

3、可以直接在spring-mybatis.xml中import一下,这样应用启动时候,在应用环境加载mybatis的时候,它一起加载

<import resource="cxf-servlet.xml"/>

总而言之,保证在应用的加载路径下即可

我猜这样的原因,是cxf的一些配置调用是全局的上下文而不是servlet域的(每个servlet都有自己的上下文,他们共享javabean),这个后期考证后在这里补上
发一下cxf的maven和配置:

maven:

<!-- cxf begin -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.1.6</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.1.6</version>
</dependency>
<!-- cxf end -->

cxf-servlet.xml内容:

<?xml version="1.0" encoding="UTF-8"?>
<!-- START SNIPPET: beans -->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:endpoint id="webService" implementor="com.cotton.fiber.webservice.FiberWebServiceImpl" address="/webService"></jaxws:endpoint>
</beans>

cxf配置的更多相关文章

  1. spring cxf 配置步骤

    spring 项目增加web service的步骤:1.复制cxf的jar包2.web.xml配置cxf的核心控制器:org.apache.cxf.transport.servlet.CXFServl ...

  2. springboot 1.4 CXF配置

    启动类: package com.eshore.main; import org.apache.catalina.connector.Connector; import org.apache.coyo ...

  3. maven+ssm+cxf3配置例子

    以下只是简单记录 ssm结合cxf3的配置 提供方配置::: pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0&quo ...

  4. CXF:通过WebService上传文件,包括大文件的处理

    参考网上文章,用CXF发布上传文件接口,并上传大文件的测试. 框架:spring3.1+cxf2.7.6 1.定义文件类实体 import javax.activation.DataHandler; ...

  5. CXF 入门:创建一个基于WS-Security标准的安全验证(CXF回调函数使用,)

    http://jyao.iteye.com/blog/1346547 注意:以下客户端调用代码中获取服务端ws实例,都是通过CXF 入门: 远程接口调用方式实现 直入正题! 以下是服务端配置 ==== ...

  6. cxf动态调用wsdl的一个冲突以及解决

    cxf发布服务,调用服务的博客很多,这里也就简单贴一下代代码. 环境如下:spring+cxf (maven环境) <cxf.version>2.7.11</cxf.version& ...

  7. Apache CXF 101 Win Eclipse开发环境搭建

    前言 博客草稿中“SOA生态系统初探”一文一直没有进展,感觉要将SOA.Web Service(WS).REST等概念阐述清楚还需要一些酝酿. 顶天须得立地,这里记录一些“下里巴人”的实践,主要考察A ...

  8. CXF超时设置

    转自: http://peak.iteye.com/blog/1285211 http://win.sy.blog.163.com/blog/static/9419718620131014385644 ...

  9. WebService流行框架之Axis和CXF

    转自:http://www.cnblogs.com/snake-hand/archive/2013/06/09/3129915.html 前言 上节课我们对WebService进行了简单的介绍,对于其 ...

随机推荐

  1. Matrix 高斯消元Gaussian elimination 中的complete pivoting和partial pivoting

    首先科普下Pivoting的含义 一般翻译为“主元”,在对矩阵做某种算法时,首先进行的部分元素.在线性规划的单纯形法中常见.wiki的解释如下:Pivot element(the first elem ...

  2. Centos 使用Systemctl报Error getting authority: Error initializing authority: Error calling StartServiceByName for org.freedesktop.PolicyKit1: Timeout was reached (g-io-error-quark, 24)

    在使用centos7.4 安装服务的时候报错: Error getting authority: Error initializing authority: Error calling StartSe ...

  3. C# 服务端篇之实现RestFul Service开发(简单实用)

    一.RestFul简介 REST(Representational State Transfer 通常被翻译为“表述性状态传输”或者“表述性状态转移”)是RoyFielding提出的一个描述互联系统架 ...

  4. spring boot中的jave注解学习

    在spring中,不仅框架作者会使用java注解,开发者也常使用. 可以随手给个例子:在org.springframework.boot.autoconfigure.jdbc.DataSourcePr ...

  5. 在php cli下可以使用 STDIN 来实现标准输入

    简单的例子:  echo "请输入一个数字:";  $num = trim(fgets(STDIN)); echo "请再输入一个数字:";  $num1 =  ...

  6. HashSet的底层

    今天看博客,发现有个哥哥写到 HashSet的底层是数组结构,有点懵逼,不是HashMap吗怎么成数组了? 遂去查了下源码: 得以下结论: HashSet底层是 HashMap,其元素是内部map的k ...

  7. sonarqube安装的坑

    1.按照官网安装 结果启动不了,看了log日志以后,发现是es报错,不能以root权限启动

  8. JAVA SE ------------------- 项目的菜单输入

    //写一个工具类,进行输入选项数值的获取public class InputUtil { static Scanner sc=new Scanner(System.in); public static ...

  9. (三)juc高级特性——虚假唤醒 / Condition / 按序交替 / ReadWriteLock / 线程八锁

    8. 生产者消费者案例-虚假唤醒 参考下面生产者消费者案例: /* * 生产者和消费者案例 */ public class TestProductorAndConsumer { public stat ...

  10. [httpd][daily] 查看并修改httpd的最大fd打开个数limit

    重要提示: 请直接阅读步骤(6),如果不生效,再回头阅读(1)-(5). 如题: 修改这个文件就行了:/etc/security/limits.conf 查看当前配置的方法: 1. 找到httpd的p ...