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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .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 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义