实现JAX-WS,如果忘了jaxws-spring这个jar的奇怪现象
来源:互联网 发布:不动声色的大人了 知乎 编辑:程序博客网 时间:2024/04/29 23:03
之前参考网上的例子,练习了下并完好在本地实现了一个演示,但是后来很长时间没搞了,昨天重新弄的时候发现了各种奇怪现象:
1. applicationContext.xml 在第一行的前面有个红叉叉,鼠标放上去说这个错:
Referenced file contains errors (http://jax-ws.dev.java.net/spring/servlet.xsd). For more information, right click on the message in the Problems View and select "Show Details..."我用Maven能正确打包,但是部署到Tomcat就发生了下面的错误:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
还出现了不能解压这个包的错误提示:
SEVERE: Exception fixing docBase for context [/spring_ws]java.util.zip.ZipException: error in opening zip fileSEVERE: Error starting static Resourcesjava.lang.IllegalArgumentException: Invalid or unreadable WAR file : error in opening zip file
接下来 Tomcat 给出的信息让人摸不着头脑了:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 19 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 27 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'wss:binding'.
网上搜了下,说http://jax-ws.dev.java.net/spring/servlet.xsd 地址不对的有之,说需要在applicationContext.xml 里加上 http://www.springframework.org/schema/aop/spring-context-3.0.xsd 的有之,说服务器自带的 XML Parser 和项目里的 XML Parser 有冲突的有之。
当然不能说他们的说法不对,正如网上一老兄说的:“generically this exception will be thrown for many reasons.”
后来看到了 Schemas are located at the root of the jaxws-spring.jar file 并仔细查看自己的 Tomcat 的日志:org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://jax-ws.dev.java.net/spring/servlet.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
这才怀疑是不是自己的配置错了,一看 pom.xml 才知道我把 jaxws-spring 这个 dependency 给注释掉了:
<!-- <dependency><groupId>org.jvnet.jax-ws-commons.spring</groupId><artifactId>jaxws-spring</artifactId><version>1.8</version><exclusions> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> </exclusion> <exclusion> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </exclusion> <exclusion> <groupId>com.sun.xml.stream.buffer</groupId> <artifactId>streambuffer</artifactId> </exclusion> <exclusion> <groupId>org.jvnet.staxex</groupId> <artifactId>stax-ex</artifactId> </exclusion></exclusions></dependency>-->把这个注释去掉,重新打包,tomcat 才正常解压。哎,耽误了一天的功夫,不知道当初为什么把注释掉了。惭愧!
- 实现JAX-WS,如果忘了jaxws-spring这个jar的奇怪现象
- JAX-WS Spring集成jax方式的webservice
- JAX-WS整合Spring
- Spring整合JAX-WS
- Jax-Ws集成spring
- JAX-RPC vs JAX-WS(二):用JAX-WS 2.0实现高性能的Web服务
- JAX-RPC vs JAX-WS(二):用JAX-WS 2.0实现高性能的Web服务
- jax-ws服务器的实现和运行
- 基于JAX-WS规范的WebService实现
- 简单的Jax-WS WebService实现
- 简单的Jax-WS WebService实现
- 简单的Jax-WS WebService实现
- 简单的Jax-WS WebService实现
- 简单的Jax-WS WebService实现
- 简单的Jax-WS WebService实现-cxf
- 简单的Jax-WS WebService实现
- 简单的Jax-WS WebService实现
- 简单的Jax-WS webservice实现
- STL 标准模板库 vector queue list map multimap的使用基础
- [转]Linux桌面现状素描:矛盾的时代
- linux系统调用编写方法变化
- Autodesk 的 Inventor API培训教材模块
- NS2中MCMI获取接口信道利用率
- 实现JAX-WS,如果忘了jaxws-spring这个jar的奇怪现象
- 接口隔离原则
- 贫血模型和充血模型
- extract-cpio.sh
- windows Dos命令大全
- D. Train Problem I
- ClassLoader.class.getResource
- 从网上找的Android实用代码,记录备用
- vs2010多种字符解决方式