发布rest服务

但是spring-cxf-rest.xml中配置的却是

<jaxws:server address="/weather"....................................

应当是

<jaxrs:server address="/weather".....................................

===========================羞耻的分割线(真正元凶)=============================

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Archetype Created Web Application</display-name>
<!--Spring配置-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:spring.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>SpringMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>SpringMVC</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping> <!-- CXF框架的配置 -->
<servlet>
<servlet-name>cxf</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cxf</servlet-name>
<url-pattern>/ws/*</url-pattern>
</servlet-mapping> <welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

  spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
</bean>
<!--<import resource="classpath*:spring-mvc.xml" />-->
<import resource="classpath*:spring-mybatis.xml" />
<import resource="classpath*:spring-cxf-rest.xml" /> </beans>

  以上字体红色加粗加大部分是更正后的配置~(编辑器原因显示不出来,不过,上面的web.xml和spring.xml是正确的配置).

更正前:

web.xml中SpringMVC的配置:<param-value>classpath:spring.xml</param-value>

Spring.xml中引入spring-mvc.xml的配置:<import resource="classpath*:spring-mvc.xml" />

也并未注释, 这是配置springmvc时相当于加载了spring的配置文件一次(拆分Spring配置文件时不明确web.xml配置导致)

而web.xml上部引入spring.xml及配置监听器也已经引入了一次,相当于二次加载spring.xml, 这样一来必然会报如题错误.

总结:

  磨刀不误砍柴工, 基础性的东西不吃透必然多走弯路, 而且是重复性的弯路.

cxf之Caused by: java.lang.RuntimeException: Soap 1.1 endpoint already registered on address /rest的更多相关文章

  1. Caused by: java.lang.RuntimeException: java.io.IOException: invalid constant type: 18

    工程启动的时候有报下面这个错误的,更新下工程的jar包依赖,然后在工程的pom文件里加上下面的jar包 Caused by: java.lang.RuntimeException: java.io.I ...

  2. hive Caused by: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

    Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata. ...

  3. Caused by: java.net.ConnectException: Connection refused/Caused by: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    1.使用sqoop技术将mysql的数据导入到Hive出现的错误如下所示: 第一次使用命令如下所示: [hadoop@slaver1 sqoop--cdh5.3.6]$ bin/sqoop impor ...

  4. ambari-server启动出现Caused by: java.lang.RuntimeException:java.lang.ClassNotFoundEception:com.mysql.jdbc.Driver问题解决办法(图文详解)

    不多说,直接上干货! 问题详解 启动ambari-server出现 Caused by: java.lang.RuntimeException:java.lang.ClassNotFoundEcept ...

  5. RxVolley报错:Caused by: java.lang.RuntimeException: RequestQueue-> DiskBasedCache cache dir error

    Caused by: java.lang.RuntimeException: RequestQueue-> DiskBasedCache cache dir error 这是因为SD卡动态权限导 ...

  6. sqoop导出hive数据到mysql错误: Caused by: java.lang.RuntimeException: Can't parse input data

    Sqoop Export数据到本地数据库时出现错误,命令如下: sqoop export \ --connect 'jdbc:mysql://202.193.60.117/dataweb?useUni ...

  7. Caused by: java.lang.RuntimeException: JxBrowser license check failed: No valid license found

    使用jxbrower报错,原因时证书检验失败, 解决方案: 1.首先创建证书,下面是我在IDEA maven项目中创建的位置,Java项目中在src/目录下创建, META-INF/teamdev.l ...

  8. Caused by: java.lang.RuntimeException: by java.lang.OutOfMemoryError: PermGen space(tomcat 启动时提示内存溢出)

    设置MaxPermSize大小TOMCAT_HOME/bin/catalina.bat 文件头加set JAVA_OPTS='-Xms512m -Xmx1024m -XX:MaxPermSize=51 ...

  9. hive脚本出现Error: java.lang.RuntimeException: Error in configuring object和Caused by: java.lang.IndexOutOfBoundsException: Index: 9, Size: 9

    是在reduce阶段报的错误,详细错误信息是 朱传豪 19:04:48 Diagnostic Messages for this Task: Error: java.lang.RuntimeExcep ...

随机推荐

  1. JS动态改变select选择变更option的index值

    document.getElementById("louyuming").options[0].selected=true; function jsSelectIsExitItem ...

  2. struts 2中为什么抽象包不能包含action?

    struts 2中为什么抽象包不能包含action?麻烦写详细点!

  3. iOS开发-委托实战

    昨天晚上头疼,写了一部分草草的收笔了,早上起来补发一篇文章,昨天关于委托的基本使用和概念都稍微讲了一下,最开始学习委托的时候苹果官网和中文的博客文章看了不少,相似指数比较高.委托在命名要准确,最好是一 ...

  4. [转载]Elasticsearch索引重建(Rebuild)

    From:http://blog.csdn.net/changong28/article/details/38491185 索引重建(Rebuild) 索引创建后,你可以在索引当中添加新的类型,在类型 ...

  5. 搜狐视频Redis私有云平台CacheCloud

    一.CacheCloud是做什么的 CacheCloud提供一个Redis云管理平台:实现多种类型(Redis Standalone.Redis Sentinel.Redis Cluster)自动部署 ...

  6. [转] SSH免密码登陆以及穿越跳板机

    原文链接:http://www.cnblogs.com/lucantang/p/3315329.html SSH免密码登陆以及穿越跳板机   1. 免密码直连  [user@hostA ~] $ssh ...

  7. 向量的表示及协方差矩阵 (PCA的理论基础)

    原文:http://blog.csdn.net/songzitea/article/details/18219237 引言 当面对的数据被抽象为一组向量,那么有必要研究一些向量的数学性质.而这些数学性 ...

  8. [NPM] Use npx to run commands with different Node.js versions

    We will use npx to run a package using different versions of Node.js. This can become valuable when ...

  9. 免费素材-Helium (AI, EPS, SVG, Icon Font)

    在线演示 在线演示 本地下载 我很高兴和大家分享今天的素材-Helium.它有多种格式可供下载(AI, EPS, SVG, Icon Font) ,内容包含曲线.飞行器.上传下载.喇叭等类型.

  10. UE如何使用正则表达式

    1 基本概念 元字符: 元字符 说明 . 匹配除换行符以外的任意字符 \w 匹配字母或数字或下划线或汉字 \s 匹配任意的空白符() \d 匹配数字 \b 匹配单词的开始或结束 \W 匹配任意不是字母 ...