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

原先的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. 【ORACLE】解锁scott帐号

    sqlplus / as sysdba;SQL> alter user scott account unlock;SQL> conn scott/grace

  2. phpstorm 破解

    http://idea.lanyus.com/ https://www.imsxm.com/jetbrains-license-server.html [  http://www.activejetb ...

  3. centos 7 mysql启动失败--学会看错误日志

    一.现象 mysql客户端连接时: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql ...

  4. Scala 中方法扩展实践

    前言 这个名字不知道取得是否合适,简单来说要干的事情就是给某个类型添加一些扩展方法,此场景在各种语言中都会用到,比如 C# 语言,如果我们使用一个别人写好的类库,而又想给某个类库添加一些自己封装的方法 ...

  5. python和计算机的交互

    网易邮箱都2万+满了,但是只有手动删除.实在太多,于是想使用python脚本实现,python有很多现成的库可以使用,这就是python的好处,而不是c++或者java,python的库说明网站:ht ...

  6. pymysql.err.InterfaceError: (0, '')解决办法

    导致这个错误的原因是通过pymysql连接MySQL,没有关闭连接的操作,所以短时间内不会出问题,长时间保持这个连接会出现连接混乱.虽然看着自己的代码没错,还是会报 pymysql.err.Inter ...

  7. vue分页问题参考 感谢

    https://www.cnblogs.com/zhoulifeng/p/9395295.html

  8. python 接口自动化测试二(request.get)

    环境搭建好后,接下来我们先来了解一下requests的一些简单使用,主要包括: requests常用请求方法使用,包括:get,post requests库中的Session.Cookie的使用 其它 ...

  9. dedecms (织梦)漏洞&exp整理

    [通杀]dedecms plussearch.php 注入漏洞利用方式看结果如果提示Safe Alert: Request Error step 2 !那么直接用下面的exp查看源代码打印帮助1 /p ...

  10. CF1B Spreadsheets

    题意翻译 人们常用的电子表格软件(比如: Excel)采用如下所述的坐标系统: 第一列被标为A,第二列为B,以此类推,第26列为Z.接下来为由两个字母构成的列号: 第27列为AA,第28列为AB... ...