首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

带你踏进EJB-将EJB发布为Webservice(3)

2013-11-01 
带你走进EJB--将EJB发布为Webservice(3)在上面文章中我们讲到,通过使用用JBoss5作为EJB容器的时候,调用Web

带你走进EJB--将EJB发布为Webservice(3)

   

    在上面文章中我们讲到,通过使用用JBoss5作为EJB容器的时候,调用Web服务出现了异常.异常信息如下:

***********************

CreateWeb Service Client...

CreateWeb Service...

CallWeb Service Operation...

Serversaid: port1.addUser() is a void method!

Exceptionin thread "main" javax.xml.ws.WebServiceException:java.lang.UnsupportedOperationException: setProperty must be overridden by allsubclasses of SOAPMessage

atorg.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:396)

atorg.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:302)

atorg.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)

atorg.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)

at$Proxy15.sayHello(Unknown Source)

atejb_webservice_client.WebServiceClient.main(WebServiceClient.java:15)

Causedby: java.lang.UnsupportedOperationException: setProperty must be overridden byall subclasses of SOAPMessage

atjavax.xml.soap.SOAPMessage.setProperty(SOAPMessage.java:439)

atorg.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:87)

atorg.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:169)

atorg.jboss.ws.core.CommonSOAP11Binding.createMessage(CommonSOAP11Binding.java:57)

atorg.jboss.ws.core.CommonSOAPBinding.bindRequestMessage(CommonSOAPBinding.java:157)

atorg.jboss.ws.core.CommonClient.invoke(CommonClient.java:290)

atorg.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)

... 4more


通过查找了解相关的资料和信息:

 

Iread the release notes for Jboss as 4.2.3.GA and it describes what to do ifrunning webservies using jdk1.6. Here is what helped me: (taken from therelease notes and followed exactly as printed)

 

*JBossAS 4.2.3.GA can be compiled with both Java5 & Java6. The Java5compiled binary is our primary/recommended

binarydistribution. It has undergone rigorous testing and can run under both a Java 5and a Java 6 runtime. When

runningunder Java 6 you need to manually copy the following libraries from theJBOSS_HOME/client directory to

theJBOSS_HOME/lib/endorsed directory, so that the JAX-WS 2.0 apis supported byJBossWS are used:

          o jboss-jaxrpc.jar

          o jboss-jaxws.jar

          o jboss-jaxws-ext.jar

          o jboss-saaj.jar

 

      解决方法是把JBoss4.2内的JBOSS_HOME/client目录下的一下文件复制到JBoss5.1内的JBOSS_HOME/lib/endorsed目录下,重启服务就可以了。

jboss-jaxrpc.jar

jboss-jaxws.jar

jboss-jaxws-ext.jar

jboss-saaj.jar

 

       出现的问题跟版本有关系.到此我们基本上能够使用EJB发布WebService服务,并且能够调用简单参数的WebService.但是如果想让客户端调用复杂一些的参数呢?比如一个实体.下一篇文章将会调用复杂的参数.

热点排行