Weblogic SAAJ implementation and version problem

83 views
Skip to first unread message

kelor

unread,
Sep 19, 2007, 12:31:18 PM9/19/07
to cxf-zh
环境:weblogic9.2,cxf2.0.1
在现有一个cxf的webserivce的服务端bean和客户端bean 各加上后Interceptor后,执行代码出现does not
support SAAJ 1.1的错误信息.在bea网站上找到解决方案(http://forums.bea.com/thread.jspa?
threadID=600007964),解决方法为加上-
Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl启
动参数,加完后直接在eclipse下run客户端代码,成功调用webservice.这有个疑问,cxf所用的saaj-impl-1.3.jar
的包下也有个messageFactoryImp,但
Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.MessageFactoryImpl
后执行客户端代码是不行的.客户端报出下面的异常
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Fault
occurred while processing.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:
169)
.....................
服务端报错如下:
java.lang.UnsupportedOperationException
at
com.sun.xml.messaging.saaj.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:
70)
at
org.apache.cxf.binding.soap.saaj.SAAJInInterceptor.handleMessage(SAAJInInterceptor.java:
82)
at
org.apache.cxf.binding.soap.saaj.SAAJInInterceptor.handleMessage(SAAJInInterceptor.java:
63)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:
207)

难道用了cxf后还要加载axis的jar,而且加了
Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl
后,直接run代码是可以调用webservice,但如果部署到一个web应用(应用服务器为weblogic9.2),用jsp来调用也是失败,报
出如下异常:
信息: Interceptor has thrown exception, unwinding now
org.w3c.dom.DOMException: No such Localname for SOAP URI
at
org.apache.axis.message.SOAPDocumentImpl.createElementNS(SOAPDocumentImpl.java:
379)
at org.apache.axis.SOAPPart.createElementNS(SOAPPart.java:1109)
at
org.apache.cxf.staxutils.W3CDOMStreamWriter.writeStartElement(W3CDOMStreamWriter.java:
103)
at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:
95)
at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:
76)
at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:
57)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:
207)

花了几个小时找原因,,没找到,,郁闷.

willem

unread,
Sep 19, 2007, 11:38:14 PM9/19/07
to cxf-zh
CXF使用的SAAJ1.3 ,

我觉得你有可能要把CXF lib中的两个SAAJ jar文件放到weblogic的endorse目录里面才能解决。

姜宁 (Willem)
------------------
http://willem.bokeland.com/

kelor

unread,
Sep 20, 2007, 1:58:02 AM9/20/07
to cxf-zh
我在我这边的weblogic9.2安装目录下找不到您说的endorse目录!
另外再请教另外一个问题
WibbleClient.cxf这个文件在ant下是用jvmarg1="-
Dcxf.config.file=WibbleClient.cxf"来指定的,然后命令输入ant secure.client可以调用
service,
如果我在eclipse下直接System.setProperty()却调用不起来,原因好象就是没读到WibbleClient.cxf,导致最后
得到的工厂不是HttpsURLConnectionFactory而是HttpURLConnectionFactoryImpl,然后报出异常如
下:
Caused by: java.io.IOException: Illegal Protocol https for HTTP
URLConnection Factory.
如果我把客户端部属到应用服务器上,然后在jvm启动参数加上-Dcxf.config.file=WibbleClient.cxf,也是同样的错
误,不知道如何解决
WibbleClient.cxf下的jks路径有改成绝对路径了.
3Q.

> > 花了几个小时找原因,,没找到,,郁闷.- 隐藏被引用文字 -
>
> - 显示引用的文字 -

willem

unread,
Sep 20, 2007, 2:18:10 AM9/20/07
to cxf-zh
第一个问题可以参考cxf-user 上的一个讨论,
http://www.nabble.com/Failed-to-deploy-the-sample-helloworld.war-to-WebLogic-Server-9.2-tf4433857.html#a12649868

你可以自己建立一个endoresed目录
I created an "endoresed" directory in ${WLS_HOME}/jrockiet90_150_04/
jre/lib"

CXF configuration file 支持指定文件名和指定文件URL两种方式,
具体可以参考CXF User Guide wiki (几周前我刚修订过一遍)

http://cwiki.apache.org/CXF20DOC/configuration.html

姜宁 (Willem)
------------------
http://willem.bokeland.com/

