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 2010-10-15 17:36  张皓  阅读(1842)  评论(0编辑  收藏  举报

导航