JBoss5开发web service常见问题

最近在研究EJB3,在使用EJB3的Web service的时候遇到了不少棘手的问题,现在总结常见问题与大家分享,希望您能少浪费些时间去漫天地搜解决方案,具体见下:

1.
服务器端错误信息:
jboss5 java.lang.NoClassDefFoundError: org/apache/xerces/xs/XSModel

症状:
(JBoss5.1内有此现象)在控制台启动则可以正常部署,在eclipse内则报错。

解决方法:
很可能是在添加服务器的时候选择了eclipse的JBoss插件,位置:JBoss->JBoss V5.0,改为JBoss Tool插件内的JBossAS Tool插件,位置:JBoss Community->JBoss AS V5.1

2.
(JBoss5.1内有此现象)
客户端调用报错,
当使用JBossWS调用Webservice时报错如下两个异常交替出现:
javax.xml.ws.WebServiceException: No Content-type in the header

javax.xml.ws.WebServiceException: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage

当使用Axis是报错如下:
org.xml.sax.SAXParseException: Premature end of file.

原因及解决办法:
把JBoss4.2内的JBOSS_HOME/client目录下的一下文件复制到JBoss5.1内的JBOSS_HOME/lib/endorsed目录下,重启服务就可以了。
jboss-jaxrpc.jar
jboss-jaxws.jar
jboss-jaxws-ext.jar
jboss-saaj.jar

另一种做法是下载JBoss5.1的jdk1.6版本。

参考如下:
I read the release notes for Jboss as 4.2.3.GA and it describes what to do if running webservies using jdk1.6. Here is what helped me: (taken from the release notes and followed exactly as printed)

* JBossAS 4.2.3.GA can be compiled with both Java5 & Java6. The Java5 compiled binary is our primary/recommended
binary distribution. It has undergone rigorous testing and can run under both a Java 5 and a Java 6 runtime. When
running under Java 6 you need to manually copy the following libraries from the JBOSS_HOME/client directory to
the JBOSS_HOME/lib/endorsed directory, so that the JAX-WS 2.0 apis supported by JBossWS are used:
          o jboss-jaxrpc.jar
          o jboss-jaxws.jar
          o jboss-jaxws-ext.jar
          o jboss-saaj.jar

 

posted on   张皓  阅读(1846)  评论(0编辑  收藏  举报

编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
< 2010年10月 >
26 27 28 29 30 1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31 1 2 3 4 5 6

导航

统计

点击右上角即可分享
微信分享提示