kelor

unread,
Sep 20, 2007, 5:23:09 AM9/20/07
to cxf-zh
hi,Willem.
关于第二个问题,你所给的url看了我还是不明白如何才能解决我所说的问题.
thx

On 9月20日, 下午2时18分, willem <willem.ji...@gmail.com> wrote:
> 第一个问题可以参考cxf-user 上的一个讨论,http://www.nabble.com/Failed-to-deploy-the-sample-helloworld.war-to-W...

> > > - 显示引用的文字 -- 隐藏被引用文字 -
>
> - 显示引用的文字 -

willem

unread,
Sep 20, 2007, 7:04:29 AM9/20/07
to cxf-zh
就是这句话
If you want to use the url as the configuration location, you can
specify a command line property: -
Dcxf.config.file.url=config_file_url.
你可以通过指定 -Dcxf.config.file.url=urlfile 的方式来指定configure file的位置。

姜宁 (Willem)
------------------
http://willem.bokeland.com/

kelor

unread,
Sep 21, 2007, 3:03:19 AM9/21/07
to cxf-zh
thx Willem!
另外如果客户端调用service的方式是用spring的,那这个WibbleClient.cxf应该如何设置?

willem

unread,
Sep 21, 2007, 3:30:57 AM9/21/07
to cxf-zh
你的意思是将HttpConduit的设置和jaxws:client 的设置都放在一个xml文件中吗?
前段时间在cxf-user list 讨论过这样的问题,目前没有太好的解决方案。

详情可以参考, 都是E文的(最近比较忙,没时间翻译了),希望能对你有所帮助。

CXF JIRA 922,里面有问题原理的分析和一个work around方法
https://issues.apache.org/jira/browse/CXF-922
如何用Java API的方式设置SSL参数
http://www.nabble.com/Error-when-trying-to-contact-service-over-SSL-on-a-specific-port-tf4424617.html#a12654695

姜宁 (Willem)
------------------
http://willem.bokeland.com/

kelor

unread,
Sep 21, 2007, 3:52:48 AM9/21/07
to cxf-zh
恩,没错.
目前是不是客户端如果用spring方式实现,那么和ssl相关的我就必须直接调用api来设置相应的参数了.

On 9月21日, 下午3时30分, willem <willem.ji...@gmail.com> wrote:
> 你的意思是将HttpConduit的设置和jaxws:client 的设置都放在一个xml文件中吗?
> 前段时间在cxf-user list 讨论过这样的问题,目前没有太好的解决方案。
>
> 详情可以参考, 都是E文的(最近比较忙,没时间翻译了),希望能对你有所帮助。
>
> CXF JIRA 922,里面有问题原理的分析和一个work around方法https://issues.apache.org/jira/browse/CXF-922

> 如何用Java API的方式设置SSL参数http://www.nabble.com/Error-when-trying-to-contact-service-over-SSL-o...

willem

unread,
Sep 21, 2007, 4:11:36 AM9/21/07
to cxf-zh
你还是可以通过spring来配置ssl参数的我在CXF-922中给出了一个解决方法。
Here is a way to work around, you separate the configuration beans'
spring configuration file with the client bean's spring configuration
file.
Load the bus with the configuration beans' file first , and set the
default bus with this created bus. Then create the client bean's
context with the client bean's spring configuration file .

// http conduit configuration file , it supports wildcard
URL config = getClass().getResource("resources/
BethalClientConfig.cxf");
// the client bean configuration file
URL beans = getClass().getResource("resources/
BethalClientBeans.xml");
// We go through the back door, setting the default bus.
new DefaultBusFactory().createBus(config);
// Init the context which contains the client bean,
// and we use the already loaded bus to set the configuration
BusApplicationContext context = new
BusApplicationContext(beans, false);
Greeter bethal = (Greeter)context.getBean("Bethal");
// verify the client side's setting
verifyBethalClient(bethal);

You can find the detail demo code from [1]'s
testGetClientFromSpringContext()
[1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/
test/java/org/apache/cxf/systest/http/HTTPConduitTest.java

姜宁 (Willem)
------------------
http://willem.bokeland.com/

kelor

unread,
Sep 21, 2007, 4:22:01 AM9/21/07
to cxf-zh
thx willem !
Reply all
Reply to author
Forward
0 new messages